Akka.Cluster.Sharding.Delivery: pass through options for bypassing Akka.Delivery and talking directly to entity actors #7089
-
So this was an issue raised on a support call with a customer today: if I start using Akka.Cluster.Sharding.Delivery, do I have to use it for 100% of my communication with entity actors? Or is it possible to talk to entity actors sometimes using Akka.Delivery's protocol and sometimes not? Purpose of this thread is discuss:
BackgroundWhen you start a [Fact]
public async Task ReliableDelivery_with_Sharding_must_illustrate_Sharding_usage()
{
await JoinCluster();
NextId();
var consumerEndProbe = CreateTestProbe();
var region = await ClusterSharding.Get(Sys).StartAsync($"TestConsumer-{_idCount}", _ =>
ShardingConsumerController.Create<Job>(c =>
PropsFor(DefaultConsumerDelay, 42, consumerEndProbe.Ref, c),
ShardingConsumerController.Settings.Create(Sys)), ClusterShardingSettings.Create(Sys),
HashCodeMessageExtractor.Create(10,
o => string.Empty, o => o));
var producerController =
Sys.ActorOf(
ShardingProducerController.Create<Job>(ProducerId, region, Option<Props>.None,
ShardingProducerController.Settings.Create(Sys)), $"shardingController-{_idCount}");
var producer = Sys.ActorOf(Props.Create(() => new TestShardingProducer(producerController)),
$"producer-{_idCount}");
// expecting 3 end messages, one for each entity: "entity-0", "entity-1", "entity-2"
await consumerEndProbe.ReceiveNAsync(3, TimeSpan.FromSeconds(5)).ToListAsync();
} This creates an actor hierarchy structure that looks like the following: The ProblemThe issue, in this case, is that all messages sent to the Current Work-AroundsThe current work-arounds for this issue mostly rely on using Proposed Solutions1 - "Won't Fix; Just Use Akka.Delivery"First solution to this problem is the path of least resistance: "yes, if you're using Akka.Delivery to talk to entity actors then you should just use it consistently." That's a valid suggestion, but I'm thinking there are cases where you really don't want to have to introduce the Akka.Delivery infrastructure where it hasn't been traditionally needed before just because you're using it in some places where it really is necessary. 2 - Introduce an Implicit Bypass inside the
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Resolved via #7106 |
Beta Was this translation helpful? Give feedback.
Resolved via #7106