9 Replies Latest reply on Apr 19, 2007 4:06 AM by Mihai Anescu

    Message Flow

    John Pount Newbie


      I am trying to send a message from one external app to another via the ESB but I want it to go through a set of actions on the way. How do I do this ?

      I have the senders and listeners up and running and I can set up the actions in order to each get the message but how do I specify the outbound queue to the receiving system? Do I use the Notifer, code it in an action or can I put it in the config file ?

      I would also like to be able to call an external WS from within an action. Is this possible ?


        • 1. Re: Message Flow
          Burr Sutter Master

          The quickstart helloworld_action takes an inbound JMS message, pass it through a chain of actions then uses a notifier to send it back out to another JMS queue.

          I believe that is what you are looking for.


          • 2. Re: Message Flow
            Burr Sutter Master

            On the issue of calling an external WS...

            In 4.0 CR2/GA you will need to use a standard WS tool to generate the client-side stubs you need to perform Java to WS invocations. JBoss AS ships with JBossWS which has a tool called wstools.bat. You'll find it in the "bin" directory for the 4.0.4+ app server and the documentation is in the JBossWS area of this website.

            There is no configuration technique (e.g. any XML to put into jbossesb.xml) to expose/produce or consume a WS in this release of the product. However, standard 'ol Java will do the trick and you can embedded that into an Action.

            I'll add this as a quickstart (produce & consume) so that it is more obvious. Or perhaps you would be willing to contribute that quickstart! ;-)


            • 3. Re: Message Flow
              John Pount Newbie


              Thanks for the replies to this and the other related topic.

              I have looked at the trailblazer and other samples and they are fairly simple and obviously evolving. I guessed as much about the WS but was just checking that there was nothing I could do in the XML configs before I started writing my own client code.

              So just to recap ...

              External WS - Need to write/generate my own client code and embed it in an action.

              External JMS - Similar to the helloworld, I can send a message out to an external system and receive it back as per normal JMS. I need to set replyTo etc to implement message correlation.

              Sync Request/Reply service. I should use Two-Way courier and JMS correlation.

              Thanks again for your help.

              • 4. Re: Message Flow
                Esteban Schifman Newbie

                Hi John,
                The route(Message) method in CbrProxyAction can illustrate a synch request/reply using JMS
                Good luck.


                • 5. Re: Message Flow
                  Burr Sutter Master


                  - WS consume or produce: roll your own code for now - nothing declarative
                  - JMS outbound from the bus to the outside world might be able to use the notification feature. Check out the jbossesb.xml in the helloworld_action quickstart. I've not checked the correlationid so you may just have to make your own JMS call.
                  - For Sync request/reply, Esteban suggest looking in CbrProxyAction.java but you'll need to download the source distro or check out from SVN.
                  Here is the section that seems to be interesting:

                   TwoWayCourier courier = CourierFactory
                   .getCourier(epr, null);
                   EPR replyEpr = getReplyToEpr(epr);
                   if (message.getHeader().getCall() == null)
                   Call call = new Call();
                   // If not successful try the next EPR
                   if (courier.deliver(message))
                   // wait for the reply.
                   replyMessage = courier
                   catch (CourierTimeoutException e)
                   throw new MessageRouterException(e
                   .getLocalizedMessage(), e);
                   // if we get here we were successful so we can break
                   // from the loop and reply.

                  This is obviously not good enough from a documentation standpoint. Sync request/reply is something that we are working to flesh out.

                  Please let us know if you have any troubles in this area and we'll work through it.


                  • 6. Re: Message Flow

                    John, the Trailblazer also makes use of the same code shown above for a 2Way (sync) communication. You can grab it from svn right now to see the example, or wait till the GA shortly to see it in action for an idea of how you could do it.

                    As Burr pointed out, WS consumer/producer is not yet available. In the trailblazer, I used a simple JSR 181 annotated pojo web service consumer to receive requests and then invoke the courier/gateways an action processing capabilities of the ESB. I am writing up some docs for the TB now which will help explain the scenario and the code/config files behind it a little more.


                    • 7. Re: Message Flow
                      Mihai Anescu Newbie


                      I have the same issue here.
                      We need to pass messages into ESB via various providers (SMTP, WS, FTP, etc), make some transformations on them and after that send them to various clients (the same protocols that are "listened" will probably need to be implemented as out ports).

                      So far what ESB can do is to link several actions one after another. So the "outbound connector" is the last action in a chain. Do you plan to implement some sort of "outbound connector"?

                      I mean for example to have something like:

                      [FTP listener] -> [action1] -> [action2] -> [action3] -> [SMTP outbound connector]

                      With everything being specified in the jboss-esb.xml.
                      For example now to simulate the last step, i could use an action and specify with
                      <property name="[name]" value="[value]"/>
                      tags all the properties I need to define. But that means that I will have one action class for each protocol.
                      See real example here:
                       <action name="actionFTP"
                       <property name="account" value="123456" />
                       <action name="sendToFTP"
                       <property name="transformation" value="none"/>
                       <property name="ftp-hostname" value="ts541"/>
                       <property name="ftp-username" value="testuser"/>
                       <property name="ftp-password" value="testpassword"/>
                       <property name="ftp-directory" value="/outbound"/>
                       <property name="ftp-file-name" value="FTPOutput.dat"/>

                      • 8. Re: Message Flow
                        Burr Sutter Master

                        If you are writing your own custom action then you can build one that handles all protocols based on the presence of the properties.

                        Look at the quickstart called "more_action" to see how custom/nested properties currently work.

                        Plus JBoss ESB already has an outbound action called
                        that allows you to outbound a message to the console, JMS queue, FTP and SMTP. It might give you something to use "out-of-the-box" or a least extend to your own needs.

                        • 9. Re: Message Flow
                          Mihai Anescu Newbie


                          In the meanwhile I have found the "Notifier" type, and I've been able to use it.