Class MessageBatch<T>
java.lang.Object
io.helidon.messaging.MessageBatch<T>
- Type Parameters:
T- payload type
Immutable ordered delivery batch.
Every messaging delivery is a batch. Single-message APIs create a singleton batch at their boundary, while the runtime, routes, processors, failure policies, and connectors retain the batch abstraction. A batch is a delivery and performance boundary, not a transaction.
Framework-derived batches preserve the opaque delivery identity and stable item lineage. This lets retry and dead-letter outcomes be mapped without relying on message-envelope object identity.
- See Also:
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> MessageBatchConfig.Builder<T> builder()Create a batch builder.static <T> MessageBatch<T> Create an immutable singleton batch.static <T> MessageBatch<T> Create an immutable batch by copying the supplied message list.<R> MessageBatch<R> Internal generated-code operation that creates a one-to-one transformed batch while preserving delivery identity and item lineage.get(int index) Message at an index.id()Opaque delivery correlation ID shared by framework-derived batches.iterator()messages()Ordered immutable message snapshot.payloads()Ordered immutable payload snapshot, materialized lazily.intsize()Number of messages.Create an ordered retry or routing subset while preserving delivery identity and item lineage.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Iterable
forEach, spliterator
-
Field Details
-
MAX_ID_LENGTH
public static final int MAX_ID_LENGTHMaximum opaque identity length.- See Also:
-
-
Method Details
-
create
Create an immutable batch by copying the supplied message list.- Type Parameters:
T- payload type- Parameters:
messages- ordered, non-empty messages- Returns:
- immutable batch
-
create
Create an immutable singleton batch.- Type Parameters:
T- payload type- Parameters:
message- message- Returns:
- singleton batch
-
builder
Create a batch builder.- Type Parameters:
T- payload type- Returns:
- builder for batch construction options
-
id
Opaque delivery correlation ID shared by framework-derived batches.ID equality alone does not establish common delivery lineage.
- Returns:
- stable, non-blank identity no longer than
MAX_ID_LENGTH
-
messages
-
payloads
Ordered immutable payload snapshot, materialized lazily.Concurrent initial callers may each read the message entities. The first successfully published snapshot is retained, and every successful caller returns that same snapshot. A failed materialization is not retained.
- Returns:
- payloads
- Throws:
MessagingException- if any message cannot expose its payloadNullPointerException- if any message returns a null payload
-
size
public int size()Number of messages.- Returns:
- message count
-
get
-
subset
Create an ordered retry or routing subset while preserving delivery identity and item lineage.- Parameters:
indexes- strictly increasing local indexes- Returns:
- derived subset
-
derive
Internal generated-code operation that creates a one-to-one transformed batch while preserving delivery identity and item lineage.- Type Parameters:
R- derived payload type- Parameters:
derivedMessages- one derived message for every current item- Returns:
- derived batch
-
iterator
-