From eb3a25d7aa21ff1b2451684cdc5342c61555d289 Mon Sep 17 00:00:00 2001 From: Patrik Nordwall Date: Thu, 9 Nov 2023 16:36:40 +0100 Subject: [PATCH] chore: More detailed error message for invalid replica config (#1067) --- .../grpc/replication/internal/ReplicationImpl.scala | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/akka-projection-grpc/src/main/scala/akka/projection/grpc/replication/internal/ReplicationImpl.scala b/akka-projection-grpc/src/main/scala/akka/projection/grpc/replication/internal/ReplicationImpl.scala index 7ff123045..d6f855ec5 100644 --- a/akka-projection-grpc/src/main/scala/akka/projection/grpc/replication/internal/ReplicationImpl.scala +++ b/akka-projection-grpc/src/main/scala/akka/projection/grpc/replication/internal/ReplicationImpl.scala @@ -173,7 +173,11 @@ private[akka] object ReplicationImpl { envelope.eventMetadata match { case Some(replicatedEventMetadata: ReplicatedEventMetadata) => // skipping events originating from other replicas is handled by filtering but for good measure - require(replicatedEventMetadata.originReplica == remoteReplica.replicaId) + if (replicatedEventMetadata.originReplica != remoteReplica.replicaId) + throw new IllegalArgumentException( + "Expected replicated event from replica " + + s"[${remoteReplica.replicaId}] but was [${replicatedEventMetadata.originReplica}]. " + + "Verify your replication configuration, such as self-replica-id.") val replicationId = ReplicationId.fromString(envelope.persistenceId) val destinationReplicaId = replicationId.withReplica(settings.selfReplicaId)