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
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.
On the publisher side, the JDBC listener is configured in the Spring Integration as below,
<int-jdbc:inbound-channel-adapter 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" /> </int-jdbc:inbound-channel-adapter>
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.