• 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
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

MDB for a topic and the deployment descriptor

 
Ranch Hand
Posts: 87
  • 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 publisher class to publish a Topic. But is a little confused how to write the MDB for the subscriber ; besides what all entries are required in the deployment desciptor of the MDB.



Thanks in advance
 
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Neha,

It is not clear from your post regarding the application server you are using as the steps could vary a little for different servers.

There is a little administration part involved as well.

As far as writing an MDB is concerned it is fairly simple... Just create a class that implements javax.jms.MessageListener and provide the implementation for the onMessage(Message message) method.

If you are using JEE 5 then you have an option to use annotations. If not then here's a sample ejb-jar.xml

--------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar xmlns = "http://java.sun.com/xml/ns/javaee"
version = "3.0"
xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation = "http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd">
<enterprise-beans>
<message-driven>
<ejb-name>TopicMDB</ejb-name>
<ejb-class>com.blah.core.blah.mdb.MDBClass</ejb-class>
<transaction-type>Container</transaction-type>
<message-destination-type>javax.jms.Topic</message-destination-type>
<message-destination-link>TopicNamehere</message-destination-link>
<resource-ref>
<description>
Topic Connection Factory where the message will be placed to be consumed
</description>
<res-ref-name>jms/URChoice</res-ref-name>
<res-type>javax.jms.TopicConnectionFactory</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
<resource-env-ref>
<description>

</description>
<resource-env-ref-name>jms/TopicMDB</resource-env-ref-name>
<resource-env-ref-type>javax.jms.Topic</resource-env-ref-type>
</resource-env-ref>
</message-driven>
</enterprise-beans>
</ejb-jar>

__________________________________________________________________________
 
We're being followed by intergalactic spies! Quick! Take this tiny ad!
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic