The main purpose of Claim Check
is to store the message and not have to worry about its size as the message might travel though several external systems. It can also be restored after system failure.
The best example from the real world is flight luggage. During transfers, you have in hand only the receipt and get the luggage at the end.
To achieve your goal I suggest you use <enricher>
:
<int:enricher request-channel="claimCheckInChannel">
<int:header name="claimCheck" expression="payload"/>
</int:enricher>
<claim-check-in input-channel="claimCheckInChannel" message-store="messageStore"/>
With that you don't lose the original payload
and have the Claim Check id
in the headers.
Note: Claim Check stores the entire message
with headers, not only the payload
. The relevant code is from org.springframework.integration.transformer.ClaimCheckInTransformer
:
@Override
protected Object doTransform(Message<?> message) throws Exception {
Assert.notNull(message, "message must not be null");
Object payload = message.getPayload();
Assert.notNull(payload, "payload must not be null");
Message<?> storedMessage = this.messageStore.addMessage(message);
MessageBuilder<?> responseBuilder = MessageBuilder.withPayload(storedMessage.getHeaders().getId());
// headers on the 'current' message take precedence
responseBuilder.copyHeaders(message.getHeaders());
return responseBuilder.build();
}