• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

Need Clarification - MDBs with topic

Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I have a class which is putting messages on the topic. I am reading this messages in the MDB. Although I can see the message being received from the class but my MDB is not reading the messages from the topic. Can anyone please help me find what i am doing wrong?
JNDI name of the topic : java:/comp/env/jms/client2gatewaytopic
Snippets from the MDB
public void ejbCreate() throws CreateException {
System.out.println("Reached here..........RequestRouteFinderMDB....ejbCreate........");
try {
ctx = new InitialContext();
TopicConnectionFactory factory = (TopicConnectionFactory) ctx.lookup(SUPPLIER_PUB);
TopicConnection connection = factory.createTopicConnection();
TopicSession session = (TopicSession) connection.createTopicSession(false,
Topic topic = (Topic) ctx.lookup(SUPPLIER_TOPIC);
TopicPublisher publisher = session.createPublisher(topic);
} catch (NamingException e) {
throw new CreateException("Naming exception" + e);
} catch (JMSException e) {
throw new CreateException("JMS exception" + e);
public void onMessage(Message msg) {
System.out.println("Reached here..........RequestRouteFinderMDB....onMessage........");
try {
String gatewayMessage = ((TextMessage) msg).getText();
String supplierMessage = getRoutingInfo(gatewayMessage);
((TextMessage) msg).setText(supplierMessage);
} catch (JMSException jmsex) {
} catch (Exception ex) {

I would really appreciate if someone could shed some light on it.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic