[akka-user] Timing of eventsByTag() and persist()

2016-11-15 Thread Richard Rodseth
We are seeing some baffling behaviour in a unit test (using
akka-persistence-inmemory).

The test starts actor A and actor B (which starts a stream using
eventsByTag in its
RecoveryCompleted handler).
The test then sends commands to actor A, which results in appropriately
tagged events being persisted.

Without going into all details, the assertion is based on a receiveN on a
probe.

What we see is that some elements at the beginning of the stream get missed
and the assertion fails.

We can make it pass by sending a message to actor A immediately after
starting it, or by putting a Thread.sleep at that point.

To add to the mystery, the test passes when run on its own, but fails when
run with others. That made us suspect issues with
akka-persistence-inmemory, but we do take steps to clean up the event
store, and logging of the stream elements persuaded us that was not the
issue.

-- 
>>  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 https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


[akka-user] Using "Distributed Data" for caching Tokens. Delete by value with LMWMap possible?

2016-11-15 Thread Qux
Hello,

I'm using Distributed Data for caching Authorization-Tokens:

private final Key dataKey = LWWMapKey.create("cache"); // 
token -> CustomerId


When the password of a customer is changed, all Tokens for this Customer be 
removed. How is this possible, or is it even possible?

Thanks for your help!

Qux

-- 
>>  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 https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


Re: [akka-user] `ActorSystem.whenTerminated` hangs indefinitely if called from an `registerOnTermination` callback

2016-11-15 Thread Akka Team
Hi Chris,



On Tue, Nov 15, 2016 at 1:46 PM, oxbow_lakes  wrote:

> The following code:
>
> Welcome to Scala 2.12.0 (Java HotSpot(TM) 64-Bit Server VM, Java
> 1.8.0_112).
> Type in expressions for evaluation. Or try :help.
>
>
> scala> import akka.actor._; import scala.concurrent._; import duration._
> import akka.actor._
> import scala.concurrent._
> import duration._
>
> scala> :paste
> // Entering paste mode (ctrl-D to finish)
>
> val s = ActorSystem("test")
> def onTerm = {
>   println("Waiting...")
>   Await.result(s.whenTerminated, Duration.Inf)
>   println("Fin!")
> }
> s.registerOnTermination(onTerm)
>
> // Exiting paste mode, now interpreting.
>
> s: akka.actor.ActorSystem = akka://test
> onTerm: Unit
>
> scala> s.terminate
> res1: scala.concurrent.Future[akka.actor.Terminated] = Future( completed>)
>
> scala> Waiting...
>
>
> At this point the future doesn't terminate. Looking at the documentation
> of *whenTerminated*; "Returns a Future which will be completed after the
> ActorSystem has been terminated and termination hooks have been executed".
> It's probably a good idea to indicate on the *registerOnTermination*
> method that it's dangerous to wait on the whenTerminated future from the
> callback.
>

Can you please file a ticket, or even better a PR to fix the relevant docs?

-Endre



>
>
> Chris
>
> --
> >> 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 https://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Akka Team
Lightbend  - Reactive apps on the JVM
Twitter: @akkateam

-- 
>>  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 https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


[akka-user] `ActorSystem.whenTerminated` hangs indefinitely if called from an `registerOnTermination` callback

2016-11-15 Thread oxbow_lakes
The following code:

Welcome to Scala 2.12.0 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_112).
Type in expressions for evaluation. Or try :help.


scala> import akka.actor._; import scala.concurrent._; import duration._
import akka.actor._
import scala.concurrent._
import duration._

scala> :paste
// Entering paste mode (ctrl-D to finish)

val s = ActorSystem("test")
def onTerm = {
  println("Waiting...")
  Await.result(s.whenTerminated, Duration.Inf)
  println("Fin!")
}
s.registerOnTermination(onTerm)

// Exiting paste mode, now interpreting.

s: akka.actor.ActorSystem = akka://test
onTerm: Unit

scala> s.terminate
res1: scala.concurrent.Future[akka.actor.Terminated] = Future()

scala> Waiting...


At this point the future doesn't terminate. Looking at the documentation of 
*whenTerminated*; "Returns a Future which will be completed after the 
ActorSystem has been terminated and termination hooks have been executed". 
It's probably a good idea to indicate on the *registerOnTermination* method 
that it's dangerous to wait on the whenTerminated future from the callback.


Chris

-- 
>>  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 https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


[akka-user] Re: Akka cluster sharding messages default serialization

2016-11-15 Thread Leonard Ehrenfried
I'm going to answer my own question here.

It turns out that akka-cluster-sharding registers its own serializer which 
is based on protobuf. It's a bit hard to find because it's all private but 
here is it on 
Github: 
https://github.com/akka/akka/blob/master/akka-cluster-sharding/src/main/scala/akka/cluster/sharding/protobuf/ClusterShardingMessageSerializer.scala

I used this test to find out what the serializer 
is: https://gist.github.com/leonardehrenfried/99194ad1164049434d187a5b4068b008

On Tuesday, November 15, 2016 at 10:37:31 AM UTC+1, Leonard Ehrenfried 
wrote:
>
> Hello,
>
> we do event sourcing with akka-persistence and akka-cluster-sharding. 
> Apart from our own messages/events akka-cluster also writes a few messages 
> regarding shard allocation to our event log.
>
> We have configured a custom serializer for our own events which transforms 
> them to JSON but which format is chosen by default for the cluster messages 
> (we haven't added a configuration setting for events that aren't our own)?
>
> Is it protobuf oder java serialization? Or neither?
>
> Thanks for your help,
> Leonard
>

-- 
>>  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 https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


[akka-user] Akka cluster sharding messages default serialization

2016-11-15 Thread Leonard Ehrenfried
Hello,

we do event sourcing with akka-persistence and akka-cluster-sharding. Apart 
from our own messages/events akka-cluster also writes a few messages 
regarding shard allocation to our event log.

We have configured a custom serializer for our own events which transforms 
them to JSON but which format is chosen by default for the cluster messages 
(we haven't added a configuration setting for events that aren't our own)?

Is it protobuf oder java serialization? Or neither?

Thanks for your help,
Leonard

-- 
>>  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 https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.