Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JMS in Jboss

 
Nikhil Jain
Ranch Hand
Posts: 389
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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("");
_init.close();

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

_connection.close();


What JNDI name should be given for Destination?

Shashank
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If its a queue named testQueue then the jndi name by default will be queue\testQueue
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic