Class ClaimSegment

All Implemented Interfaces:
JsonType

public class ClaimSegment extends Read
A request to claim a message segment for consumption in client-controlled tracking mode.

This is a specialization of Read that registers the tracker and reserves a segment range for local message consumption. It does not fetch messages (maxSize = 0). Instead, it enables the client to handle message delivery independently, for example:

Typical usage

This is used when:
  • The tracker wants to fetch messages from a client-side message cache
  • The tracker wants to fetch messages manually from a MessageStore or other source
  • The tracker handles external messages (e.g. updates from an external API) and wants to filter those based on its assigned segment range

External source integration

In distributed systems where multiple application instances are polling external sources, using ClaimSegment allows each instance to claim a distinct range of segments. This enables segment-based filtering of externally received updates, preventing duplicate processing across instances and offering a load-balanced coordination mechanism.

This approach helps replicate Flux’s load balancing capabilities for external streams, even when the external system does not support multithreaded tracking natively.

See Also:
  • Constructor Details

    • ClaimSegment

      @ConstructorProperties({"messageType","consumer","trackerId","maxTimeout","clientControlledIndex","typeFilter","filterMessageTarget","lastIndex","purgeTimeout"}) public ClaimSegment(MessageType messageType, String consumer, String trackerId, long maxTimeout, boolean clientControlledIndex, String typeFilter, boolean filterMessageTarget, Long lastIndex, Long purgeTimeout)
    • ClaimSegment

      public ClaimSegment(Read read)