Enterprise Integration Zone is brought to you in partnership with:

Enterprise Architect in HCL Technologies a $7Billion IT services organization. My role is to work as a Technology Partner for large enterprise customers providing them low cost opensource solutions around Java, Spring and vFabric stack. I am also working on various projects involving, Cloud base solution, Mobile application and Business Analytics around Spring and vFabric space. Over 23 yrs, I have build repository of technologies and tools I liked and used extensively in my day to day work. In this blog, I am putting all these best practices and tools so that it will help the people who visit my website. Krishna is a DZone MVB and is not an employee of DZone and has posted 64 posts at DZone. You can read more from them at their website. View Full User Profile

Pub/Sub Using vFabric, Spring Integration, and Gemfire

  • submit to reddit
As part of vFabric you get SpringSource Tool Suite (STS), vFabric tc Server, Spring AMQP to incorporate vFabric RabbitMQ messaging, and Spring Data project that simplifies access to vFabric GemFire, SQLFire and Postgres.

In the next few blogs, I will be discussing how each pieces tie in together. In this blog I will be demonstrating how Spring Integration and vFabric Gemfire participate in a typical Publisher/ Subscriber EIP pattern, where in data is picked from source system and delivered to 1 or many target systems.

For people who are in hurry, here is the code and the steps to execute.

Details: Publisher, Subscriber using vFabric Spring Integration, Gemfire

This demo is the continuation of my earlier blog on Claimcheck pattern. I will implement an end to end flow as below

Publisher Subscriber ESB using Spring Integration, Gemfire and ActiveMQ

Publisher Subscriber ESB using Spring Integration, Gemfire and ActiveMQ

For Demo purpose, on the publisher side, the message that comes in from claimcheck output is directly bridged to the jms outbound channel adapter. But in an enterprise application, in reality there can be a spring integration flow which can do an entire workflow/ transformation/ mapping, before it puts the message onto the Topic.

Again for demo purpose, on the subscriber side, I just directly took the payload output from claimcheck and passed to a console based service activator. But in an enterprise application, it can be sending this to a target system.

The technology stack I used for this is, hsqldb database, ActiveMQ JMS along with vFabric TC Server and vFabric Gemfire.

On the publisher side, the JDBC listener is configured in the Spring Integration as below,

query="select * from notification where status=2" channel="jdbc.inbound"
data-source="dataSource" update="update notification set status=10 where id in (:id)">
<int:poller fixed-rate="1000" />

and you bridge this to the claimcheck channel as below,

<!-- for convenience sake we are bridging the jdbc to directly claimcheck in reality we will be going thru a SI flow
<int:bridge input-channel="jdbc.inbound"
output-channel="common.claimcheck.in.inputChannel" />

<!-- Bridge the claimcheck output directly to JMS -->
<int:bridge input-channel="common.claimcheck.in.outputChannel"
output-channel="jms-channel.out" />

On the subscriber side, the payload is pushed to the vFabric Gemfire and a GUID is created on the vFabric Gemfire side and it is pushed to the Topic. The Subscriber component picks up the payload and prints to the console. This blog explains this more in detail.


vFabric infrastructure provides a good support for developing Integration components by the way of STS IDE, vFabric TC Server, vFabric Gemfire. I have clearly demonstrated how you can build a Publisher/subscriber components which can integrate a source system to target system.

I hope this blog helped you.

Published at DZone with permission of Krishna Prasad, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)