[akka-user] updating persistent store to different plugin
If I've got a persistence store using one particular persistence plugin and I want to change to another, what would I have to do? I can see I could run a utility program that opened the old store and sent the messages to another processor to persist them, but can I run with 2 different plugins at the same time? And what if I want to serialise differently in the second store? -- 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: stopping actor doesn't remove sharding entry
Hi Eduardo, Just to add more information, since the persistence support for sharding allows persisted entries to be passivated (the actor is stopped to save memory, but is restored from disk when needed) in which case the ShardRegion - shardId association still needs to be maintained although no actors might be running in that shard. In fact this table is persisted by the ShardCoordinator so if the node hosting it fails it can be reliably restored in a new node. -Endre On Thu, Jul 24, 2014 at 12:42 AM, Eduardo Fernandes edu...@gmail.com wrote: Ok. Entries are managed as expected. After looking at the code I understand what you mean. Thanks a lot for your help. Regards. El miércoles, 23 de julio de 2014 15:41:00 UTC+2, Eduardo Fernandes escribió: Many thanks for your help Endre. Completely understood from shard perspective. I'll check if the entry disappear if the actor is stopped (which is not the case for the sharding). Regards. -- 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 Team Typesafe - The software stack for applications that scale Blog: letitcrash.com 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 http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.
Re: [akka-user] Re: Akka Actor Per Request Java Sample
Hi John, My question is this. - In a front end actor is the sending of a message as simple as attaining a reference (in frontend actor onreceive) to the backend actor via an ActorRef and then sending a message to the backend actor? Yes, once you have the ActorRef of an actor you can send a message to it: ref ! msg ... and it looks like the same whether ref is remote or not (although you need to enable remoting to be able to communicate with remote actors, but that does not change the way you send messages). -Endre Thanks, John On Tuesday, July 22, 2014 4:16:09 AM UTC-4, Akka Team wrote: Hi John, I was looking to know how to write an actor per request. I want to understand this pattern so I could create a sample similar to the one at https://github.com/muuki88/activator-play-cluster-sample that creates a frontend for an akka cluster in Java. I'm struggling with how to have a frontend actor send a send a message to an akka cluster. At this point hearing how this would be implemented would be great so I could write this in simple form even using a basic Java console application just to understand the basics of to have a frontend send a message to an akka cluster. We need a bit more information about what you want to achieve. Sending a message from an actor to another actor (irregardless whether it is in a cluster or not) is just like an ordinary message send. Is your problem how to aquire remote ActorRefs from the cluster? Btw, you can have your frontend be part of the cluster and use simply a cluster-aware router if you have a worker pool for example. You can use cluster sharding if you need persistent stateful entities maintained in the cluster. There are many ways to interact with clustered actor systems. In fact, all that core clustering does is maintaining membership information, all the others are just patterns on top of this, using remoting to send messages to remote actors. You can look at the list of activator templates, maybe you find something that fits your need: http://akka.io/downloads/ In particular http://typesafe.com/activator/template/akka-distributed- workers-java?_ga=1.42689506.61833477.1364484269 might be interesting for you. -Endre Thanks, John On Sunday, July 20, 2014 12:20:45 PM UTC-4, Konrad Malawski wrote: 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-por ter.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+...@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. -- Akka Team Typesafe - The software stack for applications that scale Blog: letitcrash.com 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 http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout. -- Akka Team Typesafe - The software stack for applications that scale Blog: letitcrash.com 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 http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.
Re: [akka-user] Side effect stream combinator
Alternatively, if what you want is really to produce the input elements (returning a Flow[T]) and only add a side-effecting operation, you can implement it using `map`. Daniel Armak On Thu, Jul 24, 2014 at 11:35 AM, Akka Team akka.offic...@gmail.com wrote: Hi Eric, There is a foreach method that does exactly that. It gives you back a Flow[Unit] which will produce exactly one element at the end of the processing (so you can easily convert it to a Future[Unit] for example). Is this covering what you need? -Endre On Thu, Jul 24, 2014 at 3:12 AM, Eric Pederson eric...@gmail.com wrote: Correction def doOnEach(f: T = Unit): Flow[T] -- Eric On Wed, Jul 23, 2014 at 9:10 PM, Eric Pederson eric...@gmail.com wrote: Hi guys: Something that would be useful is a side effecting combinator. For example, like doOnEach from RxJava. This would be particularly useful in the actor world to insert an actor tell into the flow. def doOnEach(f: = Unit): Flow[T] For example: flow.doOnEach { msg = if (msg.isSomething) actor ! msg }.map()... This can be done with a Transformer but it's not really transforming. Will there be a way to create Flow subtypes so that people can invent their own combinators? 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 a topic in the Google Groups Akka User List group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/akka-user/qWrA1sqBqiM/unsubscribe. To unsubscribe from this group and all its topics, 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 Team Typesafe - The software stack for applications that scale Blog: letitcrash.com 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 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] new to java akka
Hi, I am new to java akka model. For your information, i have a java akka program running in eclipse. Unfortunately, i cannot run the sample program. They is not error message but what i receive is you need to provide exactly one argument: the class of the application supervisor actor. Can anyone help on this issue? 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] Side effect stream combinator
WARNING: Not compiled implicit final class DoToEach[T](flow: Flow[T]) extends AnyVal { def doOnEach(f: T = Unit): Flow[T] = flow.map(t = { f(t); t }) } flow.map(...).doOnEach(println).filter(...) On Thu, Jul 24, 2014 at 10:59 AM, Daniel Armak danar...@gmail.com wrote: Alternatively, if what you want is really to produce the input elements (returning a Flow[T]) and only add a side-effecting operation, you can implement it using `map`. Daniel Armak On Thu, Jul 24, 2014 at 11:35 AM, Akka Team akka.offic...@gmail.com wrote: Hi Eric, There is a foreach method that does exactly that. It gives you back a Flow[Unit] which will produce exactly one element at the end of the processing (so you can easily convert it to a Future[Unit] for example). Is this covering what you need? -Endre On Thu, Jul 24, 2014 at 3:12 AM, Eric Pederson eric...@gmail.com wrote: Correction def doOnEach(f: T = Unit): Flow[T] -- Eric On Wed, Jul 23, 2014 at 9:10 PM, Eric Pederson eric...@gmail.com wrote: Hi guys: Something that would be useful is a side effecting combinator. For example, like doOnEach from RxJava. This would be particularly useful in the actor world to insert an actor tell into the flow. def doOnEach(f: = Unit): Flow[T] For example: flow.doOnEach { msg = if (msg.isSomething) actor ! msg }.map()... This can be done with a Transformer but it's not really transforming. Will there be a way to create Flow subtypes so that people can invent their own combinators? 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 a topic in the Google Groups Akka User List group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/akka-user/qWrA1sqBqiM/unsubscribe. To unsubscribe from this group and all its topics, 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 Team Typesafe - The software stack for applications that scale Blog: letitcrash.com 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 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. -- Cheers, √ -- 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] updating persistent store to different plugin
If I've got a persistence store using one particular persistence plugin and I want to change to another, what would I have to do? I can see I could run a utility program that opened the old store and sent the messages to another processor to persist them, but can I run with 2 different plugins at the same time? Currently you cannot have 2 journals in 1 actor system. You’d have to run 2 actor systems (can be the same jvm) and configure them differently. We are prepared in the current sources to extend this, so each actor could get it’s own journal implementation (grep for `journalFor` if curious), so we’ll get to it at some point :-) I noticed we don’t have a ticket for it currently, would you mind opening one? https://github.com/akka/akka/issues?direction=desclabels=t%3Apersistencepage=1sort=updatedstate=open Thanks in advance! And what if I want to serialise differently in the second store? In the above example you have 2 systems, so it’s easy. Currently serialisation is configured per actor system too, so this is an open question for a time when we implement multiple journals in one actor system - only then this problem will appear. Thanks for the feedback! -- 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] Akka cluster: stopping actor doesn't remove sharding entry
Yes, we are using passivation. Tx. There is a way of retrieve the entries id's from the shardings? There is a member called entries in the sharding region class but I don't know if I have access to it. Tx again. El 24/07/2014, a las 10:19, Akka Team akka.offic...@gmail.com escribió: Hi Eduardo, Just to add more information, since the persistence support for sharding allows persisted entries to be passivated (the actor is stopped to save memory, but is restored from disk when needed) in which case the ShardRegion - shardId association still needs to be maintained although no actors might be running in that shard. In fact this table is persisted by the ShardCoordinator so if the node hosting it fails it can be reliably restored in a new node. -Endre On Thu, Jul 24, 2014 at 12:42 AM, Eduardo Fernandes edu...@gmail.com wrote: Ok. Entries are managed as expected. After looking at the code I understand what you mean. Thanks a lot for your help. Regards. El miércoles, 23 de julio de 2014 15:41:00 UTC+2, Eduardo Fernandes escribió: Many thanks for your help Endre. Completely understood from shard perspective. I'll check if the entry disappear if the actor is stopped (which is not the case for the sharding). Regards. -- 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 Team Typesafe - The software stack for applications that scale Blog: letitcrash.com 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 a topic in the Google Groups Akka User List group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/akka-user/ravs9P4Nz7A/unsubscribe. To unsubscribe from this group and all its topics, 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] Best practices using Akka Persistence with long-running projects?
I had a reply prepped yesterday but lost the draft (argh offline editing!). Back to the topic though: First of all, thank you very much for the elaborate reply. I guess I'll get hacking away at some prototypes soon and so some performance testing close to our use-case. Looking forward to it, too :-) Great to hear, let us know about your findings please :-) So what you suggest is that the serializer first deserializes a stored event forgivingly, without throwing an exception for for example dropping removed field and initializing new fields with 0/null/default values, and then I compare the version and apply additional conversion logic? Or do you mean something more complex like storing a dehydrated version of the event and re-hydrating it every time an event is loaded from storage, promoting it to the latest version in this process? This very much depends on what serialiser you use, because they inherently support some kind of schema evolution. I’ve been mostly using protocol buffers in my career. There, what you do is: mostly use optional fields so these can be null, and you have to be prepped for this anyway. And then you can reserve some space for extensions, using that you’re able to apply this trick: http://www.indelible.org/ink/protobuf-polymorphism/ Because of how proto works, renames are safe for example - because it’s not using the name in the binary format, but the ID. etc etc… This should give you a feel how “bound” your evolution strategies will become to the serialisation format. Other basic tips are nicely summarised here: http://martin.kleppmann.com/2012/12/05/schema-evolution-in-avro-protocol-buffers-thrift.html Again though, dig deeper into the details of each serialisation format before you decide to go for it (we don’t really have a “use that one” opinion on this). Other serialisation formats, such as Simple Binary Encoding (designed to be low latency envs - check benchmarks) support this via keeping version numbers in the message header: https://github.com/real-logic/simple-binary-encoding/wiki/Message-Versioning In essence - version number = some number of extension fields, you cannot delete fields in this one. One other format I’d like to point to here is Cap n’ Proto (same author as original protobufs AFAIK), and their description on this (as it’s listing it up quite nicely what is safe and what is not): http://kentonv.github.io/capnproto/language.html#evolving_your_protocol Summing up… These strategies allow you to change your events and stay compatible with the same type - to still be able to deserialise. If you however at some point make some huge change, and need to get events B but you have events A serialised, or you need to add additional data you can add another layer that would promote A events to B events, and then emit them to the actor. This gets more complicated, but the point is - you’re not doomed even if you have to do bigger changes (try to avoid this ofc ;-)). I know I’ve just grown your to-read list by quite a bit, but I hope this helps! :-) -- 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] Akka cluster: stopping actor doesn't remove sharding entry
Quite clear Endre, as always. Many thanks again for your time! Best regards from Spain. On Thu, Jul 24, 2014 at 12:59 PM, Akka Team akka.offic...@gmail.com wrote: Hi Eduardo, There is no explicit table maintained for individual entries. Sharding maintains the table what ShardRegions are responsible for what ShardIds, but we don't have a list of all entities inside the ShardId -- since these relationships can be calculated by the IdExtractor and ShardResolver functions. I.e. if you want to send a message to a specific ID: - the shard ID is calculated using the ShardResolver function - using the internal tables we find out which ShardRegion hosts that ShardId - the message is forwarded to that ShardRegion - the ShardRegion forwards the message to the actor corresponding to the given Id (reactivating from disk if needed). This step does not need any tables -Endre -Endre On Thu, Jul 24, 2014 at 11:27 AM, Eduardo Fernandes edu...@gmail.com wrote: Yes, we are using passivation. Tx. There is a way of retrieve the entries id's from the shardings? There is a member called entries in the sharding region class but I don't know if I have access to it. Tx again. El 24/07/2014, a las 10:19, Akka Team akka.offic...@gmail.com escribió: Hi Eduardo, Just to add more information, since the persistence support for sharding allows persisted entries to be passivated (the actor is stopped to save memory, but is restored from disk when needed) in which case the ShardRegion - shardId association still needs to be maintained although no actors might be running in that shard. In fact this table is persisted by the ShardCoordinator so if the node hosting it fails it can be reliably restored in a new node. -Endre On Thu, Jul 24, 2014 at 12:42 AM, Eduardo Fernandes edu...@gmail.com wrote: Ok. Entries are managed as expected. After looking at the code I understand what you mean. Thanks a lot for your help. Regards. El miércoles, 23 de julio de 2014 15:41:00 UTC+2, Eduardo Fernandes escribió: Many thanks for your help Endre. Completely understood from shard perspective. I'll check if the entry disappear if the actor is stopped (which is not the case for the sharding). Regards. -- 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 Team Typesafe - The software stack for applications that scale Blog: letitcrash.com 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 a topic in the Google Groups Akka User List group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/akka-user/ravs9P4Nz7A/unsubscribe. To unsubscribe from this group and all its topics, 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 Team Typesafe - The software stack for applications that scale Blog: letitcrash.com 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 a topic in the Google Groups Akka User List group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/akka-user/ravs9P4Nz7A/unsubscribe. To unsubscribe from this group and all its topics, send an email to akka-user+unsubscr...@googlegroups.com. To post to this group, send email to
Re: [akka-user] Side effect stream combinator
Ah yes - pimp my flow! And map works fine, definitely better than Transformer. Thanks guys! -- Eric On Thu, Jul 24, 2014 at 5:07 AM, √iktor Ҡlang viktor.kl...@gmail.com wrote: WARNING: Not compiled implicit final class DoToEach[T](flow: Flow[T]) extends AnyVal { def doOnEach(f: T = Unit): Flow[T] = flow.map(t = { f(t); t }) } flow.map(...).doOnEach(println).filter(...) On Thu, Jul 24, 2014 at 10:59 AM, Daniel Armak danar...@gmail.com wrote: Alternatively, if what you want is really to produce the input elements (returning a Flow[T]) and only add a side-effecting operation, you can implement it using `map`. Daniel Armak On Thu, Jul 24, 2014 at 11:35 AM, Akka Team akka.offic...@gmail.com wrote: Hi Eric, There is a foreach method that does exactly that. It gives you back a Flow[Unit] which will produce exactly one element at the end of the processing (so you can easily convert it to a Future[Unit] for example). Is this covering what you need? -Endre On Thu, Jul 24, 2014 at 3:12 AM, Eric Pederson eric...@gmail.com wrote: Correction def doOnEach(f: T = Unit): Flow[T] -- Eric On Wed, Jul 23, 2014 at 9:10 PM, Eric Pederson eric...@gmail.com wrote: Hi guys: Something that would be useful is a side effecting combinator. For example, like doOnEach from RxJava. This would be particularly useful in the actor world to insert an actor tell into the flow. def doOnEach(f: = Unit): Flow[T] For example: flow.doOnEach { msg = if (msg.isSomething) actor ! msg }.map()... This can be done with a Transformer but it's not really transforming. Will there be a way to create Flow subtypes so that people can invent their own combinators? 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 a topic in the Google Groups Akka User List group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/akka-user/qWrA1sqBqiM/unsubscribe. To unsubscribe from this group and all its topics, 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 Team Typesafe - The software stack for applications that scale Blog: letitcrash.com 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 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. -- Cheers, √ -- 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 a topic in the Google Groups Akka User List group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/akka-user/qWrA1sqBqiM/unsubscribe. To unsubscribe from this group and all its topics, 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
[akka-user] Akka LoggingReceive and stackable traits - strange behaviour
Hello Inspired by the presentation http://www.slideshare.net/EvanChan2/akka-inproductionpnw-scala2013 I wanted to introduce stackable traits pattern to my Akka application. For now I wanted to add logging of messages using LoggingReceive and basic tracing with akka-tracing. Following the presentation I created: trait ActorStack extends Actor { def wrappedReceive: Receive def receive: Receive = { case x = if (wrappedReceive.isDefinedAt(x)) wrappedReceive(x) else unhandled(x) } } and two traits: trait LoggingReceiveActor extends ActorStack { override def receive: Receive = LoggingReceive { case x = { println(+++ + x) // added for debugging super.receive(x) } } } trait StackableActorTracing extends ActorStack with ActorTracing { var currentMessage: Traced[Any] = Traced(tracing turned off) override def receive: Receive = { case msg @ Traced(inner) = { trace.sample(msg, this.getClass.getSimpleName) currentMessage = msg super.receive(inner) } case msg = { currentMessage = Traced(tracing turned off) super.receive(msg) } } def msg = { currentMessage } } also I created one utility trait that gathers those two traits: trait BaseActor extends ActorStack with ActorLogging with LoggingReceiveActor with StackableActorTracing Now when I take my example actor: class RotationService(rotationRepository: ActorRef) extends BaseActor with DefaultAskTimeout { implicit val dispatcher = context.dispatcher def wrappedReceive: Receive = { case createCommand @ CreateRotation() = { ... } When I execute unit test that sends *CreateRotation *message to *RotationService *actor I am getting: Testing started at 3:41 PM ... Connected to the target VM, address: '127.0.0.1:51978', transport: 'socket' 15:41:36.520 [TestActorSystem-9dc08bc090f2416bbf369947fd64908b-akka.actor.default-dispatcher-2] INFO akka.event.slf4j.Slf4jLogger - Slf4jLogger started 15:41:36.565 [TestActorSystem-9dc08bc090f2416bbf369947fd64908b-akka.actor.default-dispatcher-2] DEBUG akka.event.EventStream - logger log1-Slf4jLogger started 15:41:36.584 [TestActorSystem-9dc08bc090f2416bbf369947fd64908b-akka.actor.default-dispatcher-2] DEBUG akka.event.EventStream - Default Loggers started 15:41:36.586 [TestActorSystem-9dc08bc090f2416bbf369947fd64908b-akka.actor.default-dispatcher-2] DEBUG a.a.LocalActorRefProvider$SystemGuardian - now supervising Actor[akka://TestActorSystem-9dc08bc090f2416bbf369947fd64908b/system/deadLetterListener#-162762200] 15:41:36.588 [TestActorSystem-9dc08bc090f2416bbf369947fd64908b-akka.actor.default-dispatcher-2] DEBUG akka.event.DeadLetterListener - started (akka.event.DeadLetterListener@2025eae4) 15:41:36.627 [TestActorSystem-9dc08bc090f2416bbf369947fd64908b-akka.actor.default-dispatcher-5] INFO kamon.statsd.StatsDExtension - Starting the Kamon(StatsD) extension 15:41:36.652 [TestActorSystem-9dc08bc090f2416bbf369947fd64908b-akka.actor.default-dispatcher-5] DEBUG a.a.LocalActorRefProvider$Guardian - now supervising Actor[akka://TestActorSystem-9dc08bc090f2416bbf369947fd64908b/user/statsd-metrics-sender#-609019730] 15:41:36.688 [TestActorSystem-9dc08bc090f2416bbf369947fd64908b-akka.actor.default-dispatcher-4] DEBUG a.a.LocalActorRefProvider$SystemGuardian - now supervising Actor[akka://TestActorSystem-9dc08bc090f2416bbf369947fd64908b/system/IO-UDP-FF#221802495] 15:41:36.707 [TestActorSystem-9dc08bc090f2416bbf369947fd64908b-akka.actor.default-dispatcher-3] DEBUG kamon.statsd.StatsDMetricsSender - started (kamon.statsd.StatsDMetricsSender@1f06d526) 15:41:36.747 [TestActorSystem-9dc08bc090f2416bbf369947fd64908b-akka.actor.default-dispatcher-4] DEBUG a.a.LocalActorRefProvider$Guardian - now supervising Actor[akka://TestActorSystem-9dc08bc090f2416bbf369947fd64908b/user/kamon-metrics-subscriptions#-992962374] 15:41:36.770 [TestActorSystem-9dc08bc090f2416bbf369947fd64908b-akka.actor.default-dispatcher-4] DEBUG kamon.metrics.Subscriptions - started (kamon.metrics.Subscriptions@6680693) 15:41:36.778 [TestActorSystem-9dc08bc090f2416bbf369947fd64908b-akka.actor.default-dispatcher-4] DEBUG akka.routing.RouterPoolActor - started (akka.routing.RouterPoolActor@66ee2542) 15:41:36.779 [TestActorSystem-9dc08bc090f2416bbf369947fd64908b-akka.actor.default-dispatcher-4] DEBUG akka.routing.RouterPoolActor - now supervising Actor[akka://TestActorSystem-9dc08bc090f2416bbf369947fd64908b/system/IO-UDP-FF/selectors/$a#-483988336] 15:41:36.787 [TestActorSystem-9dc08bc090f2416bbf369947fd64908b-akka.actor.default-dispatcher-3] DEBUG akka.io.UdpManager - started (akka.io.UdpManager@4fb22e7b) 15:41:36.792 [TestActorSystem-9dc08bc090f2416bbf369947fd64908b-akka.actor.default-dispatcher-3] DEBUG akka.io.UdpManager - now supervising Actor[akka://TestActorSystem-9dc08bc090f2416bbf369947fd64908b/system/IO-UDP-FF/selectors#1030403184] 15:41:36.931
Re: [akka-user] PersistentActor and FSM
Hello Rich, it is currently not possible to use FSM with PersistentActor. We would like to provide this at some point (FSMs are certainly pretty and useful), here’s the issue tracking this feature: https://github.com/akka/akka/issues/15279 You’re welcome to either help us out in this one or just +1 it, so we know the “force (demand) is strong in this one” :-) Some background: The PersistentActor is mostly what was previously known as EventsourcedProcessor. We never got to implementing FSM for it, as the receive mechanisms get pretty complicated in it. Currently you can achieve a very similar thing with plain old Actor become(otherState), like here: http://doc.akka.io/docs/akka/snapshot/scala/actors.html#become-unbecome Hope this helps! -- 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] Re: Akka Actor Per Request Java Sample
HI Endre, Thanks again for the info. Just to confirm this sample on akka activator appears to be a frontend/backend sample that I have been looking for: akka-sample-cluster-java I have some feedback below. //#frontend public class FactorialFrontend extends UntypedActor { final int upToN; final boolean repeat; LoggingAdapter log = Logging.getLogger(getContext().system(), this); // Here a reference to the backend actor is created ActorRef backend = getContext().actorOf(FromConfig.getInstance().props(), factorialBackendRouter); public FactorialFrontend(int upToN, boolean repeat) { this.upToN = upToN; this.repeat = repeat; } @Override public void preStart() { sendJobs(); getContext().setReceiveTimeout(Duration.create(10, TimeUnit.SECONDS)); } @Override public void onReceive(Object message) { if (message instanceof FactorialResult) { FactorialResult result = (FactorialResult) message; if (result.n == upToN) { log.debug({}! = {}, result.n, result.factorial); if (repeat) sendJobs(); else getContext().stop(getSelf()); } } else if (message instanceof ReceiveTimeout) { log.info(Timeout); sendJobs(); } else { unhandled(message); } } void sendJobs() { log.info(Starting batch of factorials up to [{}], upToN); for (int n = 1; n = upToN; n++) { // here a message is sent to akka via tell in fire and forget fashion backend.tell(n, getSelf()); } } Endre On Thursday, July 24, 2014 4:43:21 AM UTC-4, Akka Team wrote: Hi John, My question is this. - In a front end actor is the sending of a message as simple as attaining a reference (in frontend actor onreceive) to the backend actor via an ActorRef and then sending a message to the backend actor? Yes, once you have the ActorRef of an actor you can send a message to it: ref ! msg ... and it looks like the same whether ref is remote or not (although you need to enable remoting to be able to communicate with remote actors, but that does not change the way you send messages). -Endre Thanks, John On Tuesday, July 22, 2014 4:16:09 AM UTC-4, Akka Team wrote: Hi John, I was looking to know how to write an actor per request. I want to understand this pattern so I could create a sample similar to the one at https://github.com/muuki88/activator-play-cluster-sample that creates a frontend for an akka cluster in Java. I'm struggling with how to have a frontend actor send a send a message to an akka cluster. At this point hearing how this would be implemented would be great so I could write this in simple form even using a basic Java console application just to understand the basics of to have a frontend send a message to an akka cluster. We need a bit more information about what you want to achieve. Sending a message from an actor to another actor (irregardless whether it is in a cluster or not) is just like an ordinary message send. Is your problem how to aquire remote ActorRefs from the cluster? Btw, you can have your frontend be part of the cluster and use simply a cluster-aware router if you have a worker pool for example. You can use cluster sharding if you need persistent stateful entities maintained in the cluster. There are many ways to interact with clustered actor systems. In fact, all that core clustering does is maintaining membership information, all the others are just patterns on top of this, using remoting to send messages to remote actors. You can look at the list of activator templates, maybe you find something that fits your need: http://akka.io/downloads/ In particular http://typesafe.com/activator/template/akka-distributed- workers-java?_ga=1.42689506.61833477.1364484269 might be interesting for you. -Endre Thanks, John On Sunday, July 20, 2014 12:20:45 PM UTC-4, Konrad Malawski wrote: 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-por ter.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+...@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