Class StatusReply$
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StatusReply$Static reference to the singleton instance of this Scala object. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionack()Java API: A general purpose message for using as an AckAck()Scala API: A general purpose message for using as an Ack<T> StatusReply<T>Java API: Create an status response with a error message describing why the request was failed or denied.<T> StatusReply<T>Java API: Create an error response with a user definedThrowable.<T> StatusReply<T>fromCallable(Callable<T> callable) Java API: Convert the result of aCallableinto aStatusReply.<T> StatusReply<T>fromCallableKeepException(Callable<T> callable) Java API: Convert the result of aCallableinto aStatusReply, keeping the original exception in case of failure.<T> StatusReply<T>fromTry(scala.util.Try<T> status) Scala API: Turn aTryinto a status reply.<T> StatusReply<T>fromTryKeepException(scala.util.Try<T> status) Scala API: Turn aTryinto a status reply, keeping the original exception.<T> StatusReply<T>success(T value) Java API: Create a successful reply containingvalue
-
Field Details
-
MODULE$
Static reference to the singleton instance of this Scala object.
-
-
Constructor Details
-
StatusReply$
public StatusReply$()
-
-
Method Details
-
Ack
Scala API: A general purpose message for using as an Ack -
ack
Java API: A general purpose message for using as an Ack -
success
Java API: Create a successful reply containingvalue -
error
Java API: Create an status response with a error message describing why the request was failed or denied. -
error
Java API: Create an error response with a user definedThrowable.Prefer the string based error response over this one when possible to avoid tightly coupled logic across actors and passing internal failure details on to callers that can not do much to handle them.
For cases where types are needed to identify errors and behave differently enumerating them with a specific set of response messages may be a better alternative to encoding them as generic exceptions.
Also note that Pekko does not contain pre-built serializers for arbitrary exceptions.
-
fromTry
Scala API: Turn aTryinto a status reply.Transforms exceptions into status reply errors containing just the exception message string. This makes it safe for use with remote actors since Pekko includes built-in serializers for text-based error messages, unlike arbitrary exception types.
See
fromTryKeepException(scala.util.Try<T>)for passing the exception along as is.- Since:
- 2.0.0
-
fromTryKeepException
Scala API: Turn aTryinto a status reply, keeping the original exception.Unlike
fromTry(scala.util.Try<T>), this preserves the full exception object. This is useful when callers need to match on exception types, but requires that serializers are configured for the exception types used when communicating with remote actors.Prefer
fromTry(scala.util.Try<T>)(string-based errors) when possible to avoid tightly coupled logic across actors and passing internal failure details on to callers that can not do much to handle them.Also note that Pekko does not contain pre-built serializers for arbitrary exceptions.
- Since:
- 2.0.0
-
fromCallable
Java API: Convert the result of aCallableinto aStatusReply.If the callable completes successfully, wraps the result in a successful reply. If it throws an exception, converts the exception message to an error reply (discarding the original exception type, making it safe for remote serialization).
This is the Java-friendly equivalent of
fromTry(scala.util.Try<T>).- Since:
- 2.0.0
-
fromCallableKeepException
Java API: Convert the result of aCallableinto aStatusReply, keeping the original exception in case of failure.Unlike
fromCallable(java.util.concurrent.Callable<T>), this preserves the full exception object. This is useful when callers need to match on exception types, but requires that serializers are configured for the exception types used when communicating with remote actors.This is the Java-friendly equivalent of
fromTryKeepException(scala.util.Try<T>).- Since:
- 2.0.0
-