File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes Need Clarification  - MDBs with topic Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Need Clarification  - MDBs with topic" Watch "Need Clarification  - MDBs with topic" New topic
Author

Need Clarification - MDBs with topic

Nidhi Juneja
Greenhorn

Joined: Oct 07, 2002
Posts: 27
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need Clarification - MDBs with topic