final class KafkaClusterSharding extends Extension
API MAY CHANGE
Apache Pekko Extension to enable Apache Pekko Cluster External Sharding with Apache Pekko Connector Kafka.
- Annotations
- @ApiMayChange()
- Source
- KafkaClusterSharding.scala
- Alphabetic
- By Inheritance
- KafkaClusterSharding
- Extension
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new KafkaClusterSharding(system: ExtendedActorSystem)
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def messageExtractor[M](kafkaPartitions: Int): KafkaShardingMessageExtractor[M]
API MAY CHANGE
API MAY CHANGE
Asynchronously return a pekko.cluster.sharding.typed.ShardingMessageExtractor with a default hashing strategy based on Apache Kafka's org.apache.kafka.clients.producer.internals.DefaultPartitioner.
The number of partitions to use with the hashing strategy is provided explicitly with kafkaPartitions.
All topics used in a Consumer pekko.kafka.Subscription must contain the same number of partitions to ensure that entities are routed to the same Entity type.
- Annotations
- @ApiMayChange()
- def messageExtractor[M](topic: String, timeout: Duration, settings: ConsumerSettings[_, _]): CompletionStage[KafkaShardingMessageExtractor[M]]
Java API
Java API
API MAY CHANGE
Asynchronously return a pekko.cluster.sharding.typed.ShardingMessageExtractor with a default hashing strategy based on Apache Kafka's org.apache.kafka.clients.producer.internals.DefaultPartitioner.
The number of partitions to use with the hashing strategy will be automatically determined by querying the Kafka cluster for the number of partitions of a user provided topic. Use the settings parameter to configure the Kafka Consumer connection required to retrieve the number of partitions. Each call to this method will result in a round trip to Kafka. This method should only be called once per entity type M, per local actor system.
All topics used in a Consumer pekko.kafka.Subscription must contain the same number of partitions to ensure that entities are routed to the same Entity type.
- Annotations
- @ApiMayChange()
- def messageExtractor[M](topic: String, timeout: FiniteDuration, settings: ConsumerSettings[_, _]): Future[KafkaShardingMessageExtractor[M]]
API MAY CHANGE
API MAY CHANGE
Asynchronously return a pekko.cluster.sharding.typed.ShardingMessageExtractor with a default hashing strategy based on Apache Kafka's org.apache.kafka.clients.producer.internals.DefaultPartitioner.
The number of partitions to use with the hashing strategy will be automatically determined by querying the Kafka cluster for the number of partitions of a user provided topic. Use the settings parameter to configure the Kafka Consumer connection required to retrieve the number of partitions. Each call to this method will result in a round trip to Kafka. This method should only be called once per entity type M, per local actor system.
All topics used in a Consumer pekko.kafka.Subscription must contain the same number of partitions to ensure that entities are routed to the same Entity type.
- Annotations
- @ApiMayChange()
- def messageExtractorNoEnvelope[M](kafkaPartitions: Int, entityIdExtractor: Function[M, String]): KafkaShardingNoEnvelopeExtractor[M]
API MAY CHANGE
API MAY CHANGE
Asynchronously return a pekko.cluster.sharding.typed.ShardingMessageExtractor with a default hashing strategy based on Apache Kafka's org.apache.kafka.clients.producer.internals.DefaultPartitioner.
The number of partitions to use with the hashing strategy is provided explicitly with kafkaPartitions.
All topics used in a Consumer pekko.kafka.Subscription must contain the same number of partitions to ensure that entities are routed to the same Entity type.
- Annotations
- @ApiMayChange()
- def messageExtractorNoEnvelope[M](kafkaPartitions: Int, entityIdExtractor: (M) => String): KafkaShardingNoEnvelopeExtractor[M]
API MAY CHANGE
API MAY CHANGE
Asynchronously return a pekko.cluster.sharding.typed.ShardingMessageExtractor with a default hashing strategy based on Apache Kafka's org.apache.kafka.clients.producer.internals.DefaultPartitioner.
The number of partitions to use with the hashing strategy is provided explicitly with kafkaPartitions.
All topics used in a Consumer pekko.kafka.Subscription must contain the same number of partitions to ensure that entities are routed to the same Entity type.
- Annotations
- @ApiMayChange()
- def messageExtractorNoEnvelope[M](topic: String, timeout: Duration, entityIdExtractor: Function[M, String], settings: ConsumerSettings[_, _]): CompletionStage[KafkaShardingNoEnvelopeExtractor[M]]
Java API
Java API
API MAY CHANGE
Asynchronously return a pekko.cluster.sharding.typed.ShardingMessageExtractor with a default hashing strategy based on Apache Kafka's org.apache.kafka.clients.producer.internals.DefaultPartitioner.
The number of partitions to use with the hashing strategy will be automatically determined by querying the Kafka cluster for the number of partitions of a user provided topic. Use the settings parameter to configure the Kafka Consumer connection required to retrieve the number of partitions. Use the entityIdExtractor to pick a field from the Entity to use as the entity id for the hashing strategy. Each call to this method will result in a round trip to Kafka. This method should only be called once per entity type M, per local actor system.
All topics used in a Consumer pekko.kafka.Subscription must contain the same number of partitions to ensure that entities are routed to the same Entity type.
- Annotations
- @ApiMayChange()
- def messageExtractorNoEnvelope[M](topic: String, timeout: FiniteDuration, entityIdExtractor: (M) => String, settings: ConsumerSettings[_, _]): Future[KafkaShardingNoEnvelopeExtractor[M]]
API MAY CHANGE
API MAY CHANGE
Asynchronously return a pekko.cluster.sharding.typed.ShardingMessageExtractor with a default hashing strategy based on Apache Kafka's org.apache.kafka.clients.producer.internals.DefaultPartitioner.
The number of partitions to use with the hashing strategy will be automatically determined by querying the Kafka cluster for the number of partitions of a user provided topic. Use the settings parameter to configure the Kafka Consumer connection required to retrieve the number of partitions. Use the entityIdExtractor to pick a field from the Entity to use as the entity id for the hashing strategy. Each call to this method will result in a round trip to Kafka. This method should only be called once per entity type M, per local actor system.
All topics used in a Consumer pekko.kafka.Subscription must contain the same number of partitions to ensure that entities are routed to the same Entity type.
- Annotations
- @ApiMayChange()
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def rebalanceListener(typeKey: EntityTypeKey[_]): ActorRef[ConsumerRebalanceEvent]
Java API
Java API
API MAY CHANGE
Create an Apache Pekko Connector Kafka rebalance listener that handles TopicPartitionsAssigned events. The typeKey is used to create the ExternalShardAllocation client. When partitions are assigned to this consumer group member the rebalance listener will use the ExternalShardAllocation client to update the External Sharding strategy accordingly so that entities are (eventually) routed to the local Apache Pekko cluster member.
Returns an Apache Pekko typed pekko.actor.typed.ActorRef. This must be converted to a classic actor before it can be passed to an Apache Pekko Connector Kafka ConsumerSettings.
import org.apache.pekko import pekko.actor.typed.scaladsl.adapter._ val listenerClassicActorRef: pekko.actor.ActorRef = listenerTypedActorRef.toClassic
- Annotations
- @ApiMayChange()
- def rebalanceListener(typeKey: EntityTypeKey[_]): ActorRef[ConsumerRebalanceEvent]
API MAY CHANGE
API MAY CHANGE
Create an Apache Pekko Connector Kafka rebalance listener that handles TopicPartitionsAssigned events. The typeKey is used to create the ExternalShardAllocation client. When partitions are assigned to this consumer group member the rebalance listener will use the ExternalShardAllocation client to update the External Sharding strategy accordingly so that entities are (eventually) routed to the local Apache Pekko cluster member.
Returns an Apache Pekko typed pekko.actor.typed.ActorRef. This must be converted to a classic actor before it can be passed to an Apache Pekko Connector Kafka ConsumerSettings.
import org.apache.pekko import pekko.actor.typed.scaladsl.adapter._ val listenerClassicActorRef: pekko.actor.ActorRef = listenerTypedActorRef.toClassic
- Annotations
- @ApiMayChange()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()