public class ReceiveSubscriber extends Object implements Closeable, javax.jms.MessageListener
getMessage(long) method is used to return the next message,
either directly using receive(timeout) or from the queue using poll(timeout).| Constructor and Description |
|---|
ReceiveSubscriber(boolean useProps,
String initialContextFactory,
String providerUrl,
String connfactory,
String destinationName,
String durableSubscriptionId,
String clientId,
String jmsSelector,
boolean useAuth,
String securityPrincipal,
String securityCredentials)
Constructor takes the necessary JNDI related parameters to create a
connection and prepare to begin receiving messages.
|
ReceiveSubscriber(int queueSize,
boolean useProps,
String initialContextFactory,
String providerUrl,
String connfactory,
String destinationName,
String durableSubscriptionId,
String clientId,
String jmsSelector,
boolean useAuth,
String securityPrincipal,
String securityCredentials)
Constructor takes the necessary JNDI related parameters to create a
connection and create an onMessageListener to prepare to begin receiving messages.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
close() will stop the connection first.
|
javax.jms.Message |
getMessage(long timeout)
Get the next message or null.
|
void |
onMessage(javax.jms.Message message) |
void |
start()
Calls Connection.start() to begin receiving inbound messages.
|
void |
stop()
Calls Connection.stop() to stop receiving inbound messages.
|
public ReceiveSubscriber(boolean useProps,
String initialContextFactory,
String providerUrl,
String connfactory,
String destinationName,
String durableSubscriptionId,
String clientId,
String jmsSelector,
boolean useAuth,
String securityPrincipal,
String securityCredentials)
throws NamingException,
javax.jms.JMSException
start() to enable message reception.useProps - if true, use jndi.properties instead of
initialContextFactory, providerUrl, securityPrincipal, securityCredentialsinitialContextFactory - providerUrl - connfactory - destinationName - durableSubscriptionId - clientId - jmsSelector - Message SelectoruseAuth - securityPrincipal - securityCredentials - javax.jms.JMSException - if could not create context or other problem occurred.NamingExceptionpublic ReceiveSubscriber(int queueSize,
boolean useProps,
String initialContextFactory,
String providerUrl,
String connfactory,
String destinationName,
String durableSubscriptionId,
String clientId,
String jmsSelector,
boolean useAuth,
String securityPrincipal,
String securityCredentials)
throws NamingException,
javax.jms.JMSException
start() to enable message reception.queueSize - maximum queue size <=0 == no limituseProps - if true, use jndi.properties instead of
initialContextFactory, providerUrl, securityPrincipal, securityCredentialsinitialContextFactory - providerUrl - connfactory - destinationName - durableSubscriptionId - clientId - jmsSelector - Message SelectoruseAuth - securityPrincipal - securityCredentials - javax.jms.JMSException - if could not create context or other problem occurred.NamingExceptionpublic void start()
throws javax.jms.JMSException
javax.jms.JMSExceptionpublic void stop()
throws javax.jms.JMSException
javax.jms.JMSExceptionpublic javax.jms.Message getMessage(long timeout)
throws javax.jms.JMSException
timeout - in millisecondsjavax.jms.JMSExceptionpublic void close()
close in interface Closeableclose in interface AutoCloseablepublic void onMessage(javax.jms.Message message)
onMessage in interface javax.jms.MessageListenerCopyright © 1998-2013 Apache Software Foundation. All Rights Reserved.