It's not a secret anymore!
The moose likes JBoss/WildFly and the fly likes JMS in Jboss Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "JMS in Jboss" Watch "JMS in Jboss" New topic

JMS in Jboss

Nikhil Jain
Ranch Hand

Joined: May 15, 2005
Posts: 389
I am trying to creating simple JMS application.

Properties props = new Properties();
props.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
props.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming rg.jnp.interfaces");
props.setProperty("java.naming.provider.url", "localhost:1099");
Context _init = new InitialContext(props);

ConnectionFactory _cf = (ConnectionFactory) _init.lookup("QueueConnectionFactory");
Destination _dest = (Destination)_init.lookup("");

Connection _connection = _cf.createConnection();
Session _session = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
MessageProducer _sender = _session.createProducer(_dest);
TextMessage _text = _session.createTextMessage("Hello JMS!!");


What JNDI name should be given for Destination?


SCJP 1.4, SCWCD 1.4, SCBCD 1.5, TOGAF 9, Comptia Cloud+
Jaikiran Pai

Joined: Jul 20, 2005
Posts: 10441

If its a queue named testQueue then the jndi name by default will be queue\testQueue

[My Blog] [JavaRanch Journal]
I agree. Here's the link:
subject: JMS in Jboss
It's not a secret anymore!