Packages

class ReplicatorMessageAdapter[A, B <: ReplicatedData] extends AnyRef

When interacting with the Replicator from an actor this class provides convenient methods that adapts the response messages to the requesting actor's message protocol.

One ReplicatorMessageAdapter instance can be used for a given ReplicatedData type, e.g. an OrSet[String]. Interaction with several Keys can be used via the same adapter but they must all be of the same ReplicatedData type. For interaction with several different ReplicatedData types, e.g. an OrSet[String] and a GCounter, an adapter can be created for each type.

For the default replicator in the DistributedData extension a ReplicatorMessageAdapter can be created with DistributedData.withReplicatorMessageAdapter.

*Warning*: ReplicatorMessageAdapter is not thread-safe and must only be used from the actor corresponding to the given ActorContext. It must not be accessed from threads other than the ordinary actor message processing thread, such as scala.concurrent.Future callbacks. It must not be shared between several actor instances.

A

Message type of the requesting actor.

B

Type of the ReplicatedData.

Source
ReplicatorMessageAdapter.scala
Linear Supertypes
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ReplicatorMessageAdapter
  2. AnyRef
  3. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new ReplicatorMessageAdapter(context: ActorContext[A], replicator: ActorRef[Command], unexpectedAskTimeout: FiniteDuration)

    context

    The ActorContext of the requesting actor. The ReplicatorMessageAdapter can only be used in this actor.

    replicator

    The replicator to interact with, typically DistributedData(system).replicator.

    unexpectedAskTimeout

    The timeout to use for ask operations. This should be longer than the timeout given in Replicator.WriteConsistency and Replicator.ReadConsistency. The replicator will always send a reply within those timeouts so the unexpectedAskTimeout should not occur, but for cleanup in a failure situation it must still exist. If askUpdate, askGet or askDelete takes longer then this unexpectedAskTimeout a java.util.concurrent.TimeoutException will be thrown by the requesting actor and may be handled by supervision.

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. def +(other: String): String
    Implicit
    This member is added by an implicit conversion from ReplicatorMessageAdapter[A, B] toany2stringadd[ReplicatorMessageAdapter[A, B]] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ->[B](y: B): (ReplicatorMessageAdapter[A, B], B)
    Implicit
    This member is added by an implicit conversion from ReplicatorMessageAdapter[A, B] toArrowAssoc[ReplicatorMessageAdapter[A, B]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  5. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. def askDelete(createRequest: (ActorRef[DeleteResponse[B]]) => Delete[B], responseAdapter: (DeleteResponse[B]) => A): Unit

    Send a Replicator.Delete request to the replicator.

    Send a Replicator.Delete request to the replicator. The Replicator.DeleteResponse message is transformed to the message protocol of the requesting actor with the given responseAdapter function.

    Note that createRequest is a function that creates the Delete message from the provided ActorRef[DeleteResponse] that the the replicator will send the response message back through. Use that ActorRef[DeleteResponse] as the replyTo parameter in the Delete message.

  8. def askGet(createRequest: (ActorRef[GetResponse[B]]) => Get[B], responseAdapter: (GetResponse[B]) => A): Unit

    Send a Replicator.Get request to the replicator.

    Send a Replicator.Get request to the replicator. The Replicator.GetResponse message is transformed to the message protocol of the requesting actor with the given responseAdapter function.

    Note that createRequest is a function that creates the Get message from the provided ActorRef[GetResponse] that the the replicator will send the response message back through. Use that ActorRef[GetResponse] as the replyTo parameter in the Get message.

  9. def askReplicaCount(createRequest: (ActorRef[ReplicaCount]) => GetReplicaCount, responseAdapter: (ReplicaCount) => A): Unit

    Send a Replicator.GetReplicaCount request to the replicator.

    Send a Replicator.GetReplicaCount request to the replicator. The Replicator.ReplicaCount message is transformed to the message protocol of the requesting actor with the given responseAdapter function.

    Note that createRequest is a function that creates the GetReplicaCount message from the provided ActorRef[ReplicaCount] that the the replicator will send the response message back through. Use that ActorRef[ReplicaCount] as the replyTo parameter in the GetReplicaCount message.

  10. def askUpdate(createRequest: (ActorRef[UpdateResponse[B]]) => Update[B], responseAdapter: (UpdateResponse[B]) => A): Unit

    Send a Replicator.Update request to the replicator.

    Send a Replicator.Update request to the replicator. The Replicator.UpdateResponse message is transformed to the message protocol of the requesting actor with the given responseAdapter function.

    Note that createRequest is a function that creates the Update message from the provided ActorRef[UpdateResponse] that the the replicator will send the response message back through. Use that ActorRef[UpdateResponse] as the replyTo parameter in the Update message.

  11. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @HotSpotIntrinsicCandidate() @native()
  12. def ensuring(cond: (ReplicatorMessageAdapter[A, B]) => Boolean, msg: => Any): ReplicatorMessageAdapter[A, B]
    Implicit
    This member is added by an implicit conversion from ReplicatorMessageAdapter[A, B] toEnsuring[ReplicatorMessageAdapter[A, B]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  13. def ensuring(cond: (ReplicatorMessageAdapter[A, B]) => Boolean): ReplicatorMessageAdapter[A, B]
    Implicit
    This member is added by an implicit conversion from ReplicatorMessageAdapter[A, B] toEnsuring[ReplicatorMessageAdapter[A, B]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  14. def ensuring(cond: Boolean, msg: => Any): ReplicatorMessageAdapter[A, B]
    Implicit
    This member is added by an implicit conversion from ReplicatorMessageAdapter[A, B] toEnsuring[ReplicatorMessageAdapter[A, B]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  15. def ensuring(cond: Boolean): ReplicatorMessageAdapter[A, B]
    Implicit
    This member is added by an implicit conversion from ReplicatorMessageAdapter[A, B] toEnsuring[ReplicatorMessageAdapter[A, B]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  16. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  17. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  18. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  19. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  20. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  21. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  22. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  23. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  24. def subscribe(key: Key[B], responseAdapter: (SubscribeResponse[B]) => A): Unit

    Subscribe to changes of the given key.

    Subscribe to changes of the given key. The Replicator.Changed, Replicator.Deleted and Replicator.Expired messages from the replicator are transformed to the message protocol of the requesting actor with the given responseAdapter function.

  25. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  26. def toString(): String
    Definition Classes
    AnyRef → Any
  27. def unsubscribe(key: Key[B]): Unit

    Unsubscribe from a previous subscription of a given key.

    Unsubscribe from a previous subscription of a given key.

    See also

    ReplicatorMessageAdapter.subscribe

  28. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  29. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  30. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

    (Since version 9)

  2. def formatted(fmtstr: String): String
    Implicit
    This member is added by an implicit conversion from ReplicatorMessageAdapter[A, B] toStringFormat[ReplicatorMessageAdapter[A, B]] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @deprecated @inline()
    Deprecated

    (Since version 2.12.16) Use formatString.format(value) instead of value.formatted(formatString), or use the f"" string interpolator. In Java 15 and later, formatted resolves to the new method in String which has reversed parameters.

  3. def [B](y: B): (ReplicatorMessageAdapter[A, B], B)
    Implicit
    This member is added by an implicit conversion from ReplicatorMessageAdapter[A, B] toArrowAssoc[ReplicatorMessageAdapter[A, B]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @deprecated
    Deprecated

    (Since version 2.13.0) Use -> instead. If you still wish to display it as one character, consider using a font with programming ligatures such as Fira Code.

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd fromReplicatorMessageAdapter[A, B] to any2stringadd[ReplicatorMessageAdapter[A, B]]

Inherited by implicit conversion StringFormat fromReplicatorMessageAdapter[A, B] to StringFormat[ReplicatorMessageAdapter[A, B]]

Inherited by implicit conversion Ensuring fromReplicatorMessageAdapter[A, B] to Ensuring[ReplicatorMessageAdapter[A, B]]

Inherited by implicit conversion ArrowAssoc fromReplicatorMessageAdapter[A, B] to ArrowAssoc[ReplicatorMessageAdapter[A, B]]

Ungrouped