Re: [akka-user] Re: [akka-persistence] Testing systems which have Persistence

2015-01-05 Thread Ian Holsman
Thanks for answering Anders, your answers were very helpful.

for #1 (starting in a known state). I was more asking how do I start
with a 'fresh/clean' journal with no history. I can manually remove
the files, but I was hoping there was something in the test-kit I
could do which will achieve this so I can do the tests in my IDE.



On Mon, Jan 5, 2015 at 6:55 AM, Anders Båtstrand  wrote:
> I have only been using Akka Persistence for a few months, but this is my
> suggestions:
>
> 1. I always start empty, but that is possibly not what you want. Maybe a
> file based storage, and you copy the files in place right before you start
> the Akka system?
>
> 2. I have solved the same problem by letting the parent actor be responsible
> for killing the children. That is: The child receives an event that it
> calculates should result in it's own destruction, and it then calls the
> parent, which then kills it (and updates a map over actors). In my case the
> parent is also delegating messages to the child, so this way I am sure not
> to send messages to any actor that is on the way down (that is, before the
> parent received the Terminated-message).
>
> 3. I am not sure i understood the question. I have CreateChild and KillChild
> events persistent from the parent actor. During recovery, it makes a map
> over actors it should create or not, and only creates then
> onRecoveryComplete. That way I do not create actors I would immediatly kill.
>
> Hope this was helpful!
>
> Best regards,
>
> Anders Båtstrand
>
> kl. 19:20:30 UTC+1 fredag 2. januar 2015 skrev Ian Holsman følgende:
>>
>> Hi.
>>
>> I'm building a 'toy' game that makes uses of akka-persistence, in order to
>> learn it.
>>
>> in a nutshell the game is 1000's of people/bots create villages, they act
>> independently of each other, and generally pass messages to each other to
>> chat/fight and all that good stuff.
>>
>> Where I am having problems are:
>>
>> 1. how do I initialize the persistence system at the start of testing so I
>> am in a 'known state' when I start.
>>
>> 2. how I assign IDs (persistanceId)  to actors.
>> Ideally I would use a map reference for while the villages exist, and be
>> able to re-use them if a new village is created. but the problem is it finds
>> the old village, and replays all the events (including the death event which
>> kills it).
>> I don't mind re-using a old actor, but i'd like to stop it (ie poisonpill)
>> when it isn't active.
>>
>> It seems like they need to be unique for the life of the system, and to do
>> so I would need a counter in place or GUIDs. but then I would need to keep
>> track of the Map reference/GUID mapping meaning my code would need to first
>> talk to the mapping holder, and then to the village itself (2 messages, 1
>> sync) which seems like non-ideal. (as opposed to context.actorselection("XYZ
>> map-reference") ! message which I guess is still 2 messages under the
>> covers, 1 sync too)
>>
>> 3. the recovery log only seems to 'start' when I bring up the actor.
>> Is there a way to know which actors are currently 'active' and just let
>> Akka start them all up, instead of me keeping a list/map of 'active'
>> villages, and manually restarting them.
>>
>>
>>
>> Thanks ..
>>
>> Ian.
>
> --
>>> 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.



-- 
Ian Holsman
i...@holsman.com.au
PH: + 61-3-9028 8133 / +1-(425) 998-7083

-- 
>>  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] Finding other actors

2015-01-05 Thread Ian Holsman
Thanks Patricks!
I try using the 'xxxManager' approach..

Regards
Ian

On Mon, Jan 5, 2015 at 11:00 AM, Patrick Mahoney  wrote:
> I have had some success instantiating and exposing ActorRef vals within an
> extension - http://doc.akka.io/docs/akka/snapshot/scala/extending-akka.html.
> This works well for actors that should be singletons within a given
> ActorSystem - you get this from extensions.
>
> -Patrick
>
> On 29 December 2014 at 16:19, Ian Holsman  wrote:
>>
>> Hi.
>>
>> I was wondering what the best practice was for finding a running
>> instance of an certain class of actor. (say 'bank account')
>>
>> Currently I have a BankAccountManager which creates a new bank
>> account, and uses a map to store my reference # with the actorRef.
>>
>> I then use a 'GetAccountById' message to lookup the actorRef  on the
>> BankAccountManager actor and pass it back to the caller. who then
>> interacts with the bank account. (which seems pretty Kludgy to me).
>>
>>
>> I recently came across the 'context.actorSelection' call, and was
>> wondering if I should be using this instead to find it, and if this is
>> the preferred way of dealing with finding actors.
>>
>> ie. never hold-on to ActorRefs, and just use actorSelection to find them.
>>
>> or is there a better pattern I should be using.
>>
>> Thanks!
>> Ian
>>
>>
>> --
>> Ian Holsman
>> i...@holsman.com.au
>> PH: + 61-3-9028 8133 / +1-(425) 998-7083
>>
>> --
>> >>  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.



-- 
Ian Holsman
i...@holsman.com.au
PH: + 61-3-9028 8133 / +1-(425) 998-7083

-- 
>>  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-http HttpService equivalent

2015-01-05 Thread Jacek Laskowski
Thanks, Konrad! That's helped a lot.

Jacek

On Sunday, January 4, 2015 4:58:29 PM UTC+1, Konrad Malawski wrote:
>
> Hi Jacek,
> As the name implies, japi is the *java api*, you’re not meant to be using 
> those if you’re using Scala - just use the normal scala APIs.
> The Scala Routing DSL cannot be reused directly by Java since it’s using 
> all kinds of Scala types which simlpy do not look as nice in Java.
> Akka HTTP (and Akka in general) aims to provide both languages with 
> equally awesome DSLs, thus if things do not look great in Java, they
> may require a separate DSL which in turn can Java-native types everywhere 
> etc. to make it feel “*right*” for a Java developer.
>
> For example Akka Streams also has two separate DSLs. This is in order to 
> maximise the user’s happieness when working with it from either Java or 
> Scala,
> we simply can apply “what a Scala/Java developer would expect here” and 
> provide the best possible DSL for each.
>
> The Java Routing DSL is in the works, some tests are here: 
> https://github.com/akka/akka/blob/release-2.3-dev/akka-http-java8-tests/src/test/java/akka/http/server/japi/HandlerBindingTest.java
> It’s looks a bit different than the Scala one, which is because Java is 
> not Scala and we’re unable to apply all the tricks we can apply in Scala 
> Land for the Java DSL.
>
> Please note that this is a major improvement over spray, since it never 
> had a Java DSL – with Akka HTTP even Java users will be able to use it :-)
>
> Cheers,
>
> -- 
> Konrad 'ktoso' Malawski
> hAkker @ typesafe
> http://akka.io
>
> On 4 January 2015 at 14:08:16, Jacek Laskowski (jacek.j...@gmail.com 
> ) wrote:
>  Hi, 
>
> It appears to be "first step of Java routing API" [1] with just a single 
> commit (perhaps squashed earlier to make it look so). What's Java routing 
> API? How is this different from Scala's one if any?
>
>  [1] 
> https://github.com/akka/akka/commits/release-2.3-dev/akka-http-java/src/main/scala/akka/http/server/japi/HttpApp.scala
>
> Jacek
>
> On Sunday, January 4, 2015 1:34:56 PM UTC+1, Jacek Laskowski wrote: 
>>
>> Hi, 
>>
>> Thanks for the hint, Björn. I've been pursuing the idea and used 
>> japi.HttpApp, but ended up with the following compilation error:
>>
>>  [error]  found   : akka.http.server.scala.Route
>> [error] (which expands to)  akka.http.server.RequestContext => scala.
>> concurrent.Future[akka.http.server.RouteResult]
>> [error]  required: akka.http.server.japi.Route
>>
>>  
>> Before going any further, I'd love figuring out what's the intent of the 
>> japi package and how the seemingly alike types - scala.Route and japi.Route 
>> - compare. Where should they be used?
>>  
>> Jacek
>>
>> On Wednesday, December 10, 2014 2:54:16 PM UTC+1, Björn Antonsson wrote: 
>>>
>>>  Hi Stevo,
>>>  
>>>  There is no direct equivalent to the spray.routing.HttpService. The 
>>> closest is probably the akka.http.server.japi.HttpService and 
>>> akka.http.server.japi.HttpApp.
>>>  
>>>  B/
>>>  
>>> On 9 December 2014 at 16:04:57, Stevo Slavić (ssl...@gmail.com) wrote:
>>>
>>>   Hello Akka community,
>>>
>>> In akka-http, is there an equivalent to spray.routing.HttpService?
>>>
>>> Kind regards,
>>> Stevo Slavic.
>>> --
>>> >> 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.
>>>  
>>>   
>>> -- 
>>> Björn Antonsson
>>>  Typesafe  – Reactive Apps on the JVM
>>>  twitter: @bantonsson 
>>>
>>>  --
> >> 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 subsc

Re: [akka-user] BalancingPool with custom mailbox

2015-01-05 Thread Pradeep Gollakota
Hi Patrik,

Thanks for the response. Is there a work around for this I can employ? Is 
it possible to use a custom mailbox with the "old" balancing dispatcher 
(from pre 2.3)?

On Friday, January 2, 2015 7:05:02 AM UTC-8, Patrik Nordwall wrote:
>
> Hi Pradeep,
>
> Custom mailbox with balancing pool is not possible with Akka 2.3.x.
> It might be supported later, see https://github.com/akka/akka/issues/13961 
> and https://github.com/akka/akka/issues/13964
>
> Regards,
> Patrik
>
> On Tue, Dec 30, 2014 at 8:58 PM, Pradeep Gollakota  > wrote:
>
>> Hi All,
>>
>> I’m trying to create an ActorSystem where a set of actors have a shared 
>> mailbox that’s prioritized. I’ve tested my mailbox without using the 
>> BalancingPool router, and the messages are correctly prioritized. However, 
>> when I try to create the actors using BalancingPool, the messages are no 
>> longer prioritized. How do I create a BalancingPool router with a custom 
>> mailbox?
>>
>> With the following code, the messages are not prioritized:
>>
>> val system = ActorSystem("MySystem")
>> val actor = 
>> system.actorOf(BalancingPool(1).props(Props[MyActor]).withMailbox("my-mailbox"),
>>  "myactor")
>>
>> With the following code, the messages are prioritized correctly.
>>
>> val system = ActorSystem("MySystem")
>> val actor = system.actorOf(Props[MyActor].withMailbox("my-mailbox"), 
>> "myactor")
>>
>> Thanks in advance,
>> Pradeep
>> ​
>>
>> -- 
>> >> 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.
>>
>
>
>
> -- 
>
> Patrik Nordwall
> Typesafe  -  Reactive apps on the JVM
> Twitter: @patriknw
>
> 

-- 
>>  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] Finding other actors

2015-01-05 Thread Patrick Mahoney
I have had some success instantiating and exposing ActorRef vals within an
extension - http://doc.akka.io/docs/akka/snapshot/scala/extending-akka.html.
This works well for actors that should be singletons within a given
ActorSystem - you get this from extensions.

-Patrick

On 29 December 2014 at 16:19, Ian Holsman  wrote:

> Hi.
>
> I was wondering what the best practice was for finding a running
> instance of an certain class of actor. (say 'bank account')
>
> Currently I have a BankAccountManager which creates a new bank
> account, and uses a map to store my reference # with the actorRef.
>
> I then use a 'GetAccountById' message to lookup the actorRef  on the
> BankAccountManager actor and pass it back to the caller. who then
> interacts with the bank account. (which seems pretty Kludgy to me).
>
>
> I recently came across the 'context.actorSelection' call, and was
> wondering if I should be using this instead to find it, and if this is
> the preferred way of dealing with finding actors.
>
> ie. never hold-on to ActorRefs, and just use actorSelection to find them.
>
> or is there a better pattern I should be using.
>
> Thanks!
> Ian
>
>
> --
> Ian Holsman
> i...@holsman.com.au
> PH: + 61-3-9028 8133 / +1-(425) 998-7083
>
> --
> >>  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: Finding other actors

2015-01-05 Thread Patrick Mahoney
Hello Ian, 

I have had some success instantiating and exposing ActorRef vals within an 
extension - http://doc.akka.io/docs/akka/snapshot/scala/extending-akka.html. 
This works well for actors that should be singletons within a given 
ActorSystem - each extension is instantiated once per actor system.

-Patrick

On Monday, December 29, 2014 4:30:34 PM UTC-5, Ian Holsman wrote:
>
> Hi. 
>
> I was wondering what the best practice was for finding a running 
> instance of an certain class of actor. (say 'bank account') 
>
> Currently I have a BankAccountManager which creates a new bank 
> account, and uses a map to store my reference # with the actorRef. 
>
> I then use a 'GetAccountById' message to lookup the actorRef  on the 
> BankAccountManager actor and pass it back to the caller. who then 
> interacts with the bank account. (which seems pretty Kludgy to me). 
>
>
> I recently came across the 'context.actorSelection' call, and was 
> wondering if I should be using this instead to find it, and if this is 
> the preferred way of dealing with finding actors. 
>
> ie. never hold-on to ActorRefs, and just use actorSelection to find them. 
>
> or is there a better pattern I should be using. 
>
> Thanks! 
> Ian 
>
>
> -- 
> Ian Holsman 
> i...@holsman.com.au  
> PH: + 61-3-9028 8133 / +1-(425) 998-7083 
>

-- 
>>  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: Possibility of deploying actors from single ActorSytem to multiple nodes

2015-01-05 Thread Patrik Nordwall
On Thu, Jan 1, 2015 at 6:58 AM, Krishna Kadam 
wrote:

> Hi All,
>  Thanks Konrad for your suggestions, I read the documents you
> suggested. I did the following changes in my project's *application.conf*.
> akka{
> loglevel = DEBUG
> actor{
> provider = "akka.cluster.ClusterActorRefProvider"
> }
> remote{
> log-remote-lifecycle-events = on
> transport = "akka.remote.netty.NettyRemoteTransport"
> netty{
> host = "10.97.123.68"
> port = 0
> }
> log-received-messages = on
>  log-sent-messages = on
> }
> cluster{
> seed-nodes = [ "akka://Seeder1-ActorSystem@10.97.123.68:5",
> "akka://Seeder2-ActorSystem@10.97.123.68:50006" ]
>

2 issues with the above config.
The name of the actor system must be the same on each node in the cluster.
These does not contain valid remote protocol information.


>  seed-node-timeout = 60s
> auto-down-unreachable-after = 10s
> }
> }
>
> I have following question in my mind, some might be stupid
>
> 1. As we are using ActorSystems defined on each node, Is it creating actor
> references in each actor system?
>

*You* can create actors in each actor system.


>
> As I gave the desired structure of my project requirement, I want to take
> messages on the Node1 and create single Actor for each type of message and
> distribute these Actors for execution on different nodes. how can I do
> this?
>

That is rather broad question. I suggest that you read the documentation
and try some of the related Activator tutorials. You might be interested in
Cluster Aware Routers, Cluster Sharding, Publish Subscribe?

Regards,
Patrik


>
> Please suggest any configuration required in the *application.conf*
>
>
> Thanks & Regards
>> Krishna Kadam
>>
>  --
> >> 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.
>



-- 

Patrik Nordwall
Typesafe  -  Reactive apps on the JVM
Twitter: @patriknw

-- 
>>  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: Figuring out Docker and Akka clustering with 2.4-SNAPSHOT (bind-hostname, bind-port)

2015-01-05 Thread Patrik Nordwall
Thanks for sharing!

On Wed, Dec 31, 2014 at 6:37 PM, tigerfoot  wrote:

> Think I've got it!  Here's the recipe for application.conf I got working
> to make Akka clustering work w/Docker:
>
> akka {
> loglevel = "ERROR"
> stdout-loglevel = "ERROR"
> loggers = ["akka.event.slf4j.Slf4jLogger"]
> actor {
> provider = akka.cluster.ClusterActorRefProvider
> }
> remote {
> enabled-transports = ["akka.remote.netty.tcp"]
> netty.tcp {
> # Outside Docker
> bind-hostname = ${dkr.local}
>
> # Inside Docker addr
> hostname = ${dkr.hostname}
> port = ${dkr.port}
> }
> }
> cluster {
> auto-down = on
> log-info = off
> }
> }
>
> Key Points:
>
> 1) seed-nodes (and roles FWIW) are set by my program but could be added to
> the cluster section here.  I happen to pass them into Docker via a
> parameter.  The IPs of the seeds are host IPs not the Docker-internal IPs
> (which I basically don't care about).
>
> 2) dkr.hostname/dkr.port are passed into Docker via parameters.  This is
> the *host* IP/port you want to run on (i.e. Docker-external IP addr).
> Although I don't happen to care, I believe this also runs Akka on the same
> port inside Docker.  It might be an issue if you are running lots of things
> in your Docker container using ports, but I'm just running Akka, so I'm not
> picky.
>
> 3) dkr.local is set by my program (not passed in) and is just the
> Docker-internal IP address (retrieved by
> java.net.InetAddress.getLocalHost().getHostAddress()).
>
> Took a little doing to get this right but it works.  This new binding
> functionality is a fantastic addition to Akka, as Docker is really a DevOps
> darling.  Looking forward to full 2.4 release!
>
> On Monday, December 29, 2014 2:03:33 PM UTC-6, tigerfoot wrote:
>>
>> Hello,
>>
>> I'm trying to figure out how to get 2.4-SNAPSHOT going with Docker such
>> that 1) I can access akka+http outside the running Docker container (i.e.
>> from the host), and 2) I can enable clustering/discovery.
>>
>> I see from discussion threads and docs that the new bind-hostname and
>> bind-port are designed to do this, but I haven't been able to come up with
>> the right recipe to use them yet.
>>
>> My code passes these arguments when Docker starts up:
>>- IP address of host machine
>>- port for Akka on host
>>- http port
>>
>> Like this:
>>
>> docker run -i -t -p 9100:9100 -p 9101:9101 localhost:5000/root:1.0.0
>> --seed --name kernel --hostIP 172.16.240.78 --hostPort 9100 --httpPort 9101
>> --roles seed
>>
>> (where 172.16.240.78 is the IP of my host running Docker)
>>
>> Here's my application.conf.
>>
>> akka {
>> loglevel = "ERROR"
>> stdout-loglevel = "ERROR"
>> event-handlers = ["akka.event.slf4j.Slf4jEventHandler"]
>> log-dead-letters = 1
>> log-dead-letters-during-shutdown = off
>>
>> actor {
>> provider = "akka.cluster.ClusterActorRefProvider"
>> }
>> remote {
>> enabled-transports = ["akka.remote.netty.tcp"]
>> netty.tcp {
>> # Outside Docker addr
>> bind-hostname  = ${server.ip}   # hostIP param
>> bind-port  = ${server.port} # hostPort param
>>
>> # Inside Docker addr
>> port   = 0
>> }
>> }
>> cluster {
>> auto-down = on
>> log-info = off
>> # seed-nodes and roles set at runtime and added to config
>> }
>> }
>>
>> I'm not sure I'm using these hostname/port, bind-hostname, bind-port
>> correctly.  I've tried a few different permutations, which either fail to
>> launch (w/messages saying it can't bind to an address) or it runs but I
>> can't hit it outside my Docker container.
>> I need Akka to be able to discover its cluster nodes and be accessible on
>> the given IP addr/port.
>>
>> I have a trivial project set up here to show the approach:
>> https://github.com/gzoller/docker-exp/tree/akk2
>>
>> I'm hoping I'm missing something simple in my config...
>>
>> Any ideas?
>>
>> Thanks!
>> Greg
>>
>>  --
> >> 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.
>



-- 

Patrik Nordwall
Typesafe  -  Reactive apps on the JVM
Twitter: @patriknw

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

[akka-user] Re: [akka-persistence] Testing systems which have Persistence

2015-01-05 Thread Anders Båtstrand
I have only been using Akka Persistence for a few months, but this is my 
suggestions:

1. I always start empty, but that is possibly not what you want. Maybe a 
file based storage, and you copy the files in place right before you start 
the Akka system?

2. I have solved the same problem by letting the parent actor be 
responsible for killing the children. That is: The child receives an event 
that it calculates should result in it's own destruction, and it then calls 
the parent, which then kills it (and updates a map over actors). In my case 
the parent is also delegating messages to the child, so this way I am sure 
not to send messages to any actor that is on the way down (that is, before 
the parent received the Terminated-message).

3. I am not sure i understood the question. I have CreateChild and 
KillChild events persistent from the parent actor. During recovery, it 
makes a map over actors it should create or not, and only creates then 
onRecoveryComplete. That way I do not create actors I would immediatly kill.

Hope this was helpful!

Best regards,

Anders Båtstrand

kl. 19:20:30 UTC+1 fredag 2. januar 2015 skrev Ian Holsman følgende:
>
> Hi.
>
> I'm building a 'toy' game that makes uses of akka-persistence, in order to 
> learn it.
>
> in a nutshell the game is 1000's of people/bots create villages, they act 
> independently of each other, and generally pass messages to each other to 
> chat/fight and all that good stuff.
>
> Where I am having problems are:
>
> 1. how do I initialize the persistence system at the start of testing so I 
> am in a 'known state' when I start. 
>
> 2. how I assign IDs (persistanceId)  to actors. 
> Ideally I would use a map reference for while the villages exist, and be 
> able to re-use them if a new village is created. but the problem is it 
> finds the old village, and replays all the events (including the death 
> event which kills it). 
> I don't mind re-using a old actor, but i'd like to stop it (ie poisonpill) 
> when it isn't active.
>
> It seems like they need to be unique for the life of the system, and to do 
> so I would need a counter in place or GUIDs. but then I would need to keep 
> track of the Map reference/GUID mapping meaning my code would need to first 
> talk to the mapping holder, and then to the village itself (2 messages, 1 
> sync) which seems like non-ideal. (as opposed to 
> context.actorselection("XYZ map-reference") ! message which I guess is 
> still 2 messages under the covers, 1 sync too)
>
> 3. the recovery log only seems to 'start' when I bring up the actor. 
> Is there a way to know which actors are currently 'active' and just let 
> Akka start them all up, instead of me keeping a list/map of 'active' 
> villages, and manually restarting them.
>
>
>
> Thanks .. 
>
> Ian.
>

-- 
>>  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: Application.conf not being used under test

2015-01-05 Thread Anders Båtstrand
How do you load the configuration? And could you post the output of 
Config.origin() after you have loaded the configuration?

I had a problem with configuration being overidden, but solved it by 
reading the javadoc on ConfigFactor.parseResourcesAnySyntax (cleared up a 
few things for me).

Best regards,

Anders Båtstrand

kl. 04:32:26 UTC+1 mandag 5. januar 2015 skrev manwood følgende:
>
> I have a small Akka application with application.conf files under both 
> test and main directories. Initially, when running the tests, the 
> application.conf file under the test directory was being used (as desired). 
> However, whilst building out the application, adding dependencies etc, at 
> some point the test code has started to use the application.conf under main 
> instead.
>
> What could have caused this? How can I establish why?
>

-- 
>>  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] Disable warning messages from ReliableDeliverySupervisor

2015-01-05 Thread Patrik Nordwall
On Fri, Jan 2, 2015 at 2:39 PM, Miguel Angel Fernandez <
mafernan...@stratio.com> wrote:

> Hi all,
>
> I'm trying to disable the messages of this type:
>
> "[WARN|ReliableDeliverySupervisor] Association with remote system
> [akka.tcp://ServerCluster@127.0.0.1:57230] has failed, address is now
> gated for [5000] ms. Reason is: [Disassociated]."
>
> but the only way to do it was to change the global loglevel to "ERROR"
>
> I already tried to keep the global loglevel to "INFO" and use the next
> options:
>
> akka.remote.log-remote-lifecycle-events = off
> akka.cluster.log-info = off
> akka.remote.log-received-messages = off
> akka.loglevel = "ERROR"
> akka.stdout-loglevel = "ERROR"
> akka.log-dead-letters-during-shutdown = off
>
> but none of them worked.
>

That log message is logged at warning level, without any additional
configuration.


>
> Is there any way to disable that specific warning message while keeping
> the global loglevel to INFO?
>

I have created an issue and we will discuss it in the team.
https://github.com/akka/akka/issues/16615

Currently you can filter this by using a Slf4j logger.


>
> I also have a question about "isolating" some types of actors from others
> according to their roles in the same cluster.
>

What do you want to achieve with the isolation?

/Patrik

>
> For instance, several actors join to the same cluster. These actors can
> behave as only one of the next roles: Client, Server, Executor.
>
> I basically want to isolate events created by Clients from Executors and
> the other way around, while Servers are the coordinators among them and
> taking into account that Clients, Servers and Executors should belong to
> the same cluster if possible.
>
> The idea that I had was to create two clusters: Clients-Servers and
> Servers-Executors; but clusters are heavy-weight processes and communicate
> server actors from different clusters could complicate the system.
>
> Any suggestion to implement the behavior described above apart from
> creating two clusters?
>
> I'm using Akka version 2.3.4.
>
> Thanks in advance.
>
>
>
>
>  --
> >> 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.
>



-- 

Patrik Nordwall
Typesafe  -  Reactive apps on the JVM
Twitter: @patriknw

-- 
>>  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: How to identify that akka cluster has formed?

2015-01-05 Thread Krishna Kadam

>
> Hi patrik,
>
I am doing a masters project in which I have streaming data and want to 
send a particular type of message to the same actor every time, so that 
certain type of messages are processed by akka actors in their arrival 
order. Also I want to deploy these actors on multiple machines for 
execution purpose. Can I scale this process by deploying it to multiple 
nodes? also Can I have better performance by deploying single actor system 
to multiple nodes for execution?
 

> Thanks & Regards
> Krishna Kadam
>

-- 
>>  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] How to identify that akka cluster has formed?

2015-01-05 Thread Patrik Nordwall
On Fri, Jan 2, 2015 at 12:21 PM, Krishna Kadam  wrote:

> Hi all,
>
> I am trying to use the cluster feature in Akka. I have following doubts
>
>
> How can I verify establishment of AKKA cluster?
>

Subscribe to cluster membership events?
http://doc.akka.io/docs/akka/2.3.8/java/cluster-usage.html#Subscribe_to_Cluster_Events



>
> and Can I have unique Identification to each actor in the actor system
> used in cluster?
>

I don't understand the question. What do you want to do with the
identification?

/Patrik


>
> Please do Help !!
>
> Thanks & Regards
> Krishna Kadam
>
> --
> >> 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.
>



-- 

Patrik Nordwall
Typesafe  -  Reactive apps on the JVM
Twitter: @patriknw

-- 
>>  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] Finding other actors

2015-01-05 Thread Patrik Nordwall
Hi Ian,

On Mon, Dec 29, 2014 at 10:19 PM, Ian Holsman  wrote:

> Hi.
>
> I was wondering what the best practice was for finding a running
> instance of an certain class of actor. (say 'bank account')
>
> Currently I have a BankAccountManager which creates a new bank
> account, and uses a map to store my reference # with the actorRef.
>
> I then use a 'GetAccountById' message to lookup the actorRef  on the
> BankAccountManager actor and pass it back to the caller. who then
> interacts with the bank account. (which seems pretty Kludgy to me).
>
>
Yes, that is one way of doing it.

Another way is to send all messages to the bank accounts via the parent
BankAccountManager.


>
> I recently came across the 'context.actorSelection' call, and was
> wondering if I should be using this instead to find it, and if this is
> the preferred way of dealing with finding actors.
>

That would work in the above example, if the BankAccountManager knows and
creates all bank accounts up front.
In this case the names of the bank account actors can probably be well
known (and stable), e.g. using bank account number.

In general, using actor selection too much can make it difficult to
refactor and test the code. The actor paths changes with the supervision
hierarchy. Normally it is better to inject (constructor) ActorRefs to
dependent actors, or pass  ActorRefs in messages.


>
> ie. never hold-on to ActorRefs, and just use actorSelection to find them.
>

Note that ActorSelection is not as powerful as ActorRef. You can't watch an
ActorSelection. Sending messages via an ActorSelection is also slightly
less efficient than sending them directly with an ActorRef.



> or is there a better pattern I should be using.
>

I would probably start with sending all messages via the parent
BankAccountManager.
That also has a nice migration path into Cluster Sharding, if needed later.

Cheers,
Patrik


>
> Thanks!
> Ian
>
>
> --
> Ian Holsman
> i...@holsman.com.au
> PH: + 61-3-9028 8133 / +1-(425) 998-7083
>
> --
> >>  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.
>



-- 

Patrik Nordwall
Typesafe  -  Reactive apps on the JVM
Twitter: @patriknw

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