Over a million developers have joined DZone.

Pub/Sub Using vFabric, Spring Integration, and Gemfire

DZone's Guide to

Pub/Sub Using vFabric, Spring Integration, and Gemfire

· Integration Zone ·
Free Resource

SnapLogic is the leading self-service enterprise-grade integration platform. Download the 2018 GartnerMagic Quadrant for Enterprise iPaaS or play around on the platform, risk free, for 30 days.

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.

Download A Buyer's Guide to Application and Data Integration, your one-stop-shop for research, checklists, and explanations for an application and data integration solution.


Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}