public class ReceiveSubscriber extends Object implements Closeable
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.
|
Message |
getMessage(long timeout)
Get the next message or null.
|
void |
onMessage(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,
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 - 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,
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 - JMSException - if could not create context or other problem occurred.NamingExceptionpublic void start()
throws JMSException
JMSExceptionpublic void stop()
throws JMSException
JMSExceptionpublic Message getMessage(long timeout)
throws JMSException
timeout - in millisecondsJMSExceptionpublic void close()
close in interface Closeableclose in interface AutoCloseablepublic void onMessage(Message message)
Copyright © 1998-2015 Apache Software Foundation. All Rights Reserved.