21.2. Messaging in Seam
It is easy to send and receive JMS messages to and from Seam components.
21.2.1. Configuration
To configure Seam infrastructure to send JMS messages, you must first tell Seam about the topics and queues you want to send messages to, and where to find the
QueueConnectionFactory
and TopicConnectionFactory
, depending on your requirements.
By default, Seam uses
UIL2ConnectionFactory
, the default connection factory with JBossMQ. If you use another JMS provider, you must set one or both of queueConnection.queueConnectionFactoryJndiName
and topicConnection.topicConnectionFactoryJndiName
, in either seam.properties
, web.xml
, or components.xml
.
To install Seam-managed
TopicPublisher
s and QueueSender
s, you must also list topics and queues in components.xml
:
<jms:managed-topic-publisher name="stockTickerPublisher" auto-create="true" topic-jndi-name="topic/stockTickerTopic"/> <jms:managed-queue-sender name="paymentQueueSender" auto-create="true" queue-jndi-name="queue/paymentQueue"/>