Add other JMS subscriber in topic

On of the big advance of the topic is that other subscriber can be added very easy. For instance, we have existing order application that have one ProcessOrder subscriber and we would like to add other one. In this post I will show how you can add new subscriber in NetBeans 5.0, which changes should be done:
  • First, we create new EJB module with name Accounting. We would like to add new module that will make some order's accounting tasks
  • Add new MDB bean in this project. Since, we are using durable subscription, new MDB should have different clientId name in ejb-jar.xml than other one. The clientid should be unique.
  • Under Server resources node you can see new JMS Resources. However, we would like to use existing from Order module. Delete these resources.
  • We should change sun-ejb-jar.xml file as well. Open sun-ejb-jar.xml file and change these elements: jndi-name for mdb-connection-factory and message-destination-name. See code snapshot:
         <ejb>
          <ejb-name>AccountBean</ejb-name>
          <jndi-name>jms/ProcessOrderBean</jndi-name>
          <mdb-connection-factory>
            <jndi-name>jms/ProcessOrderDestinationFactory</jndi-name>
          </mdb-connection-factory>
        </ejb>
        <message-destination>
          <message-destination-name>AccountDestination</message-destination-name>
          <jndi-name>jms/ProcessOrderBean</jndi-name>
        </message-destination>
       
  • Add OrderLib project that includes Order TO on project's classpath.
  • Implement onMessage method.
  • Deploy and test JMS client. You should see that both EJB modules received order.
  • Account module sources are avalaible here.
Comments:

Hi Sir.
Please help me.
I have a task that creating a aplication using JMS.
How make MDB that consume a message from a remote topic (different host)?? I use netbeans and Glassfish.

Thanks before Sir.

Posted by Roberto on April 13, 2010 at 08:53 PM CEST #

Post a Comment:
  • HTML Syntax: NOT allowed
About

pblaha

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today
Bookmarks