public class JMSConsumer extends JMSClient
Modifier and Type | Field and Description |
---|---|
protected javax.jms.MessageConsumer |
consumer
The MessageConsumer used to receive messages synchronously from the Destination.
|
protected int |
receiveMode
The default receive mode is RECEIVEMODE_NOWAIT.
|
static int |
RECEIVEMODE_NOWAIT
The receive mode type where the consumer will not wait for a message to come and
will return immediately if it does not find any message.
|
static int |
RECEIVEMODE_WAIT
The receive mode type where the consumer will wait for a message to come till
it times out.
|
protected java.lang.String |
selector
The message selector for the MessageConsumer.
|
protected java.lang.String |
subscriptionName
The subscription name in case of subscribing to a Topic.
|
protected long |
waitTimeOut
The wait timeout in case the receive mode is RECEIVEMODE_WAIT.
|
conFactoryName, conn, destinationHandle, destinationName, destinationType, env, isExternalSession, JMS_LOGGER, jmsLogger, NO_TX, providerPassword, providerUserName, QUEUE, session, SESSION_TX, TOPIC, txMode, valid
Constructor and Description |
---|
JMSConsumer(java.lang.String destinationName,
java.lang.String selector,
javax.jms.Session session,
java.util.Properties env) |
JMSConsumer(java.lang.String destinationName,
java.lang.String selector,
javax.jms.Session session,
java.lang.String subscriptionName,
java.util.Properties env) |
JMSConsumer(java.lang.String destinationName,
java.lang.String conFactoryName,
java.lang.String selector,
int txMode,
int receiveMode,
long waitTimeOut,
java.util.Properties env) |
JMSConsumer(java.lang.String destinationName,
java.lang.String conFactoryName,
java.lang.String selector,
int txMode,
int receiveMode,
long waitTimeOut,
java.util.Properties env,
java.lang.String providerUserName,
java.lang.String providerPassword) |
JMSConsumer(java.lang.String destinationName,
java.lang.String conFactoryName,
java.lang.String selector,
int txMode,
java.util.Properties env) |
JMSConsumer(java.lang.String destinationName,
java.lang.String conFactoryName,
java.lang.String selector,
int txMode,
java.util.Properties env,
java.lang.String providerUserName,
java.lang.String providerPassword) |
JMSConsumer(java.lang.String destinationName,
java.lang.String conFactoryName,
java.lang.String selector,
int txMode,
java.lang.String subscriptionName,
java.util.Properties env) |
JMSConsumer(java.lang.String destinationName,
java.lang.String conFactoryName,
java.lang.String selector,
int txMode,
java.lang.String subscriptionName,
java.util.Properties env,
java.lang.String providerUserName,
java.lang.String providerPassword) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Releses all resources that is cached by the client like JMS Session and
Connection.
|
protected void |
createClient()
Internal method to create the MessageConsumer from the JMS Session.
|
JMSClient |
createClientInSession()
Creates another JMSClient of the same type in this clients Session.
|
JMSClient |
createClientInSession(java.lang.String destinationName,
java.util.Properties env)
Creates another JMSClient of the same type in this clients Session.
|
JMSProducer |
createJMSProducerInSession()
Creates a
JMSProducer in the same Session. |
protected javax.jms.Message |
getJMSMessage(boolean autocommit)
internal method to get the JMS message from the Destination.
|
JMSData |
getMessage(boolean autocommit)
Get a message from the Queue matching the selection criterion [if a message selector
is specified].
|
commitTx, createConnection, createSession, getDestinationName, getEnvironment, getProviderPassword, getProviderUserName, getSession, invalidate, isValid, rollbackTx, setDestination
protected javax.jms.MessageConsumer consumer
protected java.lang.String selector
protected java.lang.String subscriptionName
public static final int RECEIVEMODE_NOWAIT
public static final int RECEIVEMODE_WAIT
protected int receiveMode
protected long waitTimeOut
public JMSConsumer(java.lang.String destinationName, java.lang.String conFactoryName, java.lang.String selector, int txMode, java.util.Properties env) throws MXException
destinationName
- the JNDI name of the Destination.conFactoryName
- the JNDI name of the ConnectionFactory.selector
- The message selector for the MessageConsumer.txMode
- The transaction mode for the JMS client Session.env
- The env properties to create an InitialContext.MXException
public JMSConsumer(java.lang.String destinationName, java.lang.String conFactoryName, java.lang.String selector, int txMode, java.util.Properties env, java.lang.String providerUserName, java.lang.String providerPassword) throws MXException
destinationName
- the JNDI name of the Destination.conFactoryName
- the JNDI name of the ConnectionFactory.selector
- The message selector for the MessageConsumer.txMode
- The transaction mode for the JMS client Session.env
- The env properties to create an InitialContext.providerUserName
- The provider connection user.providerPassword
- The provider connection password.MXException
public JMSConsumer(java.lang.String destinationName, java.lang.String conFactoryName, java.lang.String selector, int txMode, int receiveMode, long waitTimeOut, java.util.Properties env) throws MXException
destinationName
- the JNDI name of the Destination.conFactoryName
- the JNDI name of the ConnectionFactory.selector
- The message selector for the MessageConsumer.txMode
- The transaction mode for the JMS client Session.receiveMode
- The default receive mode is RECEIVEMODE_NOWAIT.waitTimeOut
- The wait timeout in milliseconds.env
- The env properties to create an InitialContext.MXException
public JMSConsumer(java.lang.String destinationName, java.lang.String conFactoryName, java.lang.String selector, int txMode, int receiveMode, long waitTimeOut, java.util.Properties env, java.lang.String providerUserName, java.lang.String providerPassword) throws MXException
destinationName
- the JNDI name of the Destination.conFactoryName
- the JNDI name of the ConnectionFactory.selector
- The message selector for the MessageConsumer.txMode
- The transaction mode for the JMS client Session.receiveMode
- The default receive mode is RECEIVEMODE_NOWAIT.waitTimeOut
- The wait timeout in milliseconds.env
- The env properties to create an InitialContext.providerUserName
- The provider connection user.providerPassword
- The provider connection password.MXException
public JMSConsumer(java.lang.String destinationName, java.lang.String conFactoryName, java.lang.String selector, int txMode, java.lang.String subscriptionName, java.util.Properties env, java.lang.String providerUserName, java.lang.String providerPassword) throws MXException
destinationName
- the JNDI name of the Destination.conFactoryName
- the JNDI name of the ConnectionFactory.selector
- The message selector for the MessageConsumer.txMode
- The transaction mode for the JMS client Session.subscriptionName
- The subscription name in case of subscribing to a Topic.env
- The env properties to create an InitialContext.providerUserName
- The provider connection user.providerPassword
- The provider connection password.MXException
public JMSConsumer(java.lang.String destinationName, java.lang.String conFactoryName, java.lang.String selector, int txMode, java.lang.String subscriptionName, java.util.Properties env) throws MXException
destinationName
- the JNDI name of the Destination.conFactoryName
- the JNDI name of the ConnectionFactory.selector
- The message selector for the MessageConsumer.txMode
- The transaction mode for the JMS client Session.subscriptionName
- The subscription name in case of subscribing to a Topic.env
- The env properties to create an InitialContext.MXException
public JMSConsumer(java.lang.String destinationName, java.lang.String selector, javax.jms.Session session, java.util.Properties env) throws MXException
destinationName
- the JNDI name of the Destination.selector
- The message selector for the MessageConsumer.session
- the JMS session from which the client should be created.env
- The env properties to create an InitialContext.MXException
public JMSConsumer(java.lang.String destinationName, java.lang.String selector, javax.jms.Session session, java.lang.String subscriptionName, java.util.Properties env) throws MXException
destinationName
- the JNDI name of the Destination.selector
- The message selector for the MessageConsumer.session
- the JMS session from which the client should be created.subscriptionName
- The subscription name in case of subscribing to a Topic.env
- The env properties to create an InitialContext.MXException
protected void createClient() throws MXException
JMSClient
MXException
public JMSData getMessage(boolean autocommit) throws MXException
autocommit
- If set to true will commit the transaction if invoked in the context
of a JMS Session transaction.
See txMode
for more details.MXException
public void close()
JMSClient
protected javax.jms.Message getJMSMessage(boolean autocommit) throws MXException
autocommit
- If set to true will commit the transaction if invoked in the context
of a JMS Session transaction.MXException
public JMSClient createClientInSession() throws MXException
JMSClient
createClientInSession
in class JMSClient
MXException
public JMSClient createClientInSession(java.lang.String destinationName, java.util.Properties env) throws MXException
JMSClient
createClientInSession
in class JMSClient
MXException
public JMSProducer createJMSProducerInSession() throws MXException
JMSProducer
in the same Session.MXException