Re: [akka-user] AOP in Akka

2014-05-30 Thread Leon Ma
My case is actually to pass some information like Mapped Diagnostic Context.

Some of my legacy java code is using threadlocal to carry on those MDC 
information, that's why I need a way to:

intercept tell : collect threadlocal information and do some wrapping 
like MDCCtx(mymessage, threadLocalInfoThatINeed)
intercept receive : unwrapper MDCCtx, recover thread local info.

Thanks

Leon





在 2014年5月29日星期四UTC+8下午11时27分01秒,Konrad Malawski写道:

 Hello Leon,
 Well, the Scala way™ would rather be using plain total or partial 
 functions and composing them - I believe that's what whoever the quoted 
 sentence comes from had in mind.
 In Akka we also believe that less magic is better :-)

 I would therefore suggest you to try modelling your required behaviour in 
 terms of functions instead of aspects.
 What's your use case?


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

 http://scaladays.org
  

-- 
  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] AOP in Akka

2014-05-30 Thread Konrad Malawski
So metrics.
I would suggest piggybacking on kamon: http://kamon.io/
Since the guys have many of the things figured out already - it's open
source so it should be possible to either get metrics from their pointcuts
or piggyback in some other way.


On Fri, May 30, 2014 at 11:58 AM, Leon Ma tutuf...@gmail.com wrote:

 My case is actually to pass some information like Mapped Diagnostic
 Context.

 Some of my legacy java code is using threadlocal to carry on those MDC
 information, that's why I need a way to:

 intercept tell : collect threadlocal information and do some wrapping
 like MDCCtx(mymessage, threadLocalInfoThatINeed)
 intercept receive : unwrapper MDCCtx, recover thread local info.

 Thanks

 Leon





 在 2014年5月29日星期四UTC+8下午11时27分01秒,Konrad Malawski写道:

 Hello Leon,
 Well, the Scala way™ would rather be using plain total or partial
 functions and composing them - I believe that's what whoever the quoted
 sentence comes from had in mind.
 In Akka we also believe that less magic is better :-)

 I would therefore suggest you to try modelling your required behaviour in
 terms of functions instead of aspects.
 What's your use case?


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

 http://scaladays.org

  --
  Read the docs: http://akka.io/docs/
  Check the FAQ:
 http://doc.akka.io/docs/akka/current/additional/faq.html
  Search the archives: https://groups.google.com/group/akka-user
 ---
 You received this message because you are subscribed to the Google Groups
 Akka User List group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to akka-user+unsubscr...@googlegroups.com.
 To post to this group, send email to akka-user@googlegroups.com.
 Visit this group at http://groups.google.com/group/akka-user.
 For more options, visit https://groups.google.com/d/optout.




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

http://scaladays.org

-- 
  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] AOP in Akka

2014-05-30 Thread Konrad Malawski
The thread local stuff is quite scary in an Actor setting by the way and
if possible it would be best to work around it (in a way other than
setCurrentThreadId - I'm guessing that's your current impl?).
Would you be able to construct MDC on your own, bypassing the threadlocals?


On Fri, May 30, 2014 at 12:57 PM, Konrad Malawski kt...@typesafe.com
wrote:

 So metrics.
 I would suggest piggybacking on kamon: http://kamon.io/
 Since the guys have many of the things figured out already - it's open
 source so it should be possible to either get metrics from their pointcuts
 or piggyback in some other way.


 On Fri, May 30, 2014 at 11:58 AM, Leon Ma tutuf...@gmail.com wrote:

 My case is actually to pass some information like Mapped Diagnostic
 Context.

 Some of my legacy java code is using threadlocal to carry on those MDC
 information, that's why I need a way to:

 intercept tell : collect threadlocal information and do some wrapping
 like MDCCtx(mymessage, threadLocalInfoThatINeed)
 intercept receive : unwrapper MDCCtx, recover thread local info.

 Thanks

 Leon





 在 2014年5月29日星期四UTC+8下午11时27分01秒,Konrad Malawski写道:

 Hello Leon,
 Well, the Scala way™ would rather be using plain total or partial
 functions and composing them - I believe that's what whoever the quoted
 sentence comes from had in mind.
 In Akka we also believe that less magic is better :-)

 I would therefore suggest you to try modelling your required behaviour
 in terms of functions instead of aspects.
 What's your use case?


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

 http://scaladays.org

  --
  Read the docs: http://akka.io/docs/
  Check the FAQ:
 http://doc.akka.io/docs/akka/current/additional/faq.html
  Search the archives: https://groups.google.com/group/akka-user
 ---
 You received this message because you are subscribed to the Google Groups
 Akka User List group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to akka-user+unsubscr...@googlegroups.com.
 To post to this group, send email to akka-user@googlegroups.com.
 Visit this group at http://groups.google.com/group/akka-user.
 For more options, visit https://groups.google.com/d/optout.




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

 http://scaladays.org




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

http://scaladays.org

-- 
  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] Cluster, sharding and roles

2014-05-30 Thread Eduardo Fernandes
Hi all.

Probably this is a silly question but I couldn't find any clear answer in 
the group or docs.

Suppose I have a cluster with 4 nodes with 2 roles (2 node instances per 
role). How could I create two shardings, each one sending messages to the 
nodes belonging to a particular role? The idea is add a new node with a 
particular role and let the cluster sharding distribute the work among all 
nodes belonging to that role. I suppose I could create two sharding 
regions, one per role, and assign the sharding to a role in some way?

I'm using Java and Akka 2.3.3.

Many thanks for your help.

Eduardo.


-- 
  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] supervisor hierarchies

2014-05-30 Thread Jabbar Azam
I also found this excellent text describing the supervisor hierarchies. 
It's about Erlang but the concepts can be applied to Akka

http://learnyousomeerlang.com/building-applications-with-otp#the-onion-layer-theory



On Thursday, 29 May 2014 13:03:03 UTC+1, Jabbar Azam wrote:

 Thanks Conrad I understand.

 I think understanding the error kernel pattern is really important 
 together with 
 http://doc.akka.io/docs/akka/2.3.3/general/actor-systems.html of the 
 documentation. 


 On Thursday, 29 May 2014 11:48:28 UTC+1, Konrad Malawski wrote:

 Not exactly one, but yeah as little as possible.
 This way of thinking will force your thinking towards creating these 
 hierarchies of actors which fail or survive together (kind of like the four 
 musketeers :-)).
 And the gains have been outlined already - you are able to fail / restart 
 / isolate failures within one such hierarchy.


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

 http://scaladays.org
  


-- 
  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] Distributed worker and AdaptiveLoadBalancingPool

2014-05-30 Thread Adriano Machado
Hi.

My question is based on the Activator template akka distributed workers. 
I have started with it and implemented the needed logic based on my needs, 
it's working fine.

Now I'm trying to design a solution that based on the node's capabilities, 
automatically increase and/or decrease the number of workers running on it. 
 I have read the docs and found AdaptiveLoadBalancingPool, but I don't 
know how to fit it with the work pulling model presented by the template. 
 How could I do it?

Any help would be appreciated.

-- 
  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] ClusterClient and getting response from cluster

2014-05-30 Thread Eugene Dzhurinsky
Well, I found that if I include the reference to the sender actor into the
message itself - then it seems to be correctly resolved to external form 

akka.tcp://HttpCluster@127.0.0.1:53467/system/testActor1#1703301548

So the sender actor gets it's message if it's sent directly to the sender
from the message. Not sure if it will work for all scenarios, now I'm
experimenting with some testing withing the same JVM.

Please advice.

-- 
Eugene N Dzhurinsky


pgppuBpyPMyOj.pgp
Description: PGP signature


[akka-user] Rebalancing shard entries of different types

2014-05-30 Thread Luis Medina
When a rebalance kicks in from using sharding, does the rebalancing process 
consider only entries of a particular type or does it consider all entry 
types in the cluster?

For example, if I were to shard different entries (different by name that 
is) like so:

ClusterSharding.get(system).start(A, StreamActor.props(config), new 
MessageExtractor());
ClusterSharding.get(system).start(B, StreamActor.props(config), new 
MessageExtractor());

Would the rebalancing take into account the entries of type A and B 
when determining when to rebalance? 

ie. 
shard 1 (A, A, B, B) 
shard 2 (A)
shard 2 (B)
// Shard 1 has 4 entries running of different types while shards 2 and 3 
only have 1 entry, thus all entries will get rebalanced.


Or does rebalancing work separately for each type of entry?

ie. 
shard 1 (A, B, B) 
shard 2 (A)
shard 2 (A)
// Shard 1 has 4 entries running of different types but each shard only has 
a single instance of entry type A running. Thus the rebalancing won't 
kick in for type A (although it might kick in for entries of type B). 

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