1 Reply Latest reply on Dec 21, 2013 11:52 AM by Sebastian Brandt

    Mesagging System with Fuse and A-MQ

    CESAR O Newbie

      We have JBoss Fuse with support. We need to implement a messaging system, specific to our needs. The reception and sending messages require TCP connections to external devices. This devices can receive messages and reply  messages .


      Let me know if you have any suggestions for this problem. The messages need to be persisted (not only during processing): A message history can be consulted in the future. It is important to consult the message history for messages received or sent to an external device at any time.


      The flow for receiving messages would be:


      1 - Use a component to pass the message received via TCP to an ActiveMQ queue

      2 - A Camel route takes the message from the queue. A Camel component makes a connection to the database and saves the message (message history).


      The flow for sending messages would be:


      1 - The user's portal stores a message in an ActiveMQ queue .

      2 - A Camel route saves the message from the queue to the database. Next, the route sends the message via a component (making a TCP connection to the external device).


      I also read that it is possible to persist messages directly to database from the ActiveMQ broker but I guess is not a simple table to read (when the user consults the history) and I understand that the messages will disappear after being consumed and what I want is to have the messages permanently for a later consult .


      Any suggestion? What do you think about my initial approach?

      Or is beter to implement a develop, all in Java, from zero?


      Thanks for your help!

        • 1. Re: Mesagging System with Fuse and A-MQ
          Sebastian Brandt Newbie

          Your general approach seems reasonable to me.

          To read messages from the TCP connection you might consider using a Camel route with Camel Netty or Mina2 component in combination with a custom codec. The Camel route can make use of the Camel ActiveMQ/JMS component to write to Active-MQ. This lets you focus on the de/coding of your device-specific tcp protocol and let Netty/Mina and Camel do all the connection handling and JMS stuff.


          As for your history requirement, although ActiveMQ can use a JDBC backend as its internal message store, it's not useful as a history table. AMQ deletes the message row after having successfully delivered the message to a consumer. Instead, as you already wrote, use a Camel route and the Camel SQL component to write to your history table.


          Generally I'd say it's best practice to use Camel wherever possible and only fall back to custom Java code where needed.

          All mentioned Camel components are part of the Jboss Fuse 6 full install package.







          1 of 1 people found this helpful