[akka-user] at least once 'destination' to a distributed actor

2015-11-23 Thread sd d
Hello,

If i am not wrong, the UntypedPersistentActorWithAtLeastOnceDelivery 'delivery' 
operation will only with ActorSelection or ActorPath and both requires fairly 
full path of the destination actor 
(akka.tcp://ClusterSystem@127.0.0.1:2550/user/subscriber1"). In our project we 
use clustered actors and these actors use DistributedPubSubMediator.Send and 
Put combination to send/receive messages for point to point communication.


We need to provide client side persistence and for this work do i need to 
introduce any arbitrary Publisher between the PersistentSender and the 
clustered Destination.


Example: 

Service A <--> PersistentEventSender (local) --> DistributedSendActor (arbitary 
)<> Service B (DistDestination (uses Put method) 



I tried doing that but running into problems. However, If I give the 
destination actor full path 
(akka.tcp://ClusterSystem@127.0.0.1:2550/user/subscriber1") the client side 
persistence works but all our actors communicate within one cluster and hard 
coding target port doesn't make sense. 


Let me know if any of used UntypedPersistentActorWithAtLeastOnceDelivery to 
send message to any same clustered actor without specifying the full 
destination path.


Thanks,

SD

-- 
>>  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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


[akka-user] Re: microservices multi actor persistence and sharding question.

2015-11-18 Thread sd d
I finally found the solution. There is hardly any documentation or examples 
out there for this scenario. I have the checked in a sample on my github 
location, feel free to check out the solution. I have used the user role 
approach to resolve this issue.

https://github.com/sdab75/microservices-akka-cluster-sharding


Thanks,
SD

On Monday, November 16, 2015 at 3:39:36 PM UTC-5, sd d wrote:
>
>
> Hello,
>
> I found a solution but it won't work for microservice kind of setup. But 
> it might useful, for others who are trying to use Akka sharding in 
> monolothic applications. Please let me know if you guys find any other 
> alternatives.
>
> Essentially, the only way sharding between multiple services work if I 
> start sharding regions of all services that are participating in the 
> services communication. And the service that has the start of all regions 
> should start as seed-0-node otherwise your shard regions won't get stored.
>
> In other words, my Abc service has to start not only its own set of 
> sharding entities and supervisors but also the sharding entities and 
> supervisors of Def service.
>
> To prove this, I wrote another simplified example (my earlier example was 
> with spring-boot). I shared the POC in github.
>
> https://github.com/sdab75/multi-services-cluster-sharding
>
> If you run the above code you will be to re-create the problem. However if 
> you want to see successful service communication then you have to start all 
> shard regions.
>
> In other words, both AbcService and DefService must start all 4 regions. 
> Since my AbcServic runs on 2550 (seed-0) it will start all 4 regions.
>
> // Create an Akka system
> ActorSystem system = ActorSystem.create("ClusterSystem", 
> config);
> ClusterShardingSettings settings = 
> ClusterShardingSettings.create(system);
> ClusterSharding.get(system).start("AbcEventStoreSupervisor", 
> Props.create(AbcEventStoreSupervisor.class), settings,messageExtractor);
> ClusterSharding.get(system).start("AbcEventStore", 
> Props.create(AbcEventStore.class), settings,messageExtractor);
> ClusterSharding.get(system).start("DefEventStoreSupervisor", 
> Props.create(DefEventStoreSupervisor.class), settings, messageExtractor);
> ClusterSharding.get(system).start("DefEventStore", 
> Props.create(DefEventStore.class), settings, messageExtractor);
>
> If you don't do the aforementioned way, then the other service will never 
> find the shard regions of service and complains with the following error.
>
> [WARN] [11/15/2015 14:24:46.816] 
> [ClusterSystem-akka.actor.default-dispatcher-25] [akka.tcp://
> ClusterSystem@127.0.0.1:2552/system/sharding/defEventStoreSupervisor] 
> Trying to register to coordinator at
>  [Some(ActorSelection[Anchor(akka.tcp://ClusterSystem@127.0.0.1:2550/), 
> Path(/system/sharding/defEventStoreSupervisorCoordinator/singleton/coordinator)])],
>  
> but no acknowledgement. Total [1] buffered m
> essages.
>  
>
> If this how akka cluster sharding works, then it will not work in 
> microservices kind of project because in microservices world one service 
> should never know the other service persistent actors or sharding regions.
>
> Event persistence is very fundamental aspect of our project and does any 
> of think there is another way to solve this issue.
>
> Thanks,
> SD
>
> On Sunday, November 15, 2015 at 2:08:54 PM UTC-5, sd d wrote:
>>
>> *Hello,*
>>
>>
>> *Source Code:*
>>
>> https://github.com/sdab75/spring-boot-akka-cluster-sharding
>>
>>
>> *Scenario:*
>>
>>
>>1. Abc and Def are 2 micro services and they communicates with each 
>>other through their respective Async Event Listeners ( these are 2 
>> services 
>>are in the same cluster because they need to communicate with each other).
>>2. Each microservice set up the following way.
>>- Akka-PubSub-Listener to consume event topic.
>>   - And the Listener uses EventStoreSupervisor sharded region to 
>>   hand over the request to the  respective EventStoreActor which stores 
>> the 
>>   validated event and further publish event for other microservice.
>>   
>> *Issue:*
>>
>>
>>1. Since these micro services (Abc and Def) does different things I 
>>need to have to corresponding message extractors and sharded regions. But 
>>when I start these micro services in the same cluster, only the first 
>> seed 
>>node corresponding sharded region and coordinator gets created and 
>> started.
&

[akka-user] Re: microservices multi actor persistence and sharding question.

2015-11-16 Thread sd d

Hello,

I found a solution but it won't work for microservice kind of setup. But it 
might useful, for others who are trying to use Akka sharding in monolothic 
applications. Please let me know if you guys find any other alternatives.

Essentially, the only way sharding between multiple services work if I 
start sharding regions of all services that are participating in the 
services communication. And the service that has the start of all regions 
should start as seed-0-node otherwise your shard regions won't get stored.

In other words, my Abc service has to start not only its own set of 
sharding entities and supervisors but also the sharding entities and 
supervisors of Def service.

To prove this, I wrote another simplified example (my earlier example was 
with spring-boot). I shared the POC in github.

https://github.com/sdab75/multi-services-cluster-sharding

If you run the above code you will be to re-create the problem. However if 
you want to see successful service communication then you have to start all 
shard regions.

In other words, both AbcService and DefService must start all 4 regions. 
Since my AbcServic runs on 2550 (seed-0) it will start all 4 regions.

// Create an Akka system
ActorSystem system = ActorSystem.create("ClusterSystem", 
config);
ClusterShardingSettings settings = 
ClusterShardingSettings.create(system);
ClusterSharding.get(system).start("AbcEventStoreSupervisor", 
Props.create(AbcEventStoreSupervisor.class), settings,messageExtractor);
ClusterSharding.get(system).start("AbcEventStore", 
Props.create(AbcEventStore.class), settings,messageExtractor);
ClusterSharding.get(system).start("DefEventStoreSupervisor", 
Props.create(DefEventStoreSupervisor.class), settings, messageExtractor);
ClusterSharding.get(system).start("DefEventStore", 
Props.create(DefEventStore.class), settings, messageExtractor);

If you don't do the aforementioned way, then the other service will never 
find the shard regions of service and complains with the following error.

[WARN] [11/15/2015 14:24:46.816] 
[ClusterSystem-akka.actor.default-dispatcher-25] 
[akka.tcp://ClusterSystem@127.0.0.1:2552/system/sharding/defEventStoreSupervisor]
 
Trying to register to coordinator at
 [Some(ActorSelection[Anchor(akka.tcp://ClusterSystem@127.0.0.1:2550/), 
Path(/system/sharding/defEventStoreSupervisorCoordinator/singleton/coordinator)])],
 
but no acknowledgement. Total [1] buffered m
essages.
 

If this how akka cluster sharding works, then it will not work in 
microservices kind of project because in microservices world one service 
should never know the other service persistent actors or sharding regions.

Event persistence is very fundamental aspect of our project and does any of 
think there is another way to solve this issue.

Thanks,
SD

On Sunday, November 15, 2015 at 2:08:54 PM UTC-5, sd d wrote:
>
> *Hello,*
>
>
> *Source Code:*
>
> https://github.com/sdab75/spring-boot-akka-cluster-sharding
>
>
> *Scenario:*
>
>
>1. Abc and Def are 2 micro services and they communicates with each 
>other through their respective Async Event Listeners ( these are 2 
> services 
>are in the same cluster because they need to communicate with each other).
>2. Each microservice set up the following way.
>- Akka-PubSub-Listener to consume event topic.
>   - And the Listener uses EventStoreSupervisor sharded region to hand 
>   over the request to the  respective EventStoreActor which stores the 
>   validated event and further publish event for other microservice.
>   
> *Issue:*
>
>
>1. Since these micro services (Abc and Def) does different things I 
>need to have to corresponding message extractors and sharded regions. But 
>when I start these micro services in the same cluster, only the first seed 
>node corresponding sharded region and coordinator gets created and started.
>- Example:
>  - If Abc service is on 2550 and Def on 2551. I only see sharded 
>  region and coordinator created for Abc microservice.
>  - If I put Def on 2550 then I can see Def corresponding 
>  coordinator and region created.
>   
> The only way to create different sharded regions and coordinators is to 
> put them on different clusters (i.e) each microservice will have its own 
> cluster setup. If I do this then microsevice’s can’t communicate with each 
> because they are not part of the same cluster.
>
>
> How do I resolve this issue? I need persistence for my received events. 
> What is recommended paradigms in akka for this scenario. I am relatively 
> new to the akka world, please let me know if my understanding is incorrect 
> on akka cluster sharding.
>
>

[akka-user] Re: microservices multi actor persistence and sharding question.

2015-11-15 Thread sd d
Log
---
I am seeing the defEventStoreSupervisorCoordinator and 
defEventStoreActorCoordinator but these are not storing into the cassandra 
db and when this microservice recevies the event it tries to register the 
coordinators dynamically.

---

ith configuration settings 'akka.log-dead-letters' and 
'akka.log-dead-letters-during-shutdown'.Worker Startup 
###

[INFO] [11/15/2015 14:24:12.704] 
[ClusterSystem-akka.actor.default-dispatcher-16] 
[akka.tcp://ClusterSystem@127.0.0.1:2552/system/sharding/defEventStoreSupervisorCoordinator]
 
ClusterSingletonManager state change [Start -> Younger]

[INFO] [11/15/2015 14:24:12.704] 
[ClusterSystem-akka.actor.default-dispatcher-18] 
[akka.tcp://ClusterSystem@127.0.0.1:2552/system/sharding/defEventStoreActorCoordinator]
 
ClusterSingletonManager state
change [Start -> Younger]
ShardId --->36
[WARN] [11/15/2015 14:24:46.816] 
[ClusterSystem-akka.actor.default-dispatcher-25] 
[akka.tcp://ClusterSystem@127.0.0.1:2552/system/sharding/defEventStoreSupervisor]
 
Trying to register to coordinator at
 [Some(ActorSelection[Anchor(akka.tcp://ClusterSystem@127.0.0.1:2550/), 
Path(/system/sharding/defEventStoreSupervisorCoordinator/singleton/coordinator)])],
 
but no acknowledgement. Total [1] buffered m
essages.

[WARN] [11/15/2015 14:24:48.816] 
[ClusterSystem-akka.actor.default-dispatcher-18] 
[akka.tcp://ClusterSystem@127.0.0.1:2552/system/sharding/defEventStoreSupervisor]
 
Trying to register to coordinator at
 [Some(ActorSelection[Anchor(akka.tcp://ClusterSystem@127.0.0.1:2550/), 
Path(/system/sharding/defEventStoreSupervisorCoordinator/singleton/coordinator)])],
 
but no acknowledgement. Total [1] buffered m
essages.

On Sunday, November 15, 2015 at 2:08:54 PM UTC-5, sd d wrote:
>
> *Hello,*
>
>
> *Source Code:*
>
> https://github.com/sdab75/spring-boot-akka-cluster-sharding
>
>
> *Scenario:*
>
>
>1. Abc and Def are 2 micro services and they communicates with each 
>other through their respective Async Event Listeners ( these are 2 
> services 
>are in the same cluster because they need to communicate with each other).
>2. Each microservice set up the following way.
>- Akka-PubSub-Listener to consume event topic.
>   - And the Listener uses EventStoreSupervisor sharded region to hand 
>   over the request to the  respective EventStoreActor which stores the 
>   validated event and further publish event for other microservice.
>   
> *Issue:*
>
>
>1. Since these micro services (Abc and Def) does different things I 
>need to have to corresponding message extractors and sharded regions. But 
>when I start these micro services in the same cluster, only the first seed 
>node corresponding sharded region and coordinator gets created and started.
>- Example:
>  - If Abc service is on 2550 and Def on 2551. I only see sharded 
>  region and coordinator created for Abc microservice.
>  - If I put Def on 2550 then I can see Def corresponding 
>  coordinator and region created.
>   
> The only way to create different sharded regions and coordinators is to 
> put them on different clusters (i.e) each microservice will have its own 
> cluster setup. If I do this then microsevice’s can’t communicate with each 
> because they are not part of the same cluster.
>
>
> How do I resolve this issue? I need persistence for my received events. 
> What is recommended paradigms in akka for this scenario. I am relatively 
> new to the akka world, please let me know if my understanding is incorrect 
> on akka cluster sharding.
>
>
> Thanks,
>
> SD
>
>
>

-- 
>>>>>>>>>>  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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


[akka-user] microservices multi actor persistence and sharding question.

2015-11-15 Thread sd d


*Hello,*


*Source Code:*

https://github.com/sdab75/spring-boot-akka-cluster-sharding


*Scenario:*


   1. Abc and Def are 2 micro services and they communicates with each 
   other through their respective Async Event Listeners ( these are 2 services 
   are in the same cluster because they need to communicate with each other).
   2. Each microservice set up the following way.
   - Akka-PubSub-Listener to consume event topic.
  - And the Listener uses EventStoreSupervisor sharded region to hand 
  over the request to the  respective EventStoreActor which stores the 
  validated event and further publish event for other microservice.
  
*Issue:*


   1. Since these micro services (Abc and Def) does different things I need 
   to have to corresponding message extractors and sharded regions. But when I 
   start these micro services in the same cluster, only the first seed node 
   corresponding sharded region and coordinator gets created and started.
   - Example:
 - If Abc service is on 2550 and Def on 2551. I only see sharded 
 region and coordinator created for Abc microservice.
 - If I put Def on 2550 then I can see Def corresponding 
 coordinator and region created.
  
The only way to create different sharded regions and coordinators is to put 
them on different clusters (i.e) each microservice will have its own 
cluster setup. If I do this then microsevice’s can’t communicate with each 
because they are not part of the same cluster.


How do I resolve this issue? I need persistence for my received events. 
What is recommended paradigms in akka for this scenario. I am relatively 
new to the akka world, please let me know if my understanding is incorrect 
on akka cluster sharding.


Thanks,

SD


-- 
>>  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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


[akka-user] Akka cluster sharding exception propagation to the parent actor

2015-11-11 Thread sd d
Hello,

In a multi node cluster sharding scenario if a persistent actor throws an 
exception, it is not propagating to the Parent Actor supervisor strategy, 
instead the persistent actor retries for ever, I haven't tried the 
BackOffSupervisor yet but does it help in propagating the exception to the 
parent actor or it periodically increases the timeout and tries again and 
again till the exception is resolved. 

Ideally, if there is a database exception in the persistent actor, i would 
like the supervisor actor open the circuit breaker. So, far I haven't had 
much success in getting this to work.

I looked at the following thread, looks like this has been resolved in Akka 
2.4 release.
https://github.com/akka/akka/issues/18487

I took an example from this URL 
(https://github.com/henrymai/akka/blob/master/akka-cluster-sharding/src/test/java/akka/cluster/sharding/ClusterShardingTest.java)
 
and added an exception scenario to test the exception propagation scenario 
but it is not working as expected instead re-tries for ever following is 
the sample log. 

My changes can be found at this github URL 
(https://github.com/sdab75/akka-cluster-sharding-test/blob/master/src/main/java/akka/cluster/sharding/ClusterShardingTest.java),
 
this example will recreate the exception i was talking about. 

I am just wondering, if any of got this scenario working. Appreciate any 
help in resolving this issue.

I generate the exception the following way.

void updateState(CounterChanged event) {
System.out.println("updating ###");
if(true){
throw new RuntimeException("Intentional Error 
");
}
count += event.delta;
}




Error Log:

C:\java\jdk1.8.0_25\bin\java -Didea.launcher.port=7533 
"-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA 
Community Edition 14.1.5\bin" -Dfile.encoding=windows-1252 -classpath 
"C:\java\jdk1.8.0_25\jre\lib\charsets.jar;C:\java\jdk1.8.0_25\jre\lib\deploy.jar;C:\java\jdk1.8.0_25\jre\lib\javaws.jar;C:\java\jdk1.8.0_25\jre\lib\jce.jar;C:\java\jdk1.8.0_25\jre\lib\jfr.jar;C:\java\jdk1.8.0_25\jre\lib\jfxswt.jar;C:\java\jdk1.8.0_25\jre\lib\jsse.jar;C:\java\jdk1.8.0_25\jre\lib\management-agent.jar;C:\java\jdk1.8.0_25\jre\lib\plugin.jar;C:\java\jdk1.8.0_25\jre\lib\resources.jar;C:\java\jdk1.8.0_25\jre\lib\rt.jar;C:\java\jdk1.8.0_25\jre\lib\ext\access-bridge-64.jar;C:\java\jdk1.8.0_25\jre\lib\ext\cldrdata.jar;C:\java\jdk1.8.0_25\jre\lib\ext\dnsns.jar;C:\java\jdk1.8.0_25\jre\lib\ext\jaccess.jar;C:\java\jdk1.8.0_25\jre\lib\ext\jfxrt.jar;C:\java\jdk1.8.0_25\jre\lib\ext\localedata.jar;C:\java\jdk1.8.0_25\jre\lib\ext\nashorn.jar;C:\java\jdk1.8.0_25\jre\lib\ext\sapjco3.jar;C:\java\jdk1.8.0_25\jre\lib\ext\sunec.jar;C:\java\jdk1.8.0_25\jre\lib\ext\sunjce_provider.jar;C:\java\jdk1.8.0_25\jre\lib\ext\sunmscapi.jar;C:\java\jdk1.8.0_25\jre\lib\ext\sunpkcs11.jar;C:\java\jdk1.8.0_25\jre\lib\ext\zipfs.jar;C:\dev\garnet\experiments\akka-cluster-sharding-test\target\classes;C:\Users\davenkat\.m2\repository\org\codehaus\jackson\jackson-mapper-asl\1.9.11\jackson-mapper-asl-1.9.11.jar;C:\Users\davenkat\.m2\repository\org\codehaus\jackson\jackson-core-asl\1.9.11\jackson-core-asl-1.9.11.jar;C:\Users\davenkat\.m2\repository\javax\json\javax.json-api\1.0\javax.json-api-1.0.jar;C:\Users\davenkat\.m2\repository\org\springframework\boot\spring-boot-starter-web\1.2.5.RELEASE\spring-boot-starter-web-1.2.5.RELEASE.jar;C:\Users\davenkat\.m2\repository\org\springframework\boot\spring-boot-starter\1.2.5.RELEASE\spring-boot-starter-1.2.5.RELEASE.jar;C:\Users\davenkat\.m2\repository\org\springframework\boot\spring-boot\1.2.5.RELEASE\spring-boot-1.2.5.RELEASE.jar;C:\Users\davenkat\.m2\repository\org\springframework\boot\spring-boot-autoconfigure\1.2.5.RELEASE\spring-boot-autoconfigure-1.2.5.RELEASE.jar;C:\Users\davenkat\.m2\repository\org\springframework\boot\spring-boot-starter-logging\1.2.5.RELEASE\spring-boot-starter-logging-1.2.5.RELEASE.jar;C:\Users\davenkat\.m2\repository\org\slf4j\jul-to-slf4j\1.7.12\jul-to-slf4j-1.7.12.jar;C:\Users\davenkat\.m2\repository\org\yaml\snakeyaml\1.14\snakeyaml-1.14.jar;C:\Users\davenkat\.m2\repository\org\springframework\boot\spring-boot-starter-tomcat\1.2.5.RELEASE\spring-boot-starter-tomcat-1.2.5.RELEASE.jar;C:\Users\davenkat\.m2\repository\org\apache\tomcat\embed\tomcat-embed-core\8.0.23\tomcat-embed-core-8.0.23.jar;C:\Users\davenkat\.m2\repository\org\apache\tomcat\embed\tomcat-embed-el\8.0.23\tomcat-embed-el-8.0.23.jar;C:\Users\davenkat\.m2\repository\org\apache\tomcat\embed\tomcat-embed-logging-juli\8.0.23\tomcat-embed-logging-juli-8.0.23.jar;C:\Users\davenkat\.m2\repository\org\apache\tomcat\embed\tomcat-embed-websocket\8.0.23\tomcat-embed-websocket-8.0.23.jar;C:\Users\davenkat\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.4.6\jackson-databind-2.4.6.jar;C:\Users\davenkat\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.4.6\jackson-core-2.4.6.jar;C:\Users\davenkat\.m2\repository\org\spri

[akka-user] Re: Does akka 2.4 persistent actor cluster sharding Supervisor combination works on multi node cluster?

2015-11-09 Thread sd d
I noticed one subtle thing in my cassandra entity persistence. 

In my Subscriber class.

If I use the "ActorRef myEntity = 
ClusterSharding.get(getContext().system()).shardRegion("MyEntity");" then I 
see the persistence_id='counter-worker-MyEntity123'.

Where as, if I use the previously mentioned approach which is ( ActorRef 
myEntity = getContext().actorOf(Props.create(MyEntity.class), "myEntity");) 
then i see the persistence_id='counter-worker-myEntity'.

The above observation tells me that forwarding via Supervisor actor 
instance is not invoking ShardRegion.MessageExtractor 'entityId' overrider 
which is required for my MyEntity.class

 @Override
public String persistenceId() {
return "counter-worker-" + getSelf().path().name();
}

In my subscriber startup class i am starting the Subscriber sharding the 
following way.

ClusterSharding.get(system).start("Subscriber", 
Props.create(Subscriber.class), settings, messageExtractor);

Not sure, what else is needed. That actually makes think is it supported at 
all? But the documentation says otherwise.

Please review my code  at the following link.

https://github.com/sdab75/akka-cluster-sharding-example/tree/master

 I spent several days debugging this issue. Any help appreciated.

Thanks,
SD

On Monday, November 9, 2015 at 1:33:35 PM UTC-5, sd d wrote:
>
> *Source code github link:*
>
>
> https://github.com/sdab75/akka-cluster-sharding-example/tree/master
>
>
> I am struggling to get the persistent actor and akka cluster sharding 
> “supervisor” combination work.
>
>
> The cluster sharding ‘without’ akka supervisor works fine i.e. in my 
> Subscriber if I get the sharded region entity via “ActorRef myEntity = 
> ClusterSharding.get(getContext().system()).shardRegion("MyEntity");” and 
> use the myEntity reference to forward the received messages to my 
> persistent actor entity “MyEntity.class”.
>
>
> However, this approach doesn’t fire the parent (‘Subscriber’ actor) 
> supervisor strategy.
>
>
> According to the Akka documentation (
> http://doc.akka.io/docs/akka/2.4.0/java/cluster-sharding.html). I am 
> supposed to forward received message via parent actor “ActorRef myEntity = 
> getContext().actorOf(Props.create(MyEntity.class), "myEntity");”. This 
> works as long as I have ‘one Subscriber node’ in the cluster (i.e. on 
> exception, parent actor supervisor strategy gets invoked), the minute we 
> add an additional ‘Subscriber’ node the persistence goes havoc and does 
> only partial persistence i.e. if I publish 10 messages I only 6 or 7 
> messages getting persisted.
>
>
> I have checked in the code in my git hub. Please let me know if If the 
> cluster sharding supervisor is fully tested in akka distribute pub/sub 
> scenario for akka 2.4.0.I followed the documentation from this URL (
> http://doc.akka.io/docs/akka/2.4.0/java/cluster-sharding.html).
>
>
> *Example setup*
>
>1. The PubCluster publishes a topic named ‘content’ that has myCounter 
>instance. Currently PubClusterApp uses pub actor with round robbin pool of 
>5 ( ‘ActorRef pub = 
>system.actorOf(Props.create(Publisher.class).withRouter(new 
>RoundRobinPool(5)), "publisher");’.).
>2. There are 2 subscriber apps (SubClusterApp1, SubClusterApp2)both 
>uses the same Subscriber uses the same group ‘grp1’.
>
> *Sucessful scenario with one ‘Subscriber’ node in the cluster.*
>
>1. Start SubClusterApp1 (akka 2550)
>2. Start PubClusterApp (akka 2552)
>
> This will perfectly save all the messages and and also notifies the 
> supervisor on the exception.
>
> *Failure scenario*
>
> when I start 2 subcriber nodes I see both nodes recieveing messages but 
> only few messages are getting saved.
>
>1. Start SubClusterApp1 (akka 2550)
>2. Start SubClusterApp1 (akka 2551)
>3. Start PubClusterApp (akka 2552)
>
> If the cluster sharding based fault tolerance doesn’t work in a multi node 
> scenarios then I am not sure how far we can use akka for production 
> scenarios. Any help in clarifying the issue appreciated.
>
>
> Thanks,
>
> SD
>

-- 
>>>>>>>>>>  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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


[akka-user] Does akka 2.4 persistent actor cluster sharding Supervisor combination works on multi node cluster?

2015-11-09 Thread sd d


*Source code github link:*


https://github.com/sdab75/akka-cluster-sharding-example/tree/master


I am struggling to get the persistent actor and akka cluster sharding 
“supervisor” combination work.


The cluster sharding ‘without’ akka supervisor works fine i.e. in my 
Subscriber if I get the sharded region entity via “ActorRef myEntity = 
ClusterSharding.get(getContext().system()).shardRegion("MyEntity");” and 
use the myEntity reference to forward the received messages to my 
persistent actor entity “MyEntity.class”.


However, this approach doesn’t fire the parent (‘Subscriber’ actor) 
supervisor strategy.


According to the Akka documentation (
http://doc.akka.io/docs/akka/2.4.0/java/cluster-sharding.html). I am 
supposed to forward received message via parent actor “ActorRef myEntity = 
getContext().actorOf(Props.create(MyEntity.class), "myEntity");”. This 
works as long as I have ‘one Subscriber node’ in the cluster (i.e. on 
exception, parent actor supervisor strategy gets invoked), the minute we 
add an additional ‘Subscriber’ node the persistence goes havoc and does 
only partial persistence i.e. if I publish 10 messages I only 6 or 7 
messages getting persisted.


I have checked in the code in my git hub. Please let me know if If the 
cluster sharding supervisor is fully tested in akka distribute pub/sub 
scenario for akka 2.4.0.I followed the documentation from this URL (
http://doc.akka.io/docs/akka/2.4.0/java/cluster-sharding.html).


*Example setup*

   1. The PubCluster publishes a topic named ‘content’ that has myCounter 
   instance. Currently PubClusterApp uses pub actor with round robbin pool of 
   5 ( ‘ActorRef pub = 
   system.actorOf(Props.create(Publisher.class).withRouter(new 
   RoundRobinPool(5)), "publisher");’.).
   2. There are 2 subscriber apps (SubClusterApp1, SubClusterApp2)both uses 
   the same Subscriber uses the same group ‘grp1’.

*Sucessful scenario with one ‘Subscriber’ node in the cluster.*

   1. Start SubClusterApp1 (akka 2550)
   2. Start PubClusterApp (akka 2552)

This will perfectly save all the messages and and also notifies the 
supervisor on the exception.

*Failure scenario*

when I start 2 subcriber nodes I see both nodes recieveing messages but 
only few messages are getting saved.

   1. Start SubClusterApp1 (akka 2550)
   2. Start SubClusterApp1 (akka 2551)
   3. Start PubClusterApp (akka 2552)

If the cluster sharding based fault tolerance doesn’t work in a multi node 
scenarios then I am not sure how far we can use akka for production 
scenarios. Any help in clarifying the issue appreciated.


Thanks,

SD

-- 
>>  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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.