Package akka.javasdk
Interface OriginAwareContext
- All Superinterfaces:
Context
- All Known Subinterfaces:
MessageContext
,UpdateContext
-
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
Returnstrue
if this message originated in the same region where it is currently being processed.When available, this method returns the region where a message was first created.Methods inherited from interface akka.javasdk.Context
selfRegion
-
Method Details
-
originRegion
When available, this method returns the region where a message was first created.- It returns a non-empty Optional when consuming events from an
EventSourcedEntity
or a change updates from aKeyValueEntity
- It returns an empty Optional when consuming messages from a topic (see
Consume.FromTopic
) or from another service (seeConsume.FromServiceStream
)
- Returns:
- the region where a message was first created. When not applicable, it returns an empty Optional.
- It returns a non-empty Optional when consuming events from an
-
hasLocalOrigin
default boolean hasLocalOrigin()Returnstrue
if this message originated in the same region where it is currently being processed. A message is considered to have originated in a region if it was created in that region. In all other regions, the same message is treated as a replication.For messages coming from Akka entities:
- If the message is an event from an
EventSourcedEntity
or a change update from aKeyValueEntity
, it returnstrue
if it was originated in the region where this consumer is running. Otherwise, it returnsfalse
. - This method will always return
false
when consuming messages from another service (seeConsume.FromServiceStream
) or from a topic (seeConsume.FromTopic
).
- Returns:
true
if the message originated in the current processing region,false
otherwise
- If the message is an event from an
-