4 Replies Latest reply on Jul 2, 2012 6:33 PM by vishnu_pillai

    Using HornetQ for custom messaging protocol

      Hi,

      I'm trying to use HornetQ as the messaging framework to communicate between a client and a server. Here are details of the spec:

       

      The server binds to an SSL socket and wait for accepting connections.

      Once a connection is made from a client, raw message bytes are sent from the client to the server. The server looks at the header of the message and reads the complete message and passes the message to a message processor.

      Upon completion of processing, the message processor creates a response and converts it to a byte[] and sends it back to the client.

      The connection is also persistent so multiple messages may be exchanged between client and server asynchronously.

       

      I can see documentation describing how JMS or HTTP protoclos can be handled and configured in HornetQ.

      Can somebody out there help me understand how a component (such as a message processor described above) can be configured into HornetQ for a custom message format on a persistent SSL socket? This is neither JMS nor HTTP.

       

      Please let me know if the question is unclear.

       

      Thanks,

      Vishy

        • 1. Re: Using HornetQ for custom messaging protocol
          jbertram

          Why not configure an SSL Netty acceptor, and then just use the HornetQ "core" API to send messages and receive the responses via a org.hornetq.api.core.client.ClientRequestor.  On the server-side the message processors can use filters to get the messages they want.

           

          To be clear, the underlying HornetQ message is basically just a byte[] moving over the wire.

          • 2. Re: Using HornetQ for custom messaging protocol

            Hi Justin,

             

            Thanks for the quick reply.

            We do not want to enforce usage of any specific API/framework on the client side in order to communicate with our server. Will that be possible using HornetQ core? If so, how do I configure a protocol handler into HornetQ so that the logic for reading a message from the socket is left to the application? The org.jboss.netty.handler.codec.frame.LengthFieldBasedFrameDecoder class is close to what we need. Does the HornetQ wire protocol adhere to this decoding/encoding logic?

             

            Thanks,

            Vishy

            • 3. Re: Using HornetQ for custom messaging protocol
              jbertram

              Since HornetQ is a message broker it takes care of reading the message off the wire and putting the message somewhere where the application can access it (e.g. a queue).  I believe you can extend HornetQ to support your specific protocol (much like the way STOMP support was implemented), but I don't know if you can alter it so that it passes the socket all the way down to an application.  IMO, that would be more work than it was worth and you would basically be throwing away most of what HornetQ was good for.

              • 4. Re: Using HornetQ for custom messaging protocol

                Hi Justin,

                Adding a custom protocol manager is supported to some extent in HornetQ, but that requires modification of a few core classes so it appears like end users cannot add support for new protocols. And I agree this might be in line with HornetQ's positioning as a message broker.

                 

                I've discarded the idea of using HornetQ for now and do something more simpler.

                 

                Thanks,

                Vishy