Introduced in Version 3.5.3

InfoCenter Home >
4: Developing applications >
4.3: Developing enterprise beans >
4.3.3: Using Java Message Service (JMS) resources

4.3.3: Using Java Message Service (JMS) resources

WebSphere Application Server Enterprise JavaBeans now support the transactional use of MQSeries Java Message Service (JMS) resources.

To use this feature, install MQSeries version 5.2 and the MQSeries classes for Java and JMS. Only MQSeries V5.2 provides this support; earlier versions will not work.

To configure JMS resources for use with WebSphere Application Server:

  1. Download the MQSeries Java and JMS classes from URL, http://www.ibm.com/software/ts/mqseries/api/mqjava.html
  2. Review the MQSeries Using Java book which describes how to configure JMS resources for use with WebSphere Application Server.
  3. Use the MQSeries administration tool, JMSAdmin, to bind the Java and JMS classes to the JNDI namespace.
  4. Configure the following three parameters of the MQSeries administration tool, JMSAdmin to support WebSphere Application Server:
  5. Review the WebSphere Application Server specific configuration instructions.
  6. Review the WebSphere Application Server JMS connection factories in JMSAdmin, specifically:
    • WSQCF - queue connection factory
    • WSTCF - topic connection factory

WebSphere Application Server connection factory objects

All QueueSession and TopicSession objects created from the WebSphere Application Server connection factories are transacted, and require an active transaction for the following calls:

  • QueueSender.send
  • MessageConsumer.receive
  • MessageConsumer.receiveNoWait
  • TopicPublisher.publish

  
  1. Using these calls in an unspecified transaction context, that is when there is no active transaction, is not supported.
  2. Messages sent via QueueSender.send or published using TopicPublisher.publish do not become visible until the transaction is committed.
  3. Messages received by MessageConsumer.receive or MessageConsumer.receiveNoWait are requeued if the transaction is rolled back.
  4. Both bean-managed transaction demarcation and container-managed demarcation are supported.
  5. Calls to QueueConnection.createQueueSession and TopicConnection.createTopicSession are given the parameters:
    • true (transacted)
    • 0 (zero, since acknowledgeMode is not relevant).
    The actual values of the parameters are ignored.
  6. You cannot obtain a non-transacted session from the WebSphere Application Server JMS connection factories. To create a non-transacted session, you must use a conventional queue connection factory or topic connection factory such as QCF or TCF in the JMSAdmin tool.
  7. Requestors are only used with non-transacted sessions. Therefore, QueueRequestor and TopicRequestor cannot be used with sessions created by WebSphere Application Server JMS connection factories.
  8. With the Enterprise JavaBeans programming model, you must ensure all JMS resources are closed correctly. Since JMS resources never time-out, JMS resources that are not closed correctly will continue to consume MQSeries resources. The MQSeries resources also persist until the application server or MQSeries Queue manager is restarted.

Unsupported interfaces and methods

The following JMS interfaces are not designed for application use and, therefore, cannot be invoked:

Unsupported interfaces
javax.jms.ServerSession
javax.jms.ServerSessionPool
javax.jms.ConnectionConsumer
all the javax.jms.XA interfaces

The following JMS methods are inappropriate in this environment and interfere with connection management by the container. Therefore, these methods cannot be used:

Unsupported methods
javax.jms.Connection.setExceptionListener
javax.jms.Connection.stop
javax.jms.Connection.setClientID
javax.jms.Connection.setMessageListener
javax.jms.Session.getMesssageListener
javax.jms.Session.run
javax.jms.QueueConnection.createConnectionConsumer
javax.jms.TopicConnection.createConnectionConsumer
javax.jms.TopicConnection.createDurableConnectionConsumer
javax.jms.MessageConsumer.setMessageListener
javax.jms.Session.commit
javax.jms.Session.rollback
javax.jms.Session.recover
javax.jms.Message.acknowledge

   You cannot register a MessageListener with a QueueReceiver or TopicSubscriber. These restrictions match the ones documented in the Enterprise JavaBeans 2.0 specification.

Go to previous article: JNDI caching Go to next article: Personalizing applications

 

 
Go to previous article: JNDI caching Go to next article: Personalizing applications