From seam-commits at lists.jboss.org Fri Jun 12 18:11:37 2009 Content-Type: multipart/mixed; boundary="===============3034174288367280446==" MIME-Version: 1.0 From: seam-commits at lists.jboss.org To: seam-commits at lists.jboss.org Subject: [seam-commits] Seam SVN: r11146 - branches/community/Seam_2_2/doc/Seam_Reference_Guide/en-US. Date: Fri, 12 Jun 2009 18:00:27 -0400 Message-ID: --===============3034174288367280446== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: dan.j.allen Date: 2009-06-12 18:00:27 -0400 (Fri, 12 Jun 2009) New Revision: 11146 Modified: branches/community/Seam_2_2/doc/Seam_Reference_Guide/en-US/Jms.xml Log: clarify section on JMS with regard to using Seam components Modified: branches/community/Seam_2_2/doc/Seam_Reference_Guide/en-US/Jms.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- branches/community/Seam_2_2/doc/Seam_Reference_Guide/en-US/Jms.xml 2009= -06-12 21:59:41 UTC (rev 11145) +++ branches/community/Seam_2_2/doc/Seam_Reference_Guide/en-US/Jms.xml 2009= -06-12 22:00:27 UTC (rev 11146) @@ -9,8 +9,8 @@ = - But for many use cases, JMS is overkill. Seam layers a simple asyn= chronous method and event - facility over your choice of dispatchers: + But for cases when you are simply want to use a worker thread, JMS= is overkill. Seam layers a simple + asynchronous method and event facility over your choice of dispatchers: = @@ -30,6 +30,198 @@ + + + This chapter first covers how to leverage Seam to simplify JMS and= then explains how to use the + simpler asynchronous method and event facility. + + = + + Messaging in Seam + = + + Seam makes it easy to send and receive JMS messages to and from + Seam components. Both the message publisher and the message receiv= er + can be Seam components. + + + + You'll first learn to setup a queue and topic message publisher an= d then = + look at an example that illustrates how to perform the message exc= hange. + + = + + Configuration + + To configure Seam's infrastructure for sending JMS messages, + you need to tell Seam about any topics and queues you want to + send messages to, and also tell Seam where to find the + QueueConnectionFactory and/or + TopicConnectionFactory. + + = + + Seam defaults to using UIL2ConnectionFactory + which is the usual connection factory for use with JBossMQ. If + you are using some other JMS provider, you need to set one or + both of queueConnection.queueConnectionFactoryJndiNam= e + and topicConnection.topicConnectionFactoryJndiName + in seam.properties, web.xml + or components.xml. + + = + + You also need to list topics and queues in components= .xml + to install Seam managed TopicPublishers and + QueueSenders: + + = + + +]]> + + + + + Sending messages + + Now, you can inject a JMS TopicPublisher and + TopicSession into any Seam component to pub= lish + an object to a topic: + + = + + + or to a queue: + + + + + = + + Receiving messages using a message-driven bean + + You can process messages using any EJB 3 message-driven bean. = The MDB + can even be a Seam component, in which case it's possible to i= nject + other event- and application- scoped Seam components. Here's a= n example + of the payment receiver, which delegates to a payment processo= r. + = + + + You'll likely need to set the create attribute on the @In annotation to true (i.e. + create =3D true) to have Seam create an instance of the co= mponent being injected. This isn't necessary if + the component supports auto-creation (e.g., it's annotated= with @Autocreate). + + + + + First, create an MDB to receive the message. + + + + + + Then, implement the Seam component to which the receiver deleg= ates processing of the payment. + + + + + + If you are going to be performing transaction operations in yo= ur MDB, you should ensure that you + are working with an XA datasource. Otherwise, it won't be poss= ible to rollback database changes + if the database transaction commits and a subsequent operation= being performed by the message + fails. + + + = + + Receiving messages in the client + + Seam Remoting lets you subscribe to a JMS topic from client-si= de JavaScript. This is + described in . + + + = + = Asynchronicity @@ -412,110 +604,4 @@ = - = - - Messaging in Seam - = - - Seam makes it easy to send and receive JMS messages to and from - Seam components. - - = - - Configuration - - To configure Seam's infrastructure for sending JMS messages, - you need to tell Seam about any topics and queues you want to - send messages to, and also tell Seam where to find the - QueueConnectionFactory and/or - TopicConnectionFactory. - - = - - Seam defaults to using UIL2ConnectionFactory - which is the usual connection factory for use with JBossMQ. If - you are using some other JMS provider, you need to set one or - both of queueConnection.queueConnectionFactoryJndiNam= e - and topicConnection.topicConnectionFactoryJndiName - in seam.properties, web.xml - or components.xml. - - = - - You also need to list topics and queues in components= .xml - to install Seam managed TopicPublishers and - QueueSenders: - - = - - -]]> - - - - - Sending messages - - Now, you can inject a JMS TopicPublisher and - TopicSession into any component: - - = - - - Or, for working with a queue: - - - - - = - - Receiving messages using a message-driven bean - - You can process messages using any EJB3 message driven bean. M= essage-driven - beans may even be Seam components, in which case it is possibl= e to inject - other event and application scoped Seam components. - - - = - - Receiving messages in the client - - Seam Remoting lets you subscribe to a JMS topic from client-si= de JavaScript. This is - described in . - - - = - --===============3034174288367280446==--