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

Claimcheck Pattern using Spring Integration and Gemfire

12.21.2012
| 5657 views |
  • submit to reddit

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 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.)