[jboss-user] [JBoss Messaging Users] - enableOrderingGroup() not available inside ejb3 Bean an JmsX

mclu do-not-reply at jboss.com
Wed Aug 26 08:25:47 EDT 2009


Hi!

Any hint on this?

I testest OrderingGroup on 1.4.5 (build 7766) with a client like this:

  | Connection connection = getConnection();
  |         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
  |         JBossMessageProducer sender = (JBossMessageProducer) session.createProducer(queue);
  |         sender.enableOrderingGroup("Group1");
  | 

The Connection Factory is fetched using
  
  | Hashtable<String, String> env = new Hashtable<String, String>();
  |         env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
  |         env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
  |         env.put(Context.PROVIDER_URL, "localhost:22099");
  | 
  |         InitialContext ic = new InitialContext(env);
  |         cf = (ConnectionFactory) ic.lookup("ConnectionFactory");
  |         queue = (Queue) ic.lookup("/queue/testQueue");
  |         ic.close();
  | 

It works perfect.
Now I want to migrate this to my ejb3 beans which sends messages but uses transactions.
I am using:

  | @Resource(mappedName="java:/JmsXA")
  | private ConnectionFactory cf;
  | 
  | ...
  | 
  | Connection connection = cf.createConnection();
  | connection.start();
  | 
  | Session session = connection.createSession(true, Session.SESSION_TRANSACTED);
  |         JBossMessageProducer sender = (JBossMessageProducer) session.createProducer(queue);
  |         sender.enableOrderingGroup("Group1");
  | 
  | 

This gives a class cast exception because createProducer returns
org.jboss.resource.adapter.jms.JmsMessageProducer and not JBossMessageProducer. The JBossMessageProducer is part of JmsMessageProducer but I can not get it.
I want to use more than one ordering group so it would be nice to be able to set it via the producer.

Any hint how I can handle it with transaction support?
At pdf Userguide page 21 it says regarding JmsXA
"JMS XA Resource adapter, use this to get transacted JMS in beans"


View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4251785#4251785

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4251785



More information about the jboss-user mailing list