Class InMemoryClaimCheckStore
- All Implemented Interfaces:
ClaimCheckStore
Not for production, and the reason is the point of the pattern. The payloads are held in the publisher's heap — which is where they were going to be anyway, so this removes them from the broker and nothing else. A claim check that does not outlive the process that wrote it is a message nobody else can read, and every consumer in another process gets "the claim check is not in the store".
It is genuinely useful for a test, where the publisher and consumer are the same JVM and the point being proved is the framing rather than the storage.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
InMemoryClaimCheckStore
public InMemoryClaimCheckStore()
-
-
Method Details
-
put
Description copied from interface:ClaimCheckStoreStores a payload.- Specified by:
putin interfaceClaimCheckStore- Parameters:
content- the bytes- Returns:
- the key the message will carry, which must be unique for the life of the store
-
get
Description copied from interface:ClaimCheckStoreRedeems a claim check.- Specified by:
getin interfaceClaimCheckStore- Parameters:
key- what the message carried- Returns:
- the payload, or empty when the store no longer holds it — which is retention having expired underneath a message that outlived it
-
delete
Description copied from interface:ClaimCheckStoreRemoves a payload.Not called by the codec. Deleting on read would break the second consumer of the same message, and deleting on acknowledgement would break a replay — so when a payload may be removed is a retention decision, and retention decisions belong to whoever owns the data.
- Specified by:
deletein interfaceClaimCheckStore- Parameters:
key- what to remove
-
size
public int size()- Returns:
- how many payloads are held
-
clear
public void clear()Empties the store, which is what a test between cases wants. -
toString
-