This content has been marked as final.
Show 4 replies
-
1. Re: Seam and MDB
mirko27 Apr 4, 2006 11:53 AM (in response to prp)what do you mean with MDB? I`m not very updated at termins.
-
2. Re: Seam and MDB
gavin.king Apr 4, 2006 11:55 AM (in response to prp)Yes, you can, but not all Seam contexts will be available.
I think you need to use Seam CVS for this to work.
In future, I will implement stuff to let you pass Seam conversation ids in the message header, which will allow all Seam contexts to be used from an MDB. -
3. Re: Seam and MDB
prp Apr 5, 2006 10:23 AM (in response to prp)"gavin.king@jboss.com" wrote:
Yes, you can, but not all Seam contexts will be available.
Can you give an example that shows how to use this?
I tried to call Contexts.getSessionContext() or Component.getInstance("mySeamComponent", false) from within my MDB but both methods return null. Anotating the MDB into a Seam component also doesn't help.
I used the latest nightly build./* *@Name("myMDB") *@Interceptors(SeamInterceptor.class) *@Scope(ScopeType.STATELESS) */ @MessageDriven(activationConfig = { @ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Queue"), @ActivationConfigProperty(propertyName="destination", propertyValue="queue/testJms") }) public class MyMDB implements MessageListener { ... @In private Context statelessContext; private Context sessionContext; public void onMessage(Message msg) { sessionContext = Contexts.getSessionContext(); log.info("StatelessContext = " + statelessContext); //returns null log.info("SessionContext = " + sessionContext); //returns null } }
-
4. Re: Seam and MDB
gavin.king Apr 5, 2006 10:37 AM (in response to prp)Yes, of course there can be no session context in an MDB ;-)