Hi Victor,
The cluster node roles feature is described in the docs
here: http://doc.akka.io/docs/akka/2.4.8/java/cluster-usage.html#node-roles
I can't see how that would cause distributed pub sub to not work in such a
way unless you also configured akka.cluster.pub-sub.role with a value.
Maybe you rather have a race condition where node 2 haven't registered its
listener, and or that it is registered has not been gossiped to node 1 yet
when you try to sen the message from it.
--
Johan
On Friday, July 22, 2016 at 12:21:30 PM UTC+2, Victor Ho wrote:
>
> The issue is resolved when I make the "roles" in cluster conf to be empty
> instead of having the same value in both Java processes (node).
>
> Before:
> cluster {
> roles = ["fitting"]
>
> After
> cluster {
> roles = []
>
> Can anyone give me some pointers on the meaning of roles and the proper
> usage in a cluster?
>
> Thanks.
>
>
> On Friday, July 22, 2016 at 5:35:16 PM UTC+8, Victor Ho wrote:
>>
>> Hi,
>>
>> I have a Akka cluster setup locally on one machine, with 2 nodes running
>> on 2 java processes participating into one cluster. The different java
>> processes (nodes) listen on different TCP ports.
>>
>> I am able to startup and see the nodes joining the cluster, however, when
>> I have the "orchestrator" node "DistributedPubSubMediator.Send" a message
>> to the "mediator" actor, the target remote actor never received the message.
>>
>> Can anyone help give some pointers on how to trouble shoot such issue?
>>
>> Attaching the akka application.conf. The highlights:
>> actor.provider = "akka.cluster.ClusterActorRefProvider"
>>
>> remote {
>> enabled-transports = ["akka.remote.netty.tcp"]
>> netty.tcp {
>> hostname = 127.0.0.1
>> port = 9095
>> }
>> }
>>
>> extensions = ["akka.cluster.pubsub.DistributedPubSub"]
>>
>> For the 2 nodes, one runs on port *9095*, and one runs on port *9080*
>>
>> From the log:
>> [INFO] [07/22/2016 13:42:40.024] [main] [akka.remote.Remoting] Starting
>> remoting
>> [INFO] [07/22/2016 13:42:40.305] [main] [akka.remote.Remoting] Remoting
>> started; listening on addresses :[akka.tcp://[email protected]:9095
>> ]
>> [INFO] [07/22/2016 13:42:40.306] [main] [akka.remote.Remoting] Remoting
>> now listens on addresses: [akka.tcp://[email protected]:9095]
>> [INFO] [07/22/2016 13:42:40.317] [main]
>> [akka.cluster.Cluster(akka://ClusterSystem)] Cluster Node [akka.tcp://
>> [email protected]:9095] - Starting up...
>> [INFO] [07/22/2016 13:42:40.390] [main]
>> [akka.cluster.Cluster(akka://ClusterSystem)] Cluster Node [akka.tcp://
>> [email protected]:9095] - Registered cluster JMX MBean
>> [akka:type=Cluster]
>> [INFO] [07/22/2016 13:42:40.390] [main]
>> [akka.cluster.Cluster(akka://ClusterSystem)] Cluster Node [akka.tcp://
>> [email protected]:9095] - Started up successfully
>> [INFO] [07/22/2016 13:42:45.442]
>> [ClusterSystem-akka.actor.default-dispatcher-15]
>> [akka.cluster.Cluster(akka://ClusterSystem)] Cluster Node [akka.tcp://
>> [email protected]:9095] - Node [akka.tcp://
>> [email protected]:9095] is JOINING, roles [fitting]
>> [INFO] [07/22/2016 13:42:46.426]
>> [ClusterSystem-akka.actor.default-dispatcher-16]
>> [akka.cluster.Cluster(akka://ClusterSystem)] Cluster Node [akka.tcp://
>> [email protected]:9095] - Leader is moving node
>> *[akka.tcp://[email protected]:9095
>> <http://[email protected]:9095>] to [Up]*
>> [INFO] [07/22/2016 13:42:49.604]
>> [ClusterSystem-akka.actor.default-dispatcher-19]
>> [akka.cluster.Cluster(akka://ClusterSystem)] Cluster Node [akka.tcp://
>> [email protected]:9095] - Node [akka.tcp://
>> [email protected]:9080] is JOINING, roles [fitting]
>> [INFO] [07/22/2016 13:42:50.420]
>> [ClusterSystem-akka.actor.default-dispatcher-14]
>> [akka.cluster.Cluster(akka://ClusterSystem)] Cluster Node [akka.tcp://
>> [email protected]:9095] - Leader is moving node
>> *[akka.tcp://[email protected]:9080
>> <http://[email protected]:9080>] to [Up]*
>>
>> Node membership in the cluster looks fine, but the message sending is not
>> successful.
>>
>> Code sending to remote actor with path "worker"
>>
>> private ActorRef mediator =
>> DistributedPubSub.get(getContext().system()).mediator();
>>
>> boolean localAffinity = true;
>> mediator.tell(new DistributedPubSubMediator.Send("/user/
>> *worker*", message, localAffinity), getSelf());
>>
>> Code worker actor telling itself to mediator
>> actorSystem.actorOf(Props.create(FittingActor.class), "worker");
>>
>> ActorRef mediator =
>> DistributedPubSub.get(getContext().system()).mediator();
>> // register to the path
>> mediator.tell(new DistributedPubSubMediator.Put(getSelf()),
>> getSelf());
>>
>>
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ:
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.