• Post Reply Bookmark Topic Watch Topic
  • New Topic

Need Clarification - MDBs with topic  RSS feed

Nidhi Juneja
Posts: 27
  • Mark post as helpful
  • send pies
  • 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.
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!