Platinum Partner
java,soa,enterprise-integration,architecture,tutorial,patterns,esb,gemfire

Claimcheck Pattern using Spring Integration and Gemfire

Introduction

For people who are in a hurry, here is the code and the steps to execute. Please also refer to my blog on Publisher/Subscriber using Spring Integration and Gemfire as the ESB.

In a Enterprise Service Bus (ESB) architecture, the “Service Bus” will become a bottleneck over a period of time. In a typical ESB you write to the Bus and lots of subscribers read from the bus. Gemfire can help an ESB to achieve distributed caching by virtue of being a powerful in-memory distributed caching backbone. The Claimcheck pattern is an Enterprise Integration Pattern wherein a Publisher component can publish a large payload into a Gemfire cache, then a GUID key is generated for this payload and placed on the Topic. A subscriber in the Claimcheck pattern will be listening to the Topic for this key and get the payload from Gemfire. The Dataflow diagram is as follows,

Spring Integration Gemfire Claimcheck Pattern

Spring Integration Gemfire Claimcheck Pattern

Claimcheck Pattern using Spring Integration and Gemfire

There are lot of good examples from David Turanski in Github to learn Spring Integration with Gemfire. In this prototype, I built a simple replicated region based server based on the idea from basic\replicated-cs example from David’s examples. In order to run this prototype, download and install Activemq and start ActiveMq and create a Topic called “MyTopic”. After that, run the Gemfire Replicated Server as below.

cd gemfire-server
mvn package
mvn exec:java -Dexec.mainClass="org.springframework.data.gemfire.examples.Server"

Now Maven import the claimcheck-subscriber project into STS IDE and start the tomcat instance by clicking “Run on Server” this project. The subscriber will start listening to the messages/GUID in the topic “MyTopic”

Finally publish the XML payload on to the Gemfire cache by executing below command,

cd claimcheck-publisher
mvn test

In the Tomcat server console you will see below message

[Headers={timestamp=1348935448580, id=77480754-a4d8-4bc4-a529-26c9e26a7724, jms_timestamp=1348935447237, jms_redelivered=false, jms_messageId=ID:krishna-PC-62975-1348935446968-1:1:1:1:1}]
29 Sep 2012 12:17:28,702[topicContainer-1] DEBUG: com.goSmarter.gemfire.claimcheckpattern.ServiceActivator - ### PAYLOAD ###<!--?xml version="1.0" encoding="UTF-8"?-->

goSmarter

Conclusion

In this demo, I have demonstrated the claimcheck pattern. In an enterprise ecosystem, this is a basic component of claimcheck pattern. The enhancements on top of this includes various other things including,

  • each subscribers doing partial checkout of payloads from Gemfire.
  • it also need to have a way to work in a cluster environment.
  • Implementing distribution caching

I hope this example helped you.




Published at DZone with permission of {{ articles[0].authors[0].realName }}, DZone MVB. (source)

Opinions expressed by DZone contributors are their own.

{{ tag }}, {{tag}},

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

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks
Tweet

{{parent.nComments}}