[akka-user] AKKA-Message delivery guarantee

2014-07-20 Thread Rajesh B N
Hi Team,
 I am trying to insert 20k records into database using AKKA.But I found 
 only 19,994 records being inserted and rest 6 records were failure.Is 
there any way in AKKA that I can get a solution for this i.e I need all the 
20k records to be inserted into DB without failure?  

-- 
>>  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: akka cluster - verbosity of logging on node exit

2014-07-20 Thread shikhar
Also I think the first of those log lines should be at the DEBUG level,
since shortly after this INFO logging happens:

[Cluster(akka://mycluster)] Cluster Node [akka.tcp://mycluster@myhose:8402]
- Leader is removing exiting node [akka.tcp://mycluster@myhose:30957]


On Mon, Jul 21, 2014 at 11:10 AM, shikhar  wrote:

> When a node initiates a leave for itself, the exit is pretty verbose.
>
> i.e. these are logged on every cluster member
>
> [2014-07-21 05:36:23,181][INFO ][akka.dummy   ]
> [Cluster(akka://mycluster)] Cluster Node [akka.tcp://mycluster@myhost:8402]
> - Marking exiting node(s) as UNREACHABLE [Member(address =
> akka.tcp://mycluster@myhost:30957, status = Exiting)]. This is expected
> and they will be removed.
> *[2014-07-21 05:36:24,414][WARN ][akka.dummy   ] [Remoting]
> Tried to associate with unreachable remote address
> [akka.tcp://mycluster@myhost:30957]. Address is now gated for 5000 ms, all
> messages to this address will be delivered to dead letters. Reason:
> Connection refused: myhost/abc.de.fg.hi:30957*
>
> The first of these log lines I can understand, but I don't think a warning
> is appropriate here.
>
> Shall I open an issue for this?
>

-- 
>>  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 - verbosity of logging on node exit

2014-07-20 Thread shikhar
When a node initiates a leave for itself, the exit is pretty verbose.

i.e. these are logged on every cluster member

[2014-07-21 05:36:23,181][INFO ][akka.dummy   ]
[Cluster(akka://mycluster)] Cluster Node [akka.tcp://mycluster@myhost:8402]
- Marking exiting node(s) as UNREACHABLE [Member(address =
akka.tcp://mycluster@myhost:30957, status = Exiting)]. This is expected and
they will be removed.
*[2014-07-21 05:36:24,414][WARN ][akka.dummy   ] [Remoting]
Tried to associate with unreachable remote address
[akka.tcp://mycluster@myhost:30957]. Address is now gated for 5000 ms, all
messages to this address will be delivered to dead letters. Reason:
Connection refused: myhost/abc.de.fg.hi:30957*

The first of these log lines I can understand, but I don't think a warning
is appropriate here.

Shall I open an issue for this?

-- 
>>  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.


Re: [akka-user] akka cluster - oversized payloads

2014-07-20 Thread shikhar
Thanks for the input Patrik.

I've confirmed that the issue wasn't anything in the application by
isolating it in a simple project
, see Churn.scala
.
I set the payload size limit to 32k in the hope of seeing the issue sooner.
It happened after a churn of ~750 nodes.

I think for now I'll bump the limit a notch in my actual project.

Really looking forward to pruning for 2.4, unbounded growth in gossip size
is pretty undesirable

On Sun, Jul 20, 2014 at 7:18 PM, Patrik Nordwall 
wrote:

> Yes, it can be because of the many join/leave cycles and lack of vector
> clock pruning.
>
> I agree that it is strange that the cluster is working after that, because
> the gossip message size will not shrink.
>
> The vector clocks only increase in size if the cluster membership state is
> modified by different nodes, so it would be interesting to understand how
> your transient nodes contribute to such changes. Which node performs the
> leave action? If that is done by a transient node, you could perhaps
> perform that from one of the stable nodes instead.
>
> Pruning is on our radar for 2.4.
>
> /Patrik
>
> 20 jul 2014 kl. 08:55 skrev shikhar :
>
> After the cluster has been up for a longish period (> a day or so), and
> only then, I'm seeing:
>
> [2014-07-20 00:00:00,708][ERROR][akka.remote.EndpointWriter]
> [akka.tcp://x...@.com:/system/endpointManager/reliableEndpointWriter-akka.tcp%3A%2F%2F%40%3A-16/endpointWriter]
> Transient association error (association remains live)
> akka.remote.OversizedPayloadException: Discarding oversized payload sent
> to Actor[akka.tcp://@:/]: max allowed size 128000 bytes,
> actual size of encoded class akka.actor.ActorSelectionMessage was 147704
> bytes.
>
> logged every second, for message sends to different cluster members.
>
> This is on a 21 node cluster, however there is one peculiarity that some
> some processes join the cluster via cron jobs (2 of them every minute) and
> exit shortly.
>
> Despite this OversizedPayloadException logging, the cluster seems to be
> functioning normally otherwise. New members are joining and leaving. I just
> shutdown the cluster singleton and failover happened smoothly.
>
> The number of bytes on that actor selection message keeps growing, BTW. It
> had gone from 147K to 178K in about 6 hours.
>
> I understand there is a setting for the payload size limit, "
> akka.remote.netty.tcp.maximum-frame-size", but before bumping that I'd
> like to understand what is going on here.
>
> Could this be a consequence of the fact that akka cluster does not perform
> vector clock pruning, and I have nodes constantly joining and leaving? If
> so, it's strange that the cluster can keep functioning despite what may be
> failed gossip sends?
>
> I don't think this is anything at the application-level, the messages sent
> using selections are quite small.
>
> --
> >> 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.
>
>  --
> >> 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.
>

-- 
>>  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.


Re: [akka-user] akka cluster - oversized payloads

2014-07-20 Thread Xingrun CHEN
We met this issue too.

Shall we upgrade to 2.4 to resolve this?

On Sunday, July 20, 2014 9:49:08 PM UTC+8, Patrik Nordwall wrote:
>
> Yes, it can be because of the many join/leave cycles and lack of vector 
> clock pruning.
>
> I agree that it is strange that the cluster is working after that, because 
> the gossip message size will not shrink.
>
> The vector clocks only increase in size if the cluster membership state is 
> modified by different nodes, so it would be interesting to understand how 
> your transient nodes contribute to such changes. Which node performs the 
> leave action? If that is done by a transient node, you could perhaps 
> perform that from one of the stable nodes instead.
>
> Pruning is on our radar for 2.4. 
>
> /Patrik
>
> 20 jul 2014 kl. 08:55 skrev shikhar >:
>
> After the cluster has been up for a longish period (> a day or so), and 
> only then, I'm seeing:
>
> [2014-07-20 00:00:00,708][ERROR][akka.remote.EndpointWriter] 
> [akka.tcp://x...@.com:/system/endpointManager/reliableEndpointWriter-akka.tcp%3A%2F%2F%40%3A-16/endpointWriter]
>  
> Transient association error (association remains live)
> akka.remote.OversizedPayloadException: Discarding oversized payload sent 
> to Actor[akka.tcp://@:/]: max allowed size 128000 bytes, actual 
> size of encoded class akka.actor.ActorSelectionMessage was 147704 bytes.
>
> logged every second, for message sends to different cluster members.
>
> This is on a 21 node cluster, however there is one peculiarity that some 
> some processes join the cluster via cron jobs (2 of them every minute) and 
> exit shortly. 
>
> Despite this OversizedPayloadException logging, the cluster seems to be 
> functioning normally otherwise. New members are joining and leaving. I just 
> shutdown the cluster singleton and failover happened smoothly.
>
> The number of bytes on that actor selection message keeps growing, BTW. It 
> had gone from 147K to 178K in about 6 hours.
>
> I understand there is a setting for the payload size limit, "
> akka.remote.netty.tcp.maximum-frame-size", but before bumping that I'd 
> like to understand what is going on here.
>
> Could this be a consequence of the fact that akka cluster does not perform 
> vector clock pruning, and I have nodes constantly joining and leaving? If 
> so, it's strange that the cluster can keep functioning despite what may be 
> failed gossip sends?
>
> I don't think this is anything at the application-level, the messages sent 
> using selections are quite small.
>
> -- 
> >> 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+...@googlegroups.com .
> To post to this group, send email to akka...@googlegroups.com 
> .
> Visit this group at http://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>
>

-- 
>>  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.


Re: [akka-user] Testing PersistentActor, receiveCommand is never called (Akka 2.3.4)

2014-07-20 Thread Konrad Malawski
My pleasure!
Feel free to ask any follow up questions :-)

Happy hakking!


On Sun, Jul 20, 2014 at 7:42 PM, Yann Le Moigne 
wrote:

> Hi Konrad
>
> Yes it help !
> Thank you.
>
> For my first incursion in akka community, you was very helpfull and
> reactive.
> Thanks :)
>
> Le dimanche 20 juillet 2014 18:42:12 UTC+2, Konrad Malawski a écrit :
>>
>>  Without modifying the tested actor you could test (1) by sending an
>> Idenfity message to the selection (testedGuy/*),
>> and then expect exactly one ActorIdentity as response (expect it, and
>> then expectNoMsg).
>>
>> I hope this helps!
>>
>> ​
>>
>>
>> On Sun, Jul 20, 2014 at 4:31 PM, Yann Le Moigne 
>> wrote:
>>
>>> I'm beginning, so nu much insight to make a whish at this time ; but of
>>> course, managed test & journal lifecycle by specialized TestKit sound great.
>>>
>>> I'm trying to switch to standard testing style, but I can't find a way
>>> to replace :
>>> 1: assert(actorRef.underlyingActor.context.children.size === 1)
>>> 2: assert(actorRef.underlyingActor.context.child(address).isDefined)
>>>
>>> For the (2), using system.actorSelection(...).resolveOne(...) can help
>>> but I struggle to check (1)
>>>
>>> Le dimanche 20 juillet 2014 16:14:53 UTC+2, Konrad Malawski a écrit :
>>>
 Yes, I agree this should be mentioned explicitly - I have created this
 issue to track this: https://github.com/akka/akka/issues/15569

 By the way, we are thinking of offering a TestKit for akka-persistence.
 I think it would be a neat addition (would make prepping journal state
 before your tests easier) but we have not discussed it in detail yet, let
 me know if you have a wish list for that kind of utility so we’ll keep them
 in mind :-)

 --
 Konrad 'ktoso' Malawski
 hAkker @ typesafe
 http://akka.io

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



-- 
Cheers,
Konrad 'ktoso' Malawski
hAkker @ Typesafe



-- 
>>  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.


Re: [akka-user] Testing PersistentActor, receiveCommand is never called (Akka 2.3.4)

2014-07-20 Thread Yann Le Moigne
Hi Konrad

Yes it help !
Thank you.

For my first incursion in akka community, you was very helpfull and 
reactive.
Thanks :)

Le dimanche 20 juillet 2014 18:42:12 UTC+2, Konrad Malawski a écrit :
>
> Without modifying the tested actor you could test (1) by sending an 
> Idenfity message to the selection (testedGuy/*),
> and then expect exactly one ActorIdentity as response (expect it, and 
> then expectNoMsg).
>
> I hope this helps!
>
> ​
>
>
> On Sun, Jul 20, 2014 at 4:31 PM, Yann Le Moigne  > wrote:
>
>> I'm beginning, so nu much insight to make a whish at this time ; but of 
>> course, managed test & journal lifecycle by specialized TestKit sound great.
>>
>> I'm trying to switch to standard testing style, but I can't find a way to 
>> replace :
>> 1: assert(actorRef.underlyingActor.context.children.size === 1)
>> 2: assert(actorRef.underlyingActor.context.child(address).isDefined)
>>
>> For the (2), using system.actorSelection(...).resolveOne(...) can help 
>> but I struggle to check (1)
>>
>> Le dimanche 20 juillet 2014 16:14:53 UTC+2, Konrad Malawski a écrit :
>>
>>> Yes, I agree this should be mentioned explicitly - I have created this 
>>> issue to track this: https://github.com/akka/akka/issues/15569
>>>
>>> By the way, we are thinking of offering a TestKit for akka-persistence.
>>> I think it would be a neat addition (would make prepping journal state 
>>> before your tests easier) but we have not discussed it in detail yet, let 
>>> me know if you have a wish list for that kind of utility so we’ll keep them 
>>> in mind :-)
>>>
>>> -- 
>>> Konrad 'ktoso' Malawski
>>> hAkker @ typesafe
>>> http://akka.io
>>>
>>  -- 
>> >> 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+...@googlegroups.com .
>> To post to this group, send email to akka...@googlegroups.com 
>> .
>> Visit this group at http://groups.google.com/group/akka-user.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Cheers,
> Konrad 'ktoso' Malawski
> hAkker @ Typesafe
>
> 
>  

-- 
>>  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.


Re: [akka-user] Testing PersistentActor, receiveCommand is never called (Akka 2.3.4)

2014-07-20 Thread Konrad Malawski
Without modifying the tested actor you could test (1) by sending an Idenfity
message to the selection (testedGuy/*),
and then expect exactly one ActorIdentity as response (expect it, and then
expectNoMsg).

I hope this helps!

​


On Sun, Jul 20, 2014 at 4:31 PM, Yann Le Moigne 
wrote:

> I'm beginning, so nu much insight to make a whish at this time ; but of
> course, managed test & journal lifecycle by specialized TestKit sound great.
>
> I'm trying to switch to standard testing style, but I can't find a way to
> replace :
> 1: assert(actorRef.underlyingActor.context.children.size === 1)
> 2: assert(actorRef.underlyingActor.context.child(address).isDefined)
>
> For the (2), using system.actorSelection(...).resolveOne(...) can help but
> I struggle to check (1)
>
> Le dimanche 20 juillet 2014 16:14:53 UTC+2, Konrad Malawski a écrit :
>
>> Yes, I agree this should be mentioned explicitly - I have created this
>> issue to track this: https://github.com/akka/akka/issues/15569
>>
>> By the way, we are thinking of offering a TestKit for akka-persistence.
>> I think it would be a neat addition (would make prepping journal state
>> before your tests easier) but we have not discussed it in detail yet, let
>> me know if you have a wish list for that kind of utility so we’ll keep them
>> in mind :-)
>>
>> --
>> Konrad 'ktoso' Malawski
>> hAkker @ typesafe
>> http://akka.io
>>
>  --
> >> 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.
>



-- 
Cheers,
Konrad 'ktoso' Malawski
hAkker @ Typesafe



-- 
>>  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.


Re: [akka-user] Akka Actor Per Request Java Sample

2014-07-20 Thread Thomas Lockney
At least some of this code is necessarily in Scala as Spray does not
support Java. You could likely get some of this working (or something
approximating it) with the new akka-http module, but it does not yet have
an equivalent for spray-routing, so you would have to manually handle the
route construction.

--
Thomas Lockney
tho...@lockney.net
http://about.me/tlockney
On Jul 19, 2014 11:22 PM, "John Haigh"  wrote:

> Hello,
>
> I have seen the Scala Actor Per Request sample at
> https://github.com/NET-A-PORTER/spray-actor-per-request, and I am
> wondering if there is a Java version out there in some form?
>
>
> I found the following java REST samples but I want to understand what the
> best method for implementation is.
>
> https://github.com/pofallon/jersey2-akka-java
>
> Thanks,
>
> John
>
>
>
>  --
> >> 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.
>

-- 
>>  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: Akka Actor Per Request Java Sample

2014-07-20 Thread Konrad Malawski
Hello John,
I don't think there is an equivalent repo to this out there...
Although I assume you've seem this post 
http://techblog.net-a-porter.com/2013/12/ask-tell-and-per-request-actors/ where 
this code sample originates from?
The concepts are pretty generic, and I would recommend checking out the 
concepts if you have not yet already.

Is there a specific question you'd like to see answered here?

-- 
Konrad `ktoso` Malawski
hAkker @ Typesafe 

-- 
>>  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.


Re: [akka-user] Testing PersistentActor, receiveCommand is never called (Akka 2.3.4)

2014-07-20 Thread Yann Le Moigne
I'm beginning, so nu much insight to make a whish at this time ; but of 
course, managed test & journal lifecycle by specialized TestKit sound great.

I'm trying to switch to standard testing style, but I can't find a way to 
replace :
1: assert(actorRef.underlyingActor.context.children.size === 1)
2: assert(actorRef.underlyingActor.context.child(address).isDefined)

For the (2), using system.actorSelection(...).resolveOne(...) can help but 
I struggle to check (1)

Le dimanche 20 juillet 2014 16:14:53 UTC+2, Konrad Malawski a écrit :
>
> Yes, I agree this should be mentioned explicitly - I have created this 
> issue to track this: https://github.com/akka/akka/issues/15569
>
> By the way, we are thinking of offering a TestKit for akka-persistence.
> I think it would be a neat addition (would make prepping journal state 
> before your tests easier) but we have not discussed it in detail yet, let 
> me know if you have a wish list for that kind of utility so we’ll keep them 
> in mind :-)
>
> -- 
> Konrad 'ktoso' Malawski
> hAkker @ typesafe
> http://akka.io
>

-- 
>>  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.


Re: [akka-user] Testing PersistentActor, receiveCommand is never called (Akka 2.3.4)

2014-07-20 Thread Konrad 'ktoso' Malawski
Yes, I agree this should be mentioned explicitly - I have created this issue to 
track this: https://github.com/akka/akka/issues/15569

By the way, we are thinking of offering a TestKit for akka-persistence.
I think it would be a neat addition (would make prepping journal state before 
your tests easier) but we have not discussed it in detail yet, let me know if 
you have a wish list for that kind of utility so we’ll keep them in mind :-)

-- 
Konrad 'ktoso' Malawski
hAkker @ typesafe
http://akka.io

-- 
>>  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.


Re: [akka-user] Testing PersistentActor, receiveCommand is never called (Akka 2.3.4)

2014-07-20 Thread Yann Le Moigne
Ho, OK.

Maybe this should be explicitly added to documentation ?

Thanks for the answer.

Le dimanche 20 juillet 2014 15:46:02 UTC+2, Konrad Malawski a écrit :
>
> Hi Yann,
> TestActorRef is not compatible with Akka persistence. We discussed this in 
> this issue here: https://github.com/akka/akka/issues/15293
>
> Please use traditional testing style with persistence (as in expect 
> messages etc).
>
> -- 
> Konrad 'ktoso' Malawski
> (Sent from my phone)
> On 20 Jul 2014 15:23, "Yann Le Moigne" > 
> wrote:
>
>> Hi,
>>
>> I'm trying to test a persistent actor
>>
>> class ServerManager extends PersistentActor {
>>   override def persistenceId = "ServerManager"
>>
>>   override def receiveRecover: Receive = { case _ => }
>>
>>   override def receiveCommand: Receive = {
>> case Commands.Server.Watch(address) =>
>>   persist(Events.Server.WatchCreated(address)) { event =>
>>   context.actorOf(Props(classOf[ServerMonitor], event.address), 
>> event.address)
>> }
>> case Commands.Server.Unwatch(address) =>
>>   for(child <- context.child(address)) context.stop(child)
>>   }
>> }
>>
>>
>> My test class looks like this :
>>
>> class ServerManagerTest(_system: ActorSystem) extends TestKit(_system) 
>> with ImplicitSender with WordSpecLike with Matchers with BeforeAndAfterAll {
>>   def this() = this(
>> ActorSystem("TestActorSystem", ConfigFactory.parseString(
>>   """
>> |akka.loglevel = "DEBUG"
>> |akka.persistence.journal.plugin = "in-memory-journal"
>> |akka.actor.debug {
>> |   receive = on
>> |   autoreceive = on
>> |   lifecycle = on
>> |}
>>   """.stripMargin))
>>   )
>>
>>   override def afterAll() {
>> TestKit.shutdownActorSystem(system)
>>   }
>>
>>   trait ServerManagerFixture {
>> val actorRef = TestActorRef[ServerManager]
>>   }
>>
>>   "A ServerManager" when {
>>   val address = "192.168.1.1"
>>   val cmd = Commands.Server.Watch(address)
>>
>>   s"received '$cmd'" should {
>> s"have one child named '$address'" in new ServerManagerFixture {
>>   actorRef ! cmd
>>
>>   assert(actorRef.underlyingActor.context.children.size === 1)
>>   
>> assert(actorRef.underlyingActor.context.child(address).isDefined)
>> }
>>   }
>> }
>> }
>>
>> I put break point on receiveCommand and running test, but it's never 
>> called. 
>> I've checked 
>> https://github.com/akka/akka/blob/master/akka-persistence/src/test/scala/akka/persistence/PersistentActorSpec.scala
>>  
>> ; but I can't find what i'm missing.
>> If anyone can help : Thanks.
>>
>> -- 
>> >> 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+...@googlegroups.com .
>> To post to this group, send email to akka...@googlegroups.com 
>> .
>> Visit this group at http://groups.google.com/group/akka-user.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
>>  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.


Re: [akka-user] akka cluster - oversized payloads

2014-07-20 Thread Patrik Nordwall
Yes, it can be because of the many join/leave cycles and lack of vector clock 
pruning.

I agree that it is strange that the cluster is working after that, because the 
gossip message size will not shrink.

The vector clocks only increase in size if the cluster membership state is 
modified by different nodes, so it would be interesting to understand how your 
transient nodes contribute to such changes. Which node performs the leave 
action? If that is done by a transient node, you could perhaps perform that 
from one of the stable nodes instead.

Pruning is on our radar for 2.4. 

/Patrik

> 20 jul 2014 kl. 08:55 skrev shikhar :
> 
> After the cluster has been up for a longish period (> a day or so), and only 
> then, I'm seeing:
> 
> [2014-07-20 00:00:00,708][ERROR][akka.remote.EndpointWriter] 
> [akka.tcp://x...@.com:/system/endpointManager/reliableEndpointWriter-akka.tcp%3A%2F%2F%40%3A-16/endpointWriter]
>  Transient association error (association remains live)
> akka.remote.OversizedPayloadException: Discarding oversized payload sent to 
> Actor[akka.tcp://@:/]: max allowed size 128000 bytes, actual size 
> of encoded class akka.actor.ActorSelectionMessage was 147704 bytes.
> 
> logged every second, for message sends to different cluster members.
> 
> This is on a 21 node cluster, however there is one peculiarity that some some 
> processes join the cluster via cron jobs (2 of them every minute) and exit 
> shortly. 
> 
> Despite this OversizedPayloadException logging, the cluster seems to be 
> functioning normally otherwise. New members are joining and leaving. I just 
> shutdown the cluster singleton and failover happened smoothly.
> 
> The number of bytes on that actor selection message keeps growing, BTW. It 
> had gone from 147K to 178K in about 6 hours.
> 
> I understand there is a setting for the payload size limit, 
> "akka.remote.netty.tcp.maximum-frame-size", but before bumping that I'd like 
> to understand what is going on here.
> 
> Could this be a consequence of the fact that akka cluster does not perform 
> vector clock pruning, and I have nodes constantly joining and leaving? If so, 
> it's strange that the cluster can keep functioning despite what may be failed 
> gossip sends?
> 
> I don't think this is anything at the application-level, the messages sent 
> using selections are quite small.
> -- 
> >> 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.

-- 
>>  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.


Re: [akka-user] Testing PersistentActor, receiveCommand is never called (Akka 2.3.4)

2014-07-20 Thread Konrad Malawski
Hi Yann,
TestActorRef is not compatible with Akka persistence. We discussed this in
this issue here: https://github.com/akka/akka/issues/15293

Please use traditional testing style with persistence (as in expect
messages etc).

-- 
Konrad 'ktoso' Malawski
(Sent from my phone)
On 20 Jul 2014 15:23, "Yann Le Moigne"  wrote:

> Hi,
>
> I'm trying to test a persistent actor
>
> class ServerManager extends PersistentActor {
>   override def persistenceId = "ServerManager"
>
>   override def receiveRecover: Receive = { case _ => }
>
>   override def receiveCommand: Receive = {
> case Commands.Server.Watch(address) =>
>   persist(Events.Server.WatchCreated(address)) { event =>
>   context.actorOf(Props(classOf[ServerMonitor], event.address),
> event.address)
> }
> case Commands.Server.Unwatch(address) =>
>   for(child <- context.child(address)) context.stop(child)
>   }
> }
>
>
> My test class looks like this :
>
> class ServerManagerTest(_system: ActorSystem) extends TestKit(_system)
> with ImplicitSender with WordSpecLike with Matchers with BeforeAndAfterAll {
>   def this() = this(
> ActorSystem("TestActorSystem", ConfigFactory.parseString(
>   """
> |akka.loglevel = "DEBUG"
> |akka.persistence.journal.plugin = "in-memory-journal"
> |akka.actor.debug {
> |   receive = on
> |   autoreceive = on
> |   lifecycle = on
> |}
>   """.stripMargin))
>   )
>
>   override def afterAll() {
> TestKit.shutdownActorSystem(system)
>   }
>
>   trait ServerManagerFixture {
> val actorRef = TestActorRef[ServerManager]
>   }
>
>   "A ServerManager" when {
>   val address = "192.168.1.1"
>   val cmd = Commands.Server.Watch(address)
>
>   s"received '$cmd'" should {
> s"have one child named '$address'" in new ServerManagerFixture {
>   actorRef ! cmd
>
>   assert(actorRef.underlyingActor.context.children.size === 1)
>   assert(actorRef.underlyingActor.context.child(address).isDefined)
> }
>   }
> }
> }
>
> I put break point on receiveCommand and running test, but it's never
> called.
> I've checked
> https://github.com/akka/akka/blob/master/akka-persistence/src/test/scala/akka/persistence/PersistentActorSpec.scala
> ; but I can't find what i'm missing.
> If anyone can help : Thanks.
>
> --
> >> 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.
>

-- 
>>  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: Testing PersistentActor, receiveCommand is never called (Akka 2.3.4)

2014-07-20 Thread Yann Le Moigne
Ok, I find "why" :
Removing the testFixture fixed the problem.

Le dimanche 20 juillet 2014 15:21:51 UTC+2, Yann Le Moigne a écrit :
>
> Hi,
>
> I'm trying to test a persistent actor
>
> class ServerManager extends PersistentActor {
>   override def persistenceId = "ServerManager"
>
>   override def receiveRecover: Receive = { case _ => }
>
>   override def receiveCommand: Receive = {
> case Commands.Server.Watch(address) =>
>   persist(Events.Server.WatchCreated(address)) { event =>
>   context.actorOf(Props(classOf[ServerMonitor], event.address), 
> event.address)
> }
> case Commands.Server.Unwatch(address) =>
>   for(child <- context.child(address)) context.stop(child)
>   }
> }
>
>
> My test class looks like this :
>
> class ServerManagerTest(_system: ActorSystem) extends TestKit(_system) 
> with ImplicitSender with WordSpecLike with Matchers with BeforeAndAfterAll {
>   def this() = this(
> ActorSystem("TestActorSystem", ConfigFactory.parseString(
>   """
> |akka.loglevel = "DEBUG"
> |akka.persistence.journal.plugin = "in-memory-journal"
> |akka.actor.debug {
> |   receive = on
> |   autoreceive = on
> |   lifecycle = on
> |}
>   """.stripMargin))
>   )
>
>   override def afterAll() {
> TestKit.shutdownActorSystem(system)
>   }
>
>   trait ServerManagerFixture {
> val actorRef = TestActorRef[ServerManager]
>   }
>
>   "A ServerManager" when {
>   val address = "192.168.1.1"
>   val cmd = Commands.Server.Watch(address)
>
>   s"received '$cmd'" should {
> s"have one child named '$address'" in new ServerManagerFixture {
>   actorRef ! cmd
>
>   assert(actorRef.underlyingActor.context.children.size === 1)
>   assert(actorRef.underlyingActor.context.child(address).isDefined)
> }
>   }
> }
> }
>
> I put break point on receiveCommand and running test, but it's never 
> called. 
> I've checked 
> https://github.com/akka/akka/blob/master/akka-persistence/src/test/scala/akka/persistence/PersistentActorSpec.scala
>  
> ; but I can't find what i'm missing.
> If anyone can help : Thanks.
>

-- 
>>  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] Testing PersistentActor, receiveCommand is never called (Akka 2.3.4)

2014-07-20 Thread Yann Le Moigne
Hi,

I'm trying to test a persistent actor

class ServerManager extends PersistentActor {
  override def persistenceId = "ServerManager"

  override def receiveRecover: Receive = { case _ => }

  override def receiveCommand: Receive = {
case Commands.Server.Watch(address) =>
  persist(Events.Server.WatchCreated(address)) { event =>
  context.actorOf(Props(classOf[ServerMonitor], event.address), 
event.address)
}
case Commands.Server.Unwatch(address) =>
  for(child <- context.child(address)) context.stop(child)
  }
}


My test class looks like this :

class ServerManagerTest(_system: ActorSystem) extends TestKit(_system) with 
ImplicitSender with WordSpecLike with Matchers with BeforeAndAfterAll {
  def this() = this(
ActorSystem("TestActorSystem", ConfigFactory.parseString(
  """
|akka.loglevel = "DEBUG"
|akka.persistence.journal.plugin = "in-memory-journal"
|akka.actor.debug {
|   receive = on
|   autoreceive = on
|   lifecycle = on
|}
  """.stripMargin))
  )

  override def afterAll() {
TestKit.shutdownActorSystem(system)
  }

  trait ServerManagerFixture {
val actorRef = TestActorRef[ServerManager]
  }

  "A ServerManager" when {
  val address = "192.168.1.1"
  val cmd = Commands.Server.Watch(address)

  s"received '$cmd'" should {
s"have one child named '$address'" in new ServerManagerFixture {
  actorRef ! cmd

  assert(actorRef.underlyingActor.context.children.size === 1)
  assert(actorRef.underlyingActor.context.child(address).isDefined)
}
  }
}
}

I put break point on receiveCommand and running test, but it's never 
called. 
I've 
checked 
https://github.com/akka/akka/blob/master/akka-persistence/src/test/scala/akka/persistence/PersistentActorSpec.scala
 
; but I can't find what i'm missing.
If anyone can help : Thanks.

-- 
>>  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.


Re: [akka-user] Why does akka-persistence not provide an API to read a specific entry from a journal?

2014-07-20 Thread Roland Kuhn
Hi Moiz,

20 jul 2014 kl. 00:28 skrev Moiz Raja :

> Ronald and Konrad. Firstly thanks for your responses.

(I’m Roland, BTW ;-) )

> So, as it so happens I do want my actor to be persistent in the sense that I 
> do want to be able to shutdown my actor, restart it and have it back to the 
> state it was in before it was shutdown. akka-persistence is a great fit for 
> that. Now I want the state of this actor to also be replicated for HA 
> purposes so that when my actor cannot start up or I cannot connect to it I 
> should be able to connect to a replica and keep going. This is where raft 
> comes in.

Why should RAFT come in here? What you describe is exactly the purpose of Akka 
Persistence, the idea is to use a replicated journal that ensures that the 
actor can be resurrected anywhere in the cluster in case of a node failure. The 
journal implementation might use RAFT (or whichever consensus protocol it 
chooses) under the covers, but that should be transparent to the actor itself.

Thinking about your problem description there is one potential issue that I can 
see: a replicated log for Akka Persistence is supposed to be consistent. If 
this characteristic does not fit your requirements (i.e. you actually need to 
tolerate inconsistency in order to achieve the availability you need) then you 
would indeed need to step outside the normal bounds of Persistence; I would 
recommend thinking in terms of the Journal SPI layer first, though, and 
investigate whether there are replicated log implementations that give you what 
you want. The only extension you need is that the log can tell you when to 
spawn that actor on which system (based on availability estimators—we are 
talking machines taking guesses here).

But the previous paragraph clearly is for rather specialized use-cases only, a 
normal replicated journal should be the answer in almost all cases—that means 
until proven otherwise for your case.

Regards,

Roland

> The only thing frankly which was stopping me from using akka-persistence was 
> the fact that I could not read entries in the log directly. I have a 
> workaround for that and I think it may work for me. Basically here is how it 
> works - besides persisting the log onto disk with akka-persistence I also 
> maintain the log in-memory. The in-memory log is trimmed when I create a 
> snapshot. Since akka-persistence creates a snapshot of the whole journal and 
> not upto a specific journal entry my snapshot consists both of the state of 
> the actor and all the "unapplied entries" from the log. The in-memory log 
> after a snapshot is created is therefore only the entries which were not 
> applied to the state. 
> 
> This workaround of mine will use more memory certainly but overall I think it 
> may not be bad as it does make reading log entries faster.
> 
> Let me know if you have concerns about my approach.
> 
> Thanks,
> -Moiz
> 
> -- 
> >> 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.



Dr. Roland Kuhn
Akka Tech Lead
Typesafe – Reactive apps on the JVM.
twitter: @rolandkuhn


-- 
>>  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.