public class IMSQueueConnectionFactory
extends java.lang.Object
implements javax.jms.QueueConnectionFactory
The following code fragment shows how to use IMSQueueConnectionFactory
to obtain and use a QueueConnection object.
IMSQueueConnectionFactory jmsConnectionFactory = new IMSQueueConnectionFactory();
QueueConnection jmsConnection = null;
QueueSession jmsQueueSession = null;
Queue jmsQueue = null;
QueueRequestor jmsQueueRequestor = null;
try {
jmsConnectionFactory.setTimeout(1000); //Set 10 second timeout
jmsConnectionFactory.setResponseAreaLength(128000); //Allocate 128K response area
jmsConnection = jmsConnectionFactory.createQueueConnection();
jmsQueueSession = jmsConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
jmsQueue = jmsQueueSession.createQueue("OTMDEST1");
jmsQueueRequestor = new QueueRequestor(jmsQueueSession, jmsQueue);
TextMessage sendMsg = jmsQueueSession.createTextMessage();
String msg = "My Message";
sendMsg.setText(msg);
TextMessage replyMsg = (TextMessage)jmsQueueRequestor.request(sendMsg);
System.out.println("Received message: "+replyMsg.getText());
} catch (Exception e) {
e.printStackTrace();
}
| Constructor and Description |
|---|
IMSQueueConnectionFactory() |
| Modifier and Type | Method and Description |
|---|---|
javax.jms.Connection |
createConnection() |
javax.jms.Connection |
createConnection(java.lang.String arg0,
java.lang.String arg1) |
javax.jms.QueueConnection |
createQueueConnection() |
javax.jms.QueueConnection |
createQueueConnection(java.lang.String arg0,
java.lang.String arg1) |
int |
getResponseAreaLength() |
int |
getTimeout() |
void |
setResponseAreaLength(int responseAreaLength)
Sets the responseAreaLength value.
|
void |
setTimeout(int timeout)
Sets the timeout value.
|
public javax.jms.QueueConnection createQueueConnection()
throws javax.jms.JMSException
createQueueConnection in interface javax.jms.QueueConnectionFactoryjavax.jms.JMSExceptionpublic javax.jms.QueueConnection createQueueConnection(java.lang.String arg0,
java.lang.String arg1)
throws javax.jms.JMSException
createQueueConnection in interface javax.jms.QueueConnectionFactoryjavax.jms.JMSExceptionpublic javax.jms.Connection createConnection()
throws javax.jms.JMSException
createConnection in interface javax.jms.ConnectionFactoryjavax.jms.JMSExceptionpublic javax.jms.Connection createConnection(java.lang.String arg0,
java.lang.String arg1)
throws javax.jms.JMSException
createConnection in interface javax.jms.ConnectionFactoryjavax.jms.JMSExceptionpublic void setTimeout(int timeout)
throws javax.jms.JMSException
By default, the value is set in the OTMA descriptor. If the value is set here to zero it will automatically be changed to 1000, which indicates a 10 second timeout value. The range of acceptable values is 0 - 999999.
timeout - javax.jms.JMSExceptionpublic void setResponseAreaLength(int responseAreaLength)
throws javax.jms.JMSException
responseAreaLength - javax.jms.JMSExceptionpublic int getResponseAreaLength()
public int getTimeout()