Class ShardingEnvelope<M>

  • All Implemented Interfaces:
    WrappedMessage, ClusterShardingTypedSerializable, java.io.Serializable, scala.Equals, scala.Product

    public final class ShardingEnvelope<M>
    extends java.lang.Object
    implements WrappedMessage, ClusterShardingTypedSerializable, scala.Product, java.io.Serializable
    Default envelope type that may be used with Cluster Sharding.

    Cluster Sharding provides a default HashCodeMessageExtractor that is able to handle these types of messages, by hashing the entityId into into the shardId. It is not the only, but a convenient way to send envelope-wrapped messages via cluster sharding.

    The alternative way of routing messages through sharding is to not use envelopes, and have the message types themselves carry identifiers.

    param: entityId The business domain identifier of the entity. param: message The message to be send to the entity.

    See Also:
    Serialized Form
    • Constructor Detail

      • ShardingEnvelope

        public ShardingEnvelope​(java.lang.String entityId,
                                M message)
    • Method Detail

      • apply

        public static <M> ShardingEnvelope<M> apply​(java.lang.String entityId,
                                                    M message)
      • unapply

        public static <M> scala.Option<scala.Tuple2<java.lang.String,​M>> unapply​(ShardingEnvelope<M> x$0)
      • entityId

        public java.lang.String entityId()
      • copy

        public <M> ShardingEnvelope<M> copy​(java.lang.String entityId,
                                            M message)
      • copy$default$1

        public <M> java.lang.String copy$default$1()
      • copy$default$2

        public <M> M copy$default$2()
      • productPrefix

        public java.lang.String productPrefix()
        Specified by:
        productPrefix in interface scala.Product
      • productArity

        public int productArity()
        Specified by:
        productArity in interface scala.Product
      • productElement

        public java.lang.Object productElement​(int x$1)
        Specified by:
        productElement in interface scala.Product
      • productIterator

        public scala.collection.Iterator<java.lang.Object> productIterator()
        Specified by:
        productIterator in interface scala.Product
      • canEqual

        public boolean canEqual​(java.lang.Object x$1)
        Specified by:
        canEqual in interface scala.Equals
      • productElementName

        public java.lang.String productElementName​(int x$1)
        Specified by:
        productElementName in interface scala.Product
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object x$1)
        Specified by:
        equals in interface scala.Equals
        Overrides:
        equals in class java.lang.Object