Applications can use extended messaging to receive and send messages in
a variety of ways:
- To receive messages, applications that use extended messaging use a receiver
bean(deployed as a message-driven bean) or an application-callable
receiver bean (deployed as a session bean):
- A receiver bean is invoked when a message arrives at a destination for
which a listener is active.
- An application-callable receiver bean polls a destination
(defined by an input port) until a message arrives or a timeout
occurs.
In addition to receiving messages, extended messaging enables applications
to send replies in response to the received messages.
For more conceptual
information about receiving messages, see Extended messaging - receiving messages.
- To send messages, applications that use extended messaging call sender
bean methods. The sender bean sends messages to the target destination
defined by an output port. The sender bean methods can be passed
either a JMS message or a number of parameters that are mapped by extended
messaging into a JMS message. Whether or not data mapping is used is specified
when the application is developed.
In addition to sending messages, applications
can choose to receive a response to the message, and can handle any responses
either synchronously or asynchronously. If a response is not received in time,
then the system can handle the late response by directing the message to a
message-driven bean.
For more conceptual information about sending messages,
see Extended messaging - sending messages.
- Applications can combine receiving and sending messages in a variety of
different ways. For example, a receiver bean deployed as a message-driven
bean can forward the message by calling a sender bean. The receiver bean can
give message data to sender bean in either of the following ways:
- The receiver bean can pass the JMS message to the sender bean, which forwards
that message.
- The receiver bean can extract data from the initial message and send that
data to the sender bean. The sender bean can then map the data values to a
new JMS message, which it forwards.
The application can receive a response to the message that it sent,
and then can send the message received or a new message built from data in
the message received, as a response to the original message.
Also, data mapping can be used to hide the JMS message structure from the
application logic. For more information about data mapping, see Extended messaging - data mapping