7 Replies Latest reply on Nov 21, 2011 5:25 AM by Matthias G.

    JBoss ESB 4.10, JBoss 6: Simple Request/Response between EJBs

    Matthias G. Newbie

      Hi,

       

      I'm using JBoss 6 with ESB 4.10. I'm absolutely new to JBoss ESB since a few weeks. The idea is to let EJBs communicate over the ESB with JMS-messages. An example could be:

      EJB1 sends TextMessage to EJB2. EJB2 gets the message with certain input, for example "GET JPA-Entity+id" and responds with the requested JPA-Entity (synchronously).

       

      It's main purpose is just redirecting the messages but the customer wants an ESB.

      I've read a lot around but I did not found a solution for this rather simple problem. I have done a few examples with the JBoss Developer Studio (but on Eclipse with Plugin) but the functionality is just too huge.

       

      Maybe someone can point me to the right direction please? Also (pseudo) configurations are very appreciated as the time is running against my small team. Also, is it really possible to implement a whole ESB with a few EJBs in let's say 3 months if nobody ever had experience with this kind of software? I can understand that reimplementing such a system is much faster it it has already be done..

       

      Thanks in advance for your help!

        • 1. Re: JBoss ESB 4.10, JBoss 6: Simple Request/Response between EJBs
          Tom Cunningham Master

          Hi Matthias,

           

          You can definitely redirect a JMS message with the ESB.    I'd take a look at the jms_router quickstart for an example of that, and I'd also take a look at the ejbprocessor quickstart to see if having the ESB invoke EJB methods helps you at all.

          1 of 1 people found this helpful
          • 2. Re: JBoss ESB 4.10, JBoss 6: Simple Request/Response between EJBs
            Matthias G. Newbie

            Hi Tom,

            thanks for your reply! The quickstart is pure gold for me. I only got one problem left..

            I changed the example a bit for a proof of concept. The problem is, my MDB does not recieve the redirected message.

            Following is my MDB, very simple because the other versions I've made do not work as expected.

             

            So if the message is sent to the queue the mdb should print something, but there is absolutely no reaction. Did I do something wrong?

            Thanks in advance!

             

            Matthias

             

             

             

            package de.private.poc.beans.mdb;
            
            
            import javax.annotation.Resource;
            import javax.ejb.ActivationConfigProperty;
            import javax.ejb.MessageDriven;
            import javax.ejb.MessageDrivenContext;
            import javax.jms.Message;
            import javax.jms.MessageListener;
            
            /**
             *
             * @author matthias
             */
            @MessageDriven(mappedName = "GatewayResponse", activationConfig = {
                @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),
                @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
                @ActivationConfigProperty(propertyName = "destination",  propertyValue = "queue/quickstart_jms_routeTo") 
            })
            public class GatewayResponse implements MessageListener {
            
            
                public GatewayResponse() {
                }
            
                @Override
                public void onMessage(Message message) {
                    System.out.println("Test");
                }
            }
            
            

             

            PS:

            I've deployed the MDB with and without ear, no result though..

            • 3. Re: JBoss ESB 4.10, JBoss 6: Simple Request/Response between EJBs
              Tom Cunningham Master

              Have you checked the queue it should be reading to make sure the message is getting there?

              • 4. Re: JBoss ESB 4.10, JBoss 6: Simple Request/Response between EJBs
                Matthias G. Newbie

                I've solved the problem. The MDB needed to authenticate to the queue from the quickstart.

                I just added the annotations:

                @ActivationConfigProperty(propertyName = "user", propertyValue = "esbuser"),
                @ActivationConfigProperty(propertyName = "password", propertyValue = "esbpassword"),
                • 5. Re: JBoss ESB 4.10, JBoss 6: Simple Request/Response between EJBs
                  Matthias G. Newbie

                  So I have a simple problem of understanding this quickstart.

                   

                  If I send a message to the gateway, how can I specify the destination where the message gets redirected to? In this example the message ends at /queue/jms_quickstart_replyTo but I do not find the queue name in the configuration files.  Also, If I add another gateway to this esb, how can I specify that only one special configured action is done and not for example the esb console output?

                   

                  For understanding:
                  At the moment I have a EJB that sends a message to the ESB gateway queue and then gets redirected to the /queue/jms_quickstart_replyTo where my MDB is listening. For now, I just answer with a message to the first EJB but in the future this answer should also go over the esb and then end at the first EJB. Also There will be more services communicating over the esb with other gateways and other actions to do..

                   

                  Thanks in advance!

                  • 6. Re: JBoss ESB 4.10, JBoss 6: Simple Request/Response between EJBs
                    Tom Cunningham Master

                    You should be able to configure the JMSRouter action to send the message to the queue you want to.     You're using the jms_router quickstart?    Are you seeing the following output?

                     

                    runtest:

                         [echo] Runs Test JMS Sender

                         [java] Connection Started

                         [java] Sent message with CorrelationID : QuickstartId[3]

                         [java]

                         [java] Received from JBossQueue[quickstart_jms_router_routeTo]:

                         [java]           [JMSMessageID : ID:JBM-3d606fac-18ca-4156-be52-48b30cc7b7ee]

                         [java]           [JMSCorrelelationID : QuickstartId[3]]

                         [java]           [JMSReplyto : null]

                         [java]           [MessageType : TextMessage]

                         [java]           [Text : JMS Router Message dummy Content]

                         [java]           [Property: MyProperty : My property value]

                    • 7. Re: JBoss ESB 4.10, JBoss 6: Simple Request/Response between EJBs
                      Matthias G. Newbie

                      Hi Tom,

                      yes I see the following output.

                      I've found the line for the queue to route to, but is it possible to use instead the JMSReplyTo-flag for the esb so that it sends the message to the queue of JMSReplyto? So dynamical routing with the JMSReplyTo-Attribute?

                      Thanks in advance!

                       

                      [Edit: ]

                      I've already found the cbs-example, but there have to be an easier way by just using the JMSReplyTo-Attribute?