• 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 ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Need Clarification - MDBs with topic

 
Greenhorn
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?
ejb-jar.xml
<ejb-name>RequestRouteFinderMDB</ejb-name>
<ejb-class>com.gs.bonding.suppliergateway.gateway.request.RequestRouteFinderMDB</ejb-class>
<transaction-type>Container</transaction-type>
<message-driven-destination>
<destination-type>javax.jms.Topic</destination-type>
</message-driven-destination>
weblogic-ejb-jar.xml
<ejb-name>RequestRouteFinderMDB</ejb-name>
<message-driven-descriptor>
<pool>
<max-beans-in-free-pool>10</max-beans-in-free-pool>
<initial-beans-in-free-pool>2</initial-beans-in-free-pool>
</pool>
<destination-jndi-name>jms/client2gatewaytopic</destination-jndi-name>
<connection-factory-jndi-name>jms/sbclientsubconfactory</connection-factory-jndi-name>
</message-driven-descriptor>
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,
Session.AUTO_ACKNOWLEDGE);
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);
publisher.publish(msg);
} catch (JMSException jmsex) {
} catch (Exception ex) {
}
}

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