Class MessageAccumulator
-
- All Implemented Interfaces:
public final class MessageAccumulatorAn accumulator that constructs a Message from a sequence of streamed events. Pass all events from the
message_startevent to themessage_stopevent to accumulate and then call message to get the final accumulated message. The final Message will be similar to what would have been received had the non-streaming API been used.A MessageAccumulator may only be used to accumulate one message. To accumulate another message, create another instance of MessageAccumulator.
-
-
Method Summary
Modifier and Type Method Description final Messagemessage()Gets the final accumulated message. final RawMessageStreamEventaccumulate(RawMessageStreamEvent event)Accumulates a streamed event and uses it to construct a Message. final static MessageAccumulatorcreate()-
-
Method Detail
-
message
final Message message()
Gets the final accumulated message. Until the
message_stopevent has been received, a message will not be available. Wait until all events have been handled by accumulate before calling this method.
-
accumulate
final RawMessageStreamEvent accumulate(RawMessageStreamEvent event)
Accumulates a streamed event and uses it to construct a Message. When all events, including the
message_stopevent, have been accumulated, the message can be retrieved by calling message.- Returns:
The given event for convenience, such as when chaining method calls.
-
create
final static MessageAccumulator create()
-
-
-
-