The Content Enricher tells us how we can deal with situations where our message is missing required data items. The Content Filter lets us remove uninteresting data items from a message. Sometimes, we want to remove fields only temporarily. For example, a message may contain a set of data items that may be needed later in the message flow, but that are not necessary for all intermediate processing steps. We may not want to carry all this information through each processing step because it may cause performance degradation and makes debugging harder because we carry so much extra data.
How can we reduce the data volume of message sent across the system without sacrificing information content?
Store message data in a persistent store and pass a Claim Check to subsequent components. These components can use the Claim Check to retrieve the stored information.
The Claim Check pattern consists of the following steps:
- A message with data arrives.
- The "Check Luggage" component generates a unique key for the information. This key will be used later as the Claim Check
- The Check Luggage component extracts the data from the message and stores it in a persistent store, e.g. a file or a database. It associates the stored data with the key .
- It removes the persisted data from the message and adds the Claim Check.
- Another component can use a Content Enricher to retrieve the data based on the Claim Check.
This process is analogous to a luggage check at the airport. If you do not want to carry all your luggage with you, you simply check it with the airline counter. In return you receive a sticker on your ticket that has a reference number that uniquely identifies each piece of luggage you checked. Once you reach your final destination, you can retrieve your luggage.
... Read the entire pattern in the book Enterprise Integration Patterns
Related patterns:
Content Filter, Content Enricher, Process Manager