Programming to use asynchronous messaging

You can build enterprise applications that use Java™ Message Service (JMS) APIs directly to provide asynchronous messaging services. You can also use message-driven beans as asynchronous message consumers. If you are writing messaging programs that interoperate between WebSphere® Application Server and WebSphere MQ, there are some environmental differences that you need to take into account.

About this task

Enterprise applications can use JMS APIs directly to explicitly poll for messages on a JMS destination, then retrieve messages for processing by business logic beans (enterprise beans).

Message-driven beans can also be used as asynchronous message consumers. When a message arrives at the destination, the EJB container invokes the message-driven bean automatically without an application having to explicitly poll the destination.

Procedure

  • Use JMS and messaging directly.

    Your enterprise applications can use Java Message Service (JMS) programming interfaces directly to provide messaging services, and methods that implement business logic.

    If you choose not to use JNDI to obtain configuration information for your messaging provider, for example for connection factories or destinations, you can instead use an API provided by your messaging provider to specify that configuration information programmatically.

  • Learn about interoperating with WebSphere MQ

    There are some differences between the WebSphere Application Server environment and the WebSphere MQ environment. If you are writing messaging programs that interoperate between these two environments, you should be aware of these differences and take them into account when designing, coding and deploying your programs.

  • Use message-driven beans.

    Applications can use message-driven beans as asynchronous message consumers. You deploy a message-driven bean as a message listener for a destination. When a message arrives at the destination, the EJB container invokes the message-driven bean automatically without an application having to explicitly poll the destination.