3 Replies Latest reply on Oct 28, 2014 9:36 AM by jbertram

    Custom Services Framework?

    padams-wildfly

      I need to write a service in Wildfly that spawns a thread to listen for and handle inbound messages from RabbitMQ. What's the best way to write the service code? In other words is there a services framework where I can implement an interface for a start() and stop() methods that is automatically called when I deploy and undeploy an EAR file? Also how is this packaged and deploy? Feel free to point me at the relevant documentation.

       

      For reference, I'm using Wildfly 8.1 and Java 8.

       

      Also, since RabbitMQ is a messaging server, this would naturally fit beautifully into a standard message driven bean, but RabbitMQ is an AMQP server and does not support JMS. I am aware of the Spring AMQP template, but we're (intentionally) not using Spring.

       

      Cheers!

      Patrick

        • 1. Re: Custom Services Framework?
          jbertram

          This sounds like a perfect use-case for a JCA resource adapter.

           

          BTW, message driven beans in Java EE are not tied to JMS.  They are a general purpose solution for inbound "messages" of any kind.  Just wire up the MDB to your JCA RA and you can consume messages from RabbitMQ.

          • 2. Re: Custom Services Framework?
            padams-wildfly

            Do you have an example? And can you point me at the relevant documentation? I'm having trouble finding in-depth documentation for things like this.

             

            If this doesn't work, is there a generic services framework?

            • 3. Re: Custom Services Framework?
              jbertram

              You can find examples here, here, and here although those are all related to JMS.  However, I think any of them could be adapted to use AMQP client code.

               

              As for documentation, check out the JCA specification from the Oracle website.