[jbossseam-issues] [JBoss JIRA] Commented: (JBSEAM-4237) Support message-driven POJO's

Nikolay Elenkov (JIRA) jira-events at lists.jboss.org
Sat Jun 27 00:12:56 EDT 2009


    [ https://jira.jboss.org/jira/browse/JBSEAM-4237?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12474064#action_12474064 ] 

Nikolay Elenkov commented on JBSEAM-4237:
-----------------------------------------

I have attached a patch that allows you to create MDP containers in your WAR project. 
This allows you to have any Seam component that implements javax.jms.MessageListener
receive JMS messages asynchronously. 

How to use it: 

1. Create an application scoped Seam component that implements javax.jms.MessageListener:

@Name("myListener")
@Scope(ScopeType.APPLICATION)
public class MyListener implements MessageListener {

	public void onMessage(Message message) {
            log.info("got message: " + message);
	}
}

2. Add the following to components.xml

<jms:async-message-listener-container
		auto-create="true" startup="true" name="jmsContainer"
		destination-jndi-name="queue/A" 
                listener="#{myListener}"
		exception-listener="#{myListener}" 
                outjected-session-name="myListenerSession" />

   * destination-jndi-name: JNDI name of your queue/topic
   * listener: your POJO implementing MessageListener
   * exception-listener: an optional javax.jms.ExceptionListener, it gets called on connection errors
   * outjected-session-name: if defined the underlying session is outjected to application scope. 
     You can use it to commit JMS transactions and reply to messages in your listeners.

The patch has only been (minimally) tested on JBoss 4.2.2, but should work on  any AS, 
as long as you can lookup the ConnectionFactory and destinations via JNDI. 
More details in the JavaDoc. 





> Support message-driven POJO's
> -----------------------------
>
>                 Key: JBSEAM-4237
>                 URL: https://jira.jboss.org/jira/browse/JBSEAM-4237
>             Project: Seam
>          Issue Type: Feature Request
>          Components: Async
>            Reporter: Nikolay Elenkov
>         Attachments: async-container.patch, jms-schema.patch
>
>
> Currently, if you want to use JMS in a Seam project, you have to deploy it as an EAR in a JEE application server, 
> and use MessageDriven beans. However, JMS messaging is sometimes required in web (WAR) projects as 
> well, and changing the application to and EAR and/or the application server is not possible. 
> Seam should make it easy to use message-driven POJO's (POJO's that act as asynchronous receivers for JMS messages) 
> in a web project, supporting all Seam features (injection, transaction management, etc.).  
> It could be implemented by integrating Jencks (http://jencks.codehaus.org/) for example or built on top 
> of ActiveMQ. 
> Cf. Spring support for message-driven POJO's: 
> http://static.springframework.org/spring/docs/2.5.x/reference/jms.html#jms-asynchronousMessageReception

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the seam-issues mailing list