Tuesday, February 4, 2014

Messaging Setup using spring on wildfly and hornetq

WildFly 8 is almost final and I bet some people are wanting to upgrade from JBoss. That is our case here at my job and our new setup is like this:

We have App 1 (spring-integration app) running on wildfly 1 and App 2 (spring server app) running on wildfly 2. Both wildfly are standalone instances.

App 2 publishes messages to its wildfly embedded hornetq broker.
App 1 listens to messages published on the hornetq at wildfly 2 using a durable subscription and the remote connection defined in wildfly 1.

First lets look at App 2.

  • application-2-context.xml is the snippet of a spring application-context that configures a JmsTemplate to send messages to the hornetq topic.
  • Standalone2.xml is the messaging-subsystem part of the wildfly 2 server configuration file:

I added a JMS Topic, disabled security for connections to the embedded hornetq broker and allow Gests to create durable queues. See the inline comments.

Now lets look at App 1.
In node 1, the wildfly server configuration file is partially displayed here in two separate files:

  • socket-binding@standalone1.xml shows the socket binding part of the wildfly configuration and the definition of the socket used to connect to the hornetq broker in Node 2.
  • messaging@standalone1.xml shows the messaging subsystem - defines the netty connector "netty-node2" and the pooled connection factory that facilitates the durable subscriptions to the EventsTopic on Node 2 - note the client-id definition.
  • application-1-context.xml is the snippet of a spring-integration application-context that configures the necessary beans to direct the messages published to EventsTopic ti a specific message channel.

No comments:

Post a Comment