[akka-user] ActorSystem terminates when restarted remote ActorSystem has associated after being quarantined

2015-04-15 Thread Rick Latrine
Hi,

I have two ActorSystems Node-A and Node-B in separate JVM processes with 
netty-tcp remoting enabled running on the same machine (127.0.0.1) on port 
2552 and 2553.

Each ActorSystem starts itself a actor.
The actor sends a ping message and replies to a sender with a pong 
message using actorSelection which identifies the corresponding remote 
actor.
On receiving a ping or pong message the sender actor is going to be 
watched.

Everything works fine so far.

Then I kill the JVM process which was running ActorSystem Node-B.
Node-A detects the termination and after a while the remote system Node-B 
becomes quarantined.

Now I restart the JVM process to launch the ActorSystem Node-B.
The ActorSystem Node-A notifies that Node-B is associated.
In the same instant ActorSystem Node-A terminates without any log message 
or exception.
Node-B continues and notifies about that termination 

This unexpected behaviour is reproducible.

Are there any known issues when quarantined ActorSystems are restarted?

Akka Version used: 2.3.9
Tested with: JRE 7 and 8
OS: Windows 7 x64

Stacktrace of thread which stops the ActorSystem due to receival of message 
DeathWatchNotification(Actor[akka://Node-A/user],true,false):

Node-A-akka.actor.default-dispatcher-14@2655 prio=5 tid=0x19 nid=NA 
runnable
  java.lang.Thread.State: RUNNABLE
  at 
akka.actor.LocalActorRefProvider$$anon$2.stop(ActorRefProvider.scala:491)
  at 
akka.actor.LocalActorRefProvider$$anon$2$$anonfun$sendSystemMessage$1.apply$mcV$sp(ActorRefProvider.scala:506)
  at akka.util.Switch.ifOff(LockUtil.scala:85)
  at 
akka.actor.LocalActorRefProvider$$anon$2.sendSystemMessage(ActorRefProvider.scala:499)
  at 
akka.actor.dungeon.FaultHandling$class.akka$actor$dungeon$FaultHandling$$finishTerminate(FaultHandling.scala:213)
  at 
akka.actor.dungeon.FaultHandling$class.handleChildTerminated(FaultHandling.scala:292)
  at akka.actor.ActorCell.handleChildTerminated(ActorCell.scala:369)
  at 
akka.actor.dungeon.DeathWatch$class.watchedActorTerminated(DeathWatch.scala:63)
  at akka.actor.ActorCell.watchedActorTerminated(ActorCell.scala:369)
  at akka.actor.ActorCell.invokeAll$1(ActorCell.scala:455)
  at akka.actor.ActorCell.systemInvoke(ActorCell.scala:478)
  at akka.dispatch.Mailbox.processAllSystemMessages(Mailbox.scala:279)
  at akka.dispatch.Mailbox.run(Mailbox.scala:220)
  at akka.dispatch.Mailbox.exec(Mailbox.scala:231)
  at 
scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
  at 
scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
  at 
scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
  at 
scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)

-- 
  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-persistence-2.3.9] Saving snapshots of multiple objects

2015-04-15 Thread Martynas Mickevičius
On Wed, Mar 25, 2015 at 11:55 AM, Patrik Nordwall patrik.nordw...@gmail.com
 wrote:

 Hi Amir,

 On Sun, Mar 22, 2015 at 8:57 PM, Amir Karimi a.karim...@gmail.com wrote:

 Hi,

 I have an actor with multiple states. What is the best practice to save
 snapshots of them:

- Aggregating all states into one case class and just have a single
big state object
- This is hard when we have to update deeper states. Like
   state.copy(innerState = state.innerState.copy(...))

 And for updating deep case class hierarchies you can use lens pattern
from scalaz or monocle or something simpler like quicklens
http://www.warski.org/blog/2015/02/quicklens-modify-deeply-nested-case-class-fields/
.



 This is the way to do it. I see no other way.
 Note that the state object that you pass to saveSnapshot doesn't have to
 be the same as the state object you have in your actor. You can have
 several state variables in the actor and then combine them into one object
 when you perform saveSnapshot.



- Call saveSnapshot for each state object
   - I'm not sure what happens if one of the snapshot savings fail

 This will not work. When the actor is recovering it will only receive one
 snapshot followed by the events after that snapshot.

 /Patrik


 What is the best solution?

 Thanks,
 Amir

 --
  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 http://typesafe.com/ -  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.




-- 
Martynas Mickevičius
Typesafe http://typesafe.com/ – Reactive
http://www.reactivemanifesto.org/ Apps on the JVM

-- 
  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] How does akka actor helps in achieve concurrency without locking/syncronization

2015-04-15 Thread Rohit Jain
How does using akka actor helps in achieving concurrency without use of any 
external locks?
Is it because at a moment only one message can be processed for one actor ? 
Hence no 2 threads can be acting upon same actor ?
If that is the case, then maximum number of threads we require is equal to 
number of actors in our system.

-- 
  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 CQRS / Cluster Sharding - Change management of Events and other questions

2015-04-15 Thread Chris Ridmann
Thanks for the help guys!  I figured I stumbled onto a big topic here.   :)

@Richard - I haven't used Scala Pickling, though I do have some experience 
with scodec for binary serialization.  One problem I have with binary 
serialization with akka-persistence is it makes it makes it harder to debug 
systems just from querying the database.  This seems to be an issue with 
some plugins in the ecosystem - thankfully the one I'm using just provided 
support for a pluggable way of handling serialization for the persistence 
API.  Avro looks interesting - I'll have to follow that one a bit longer. 
 I also recently discovered https://github.com/mandubian/scaledn but 
haven't used it yet.

I think I'm going to go the json-serialization route as my team already has 
a lot of experience using the play-json formatters/reads/writes so it would 
flow quite naturally.  I also really like the idea of storing events in the 
DB in a human readable format.

As per 2), I'm still a bit confused on the scenario if the system crashes 
after the command is persisted but before the event callback is fired (or 
right in the middle of the callback).  This seems like it would be a 
relatively common scenario, and the suggested event-sourcing approaches 
recommend not to perform side effects while recovering state.

-Chris

On Monday, April 13, 2015 at 2:35:05 PM UTC-4, Greg Young wrote:

 Yep weak/hybrid schema all the way. 

 So long as adding a field doesn't break downstream consumers then you 
 are #@$@ed with schema (think binary serializer) 

 On Mon, Apr 13, 2015 at 9:29 PM, Richard Rodseth rrod...@gmail.com 
 javascript: wrote: 
  My favourite topic 
  
  https://groups.google.com/forum/#!topic/akka-user/mNVxRPRUDv0 
  
  Jay Kreps recently strongly endorsed Avro for use with Kafka. 
  
  http://t.co/l9uTFmb6OS 
  
  On Mon, Apr 13, 2015 at 10:54 AM, Greg Young gregor...@gmail.com 
 javascript: 
  wrote: 
  
  For 1 use weak serialization (say json) 
  
  
  On Monday, April 13, 2015 at 4:54:24 PM UTC+3, Chris Ridmann wrote: 
  
  Hello! 
  
  I've recently been experimenting with architectures that use CQRS / 
  Cluster Sharding / Event Sourcing / DDD, and I have some beginner 
 questions. 
  
  1) What is the best way to handle changing the structure of events 
 as 
  business requirements (or refactorings) change over time? 
  
  As a brief example: 
  
  // v1 
  case class ChangeName(id: String, first:String) extends Cmd 
  case class NameChanged(id: String, first: String) extends Evt 
  
  // v2 
  // now biz req. changes and we want to be able to change both first 
 and 
  last name 
  // i can freely change the 'Cmd' because we don't persist it, however 
 if 
  I change the 'Evt' 
  // i will get 'RecoveryFailure was caused by: 
  java.io.InvalidClassException' during recoveries 
  case class ChangeName(id: String, first:String, last: String) extends 
 Cmd 
  case class NameChanged(id: String, first: String, last: String) 
 extends 
  Evt 
  
  
  
  It seems I could always just maintain 2 different events, e.g. 
  NameChangedV1, and NameChangedV2, but that doesn't seem maintainable 
 in the 
  long run. 
  
  Another approach I thought of is to save a snapshot before introducing 
  any breaking changes to an Event interface before bringing down the 
 app 
  for upgrading.  This seems hard - is it even possible with the 
  'ClusterSharding' extension to send a message (e.g. Snap) to all of 
 its 
  known id's in the system? 
  
  How does changing events affect the read side of things in CQRS? 
  
   
  
  2) When a node crashes, how can I make sure the entry gets restarted 
  and completes processing when the node is brought back up? 
  
  Here's a very brief example that may help clarify what I'm asking: 
  
  // sent in the beginning of the flow from a front-end 
  case class ProcessMessage(id: String, message: Message) extends Cmd 
  case class MessageToBeProcessed(id: String, message: Message) extends 
 Evt 
  
  // sent at the end of the flow from another processor actor 
  case class MessageProcessed(id: String, message: Message) extends Cmd 
  case class MessageComplete(id: String, message: Message) extends Evt 
  
  
  Let's say the node crashes right after I persist the event 
  'MessageToBeProcessed' and before I send it to a processor actor to 
 complete 
  processing.  Will the 'ClusterSharding' extension re-activate this 
 entry on 
  another available node right away, or will it wait until that entry 
 receives 
  another Cmd?  If it doesn't re-activate, is there a recommended 
 approach 
  to solve this? 
  
  
  Thanks! 
  -Chris 
  
  -- 
   Read the docs: http://akka.io/docs/ 
   Check the FAQ: 
   http://doc.akka.io/docs/akka/current/additional/faq.html 
   Search the archives: 
 https://groups.google.com/group/akka-user 
  --- 
  You received this message because you are subscribed to the Google 
 Groups 
  Akka User List group. 
  To unsubscribe from this group and stop receiving 

[akka-user] Re: Akka Tuning - need help - not getting as advertised performance

2015-04-15 Thread bearrito
Are you using ReactiveMongo? If so what version? Have you investigated 
bulkInsert, perhaps buffer locally and only flushing when a certain limit 
is reached?

What do your write queues in MMS look like? 

Can you clarify what actors you believe are not terminating properly?


On Friday, April 10, 2015 at 1:07:01 PM UTC-4, Dan Martin wrote:

 I have a feeling that what's happing is my actors are not terminating 
 gracefully.  See, my benchmark app runs for a finite time.  Once that time 
 is reach, it shuts down the actor system.  I believe there are messages in 
 the actor mailboxes that don't get processed.  I'm just now reading through 
 some documentation about graceful shutdowns.  

 http://letitcrash.com/post/30165507578/shutdown-patterns-in-akka-2


 On Friday, April 10, 2015 at 12:25:15 PM UTC-4, Dan Martin wrote:

 I'm building an app-monitoring application in Play 2 and MongoDB 3. 
  Basic usage is client application log messeges via REST endpoints provide 
 by my Play app.  For benchmark testing, I put together a client tool where 
 I use Akka to simulate application requests.  I'm using the Akka Scheduler 
 to send messages to a logBotActor (LogBot is the name of my benchmark 
 tool).  The logBotActor pics from a random set of messages that I have 
 predefined in a list and sends them to sendMessageActor for sending the 
 HTTP request to my app monitory application
 The scheduler is configured to run at a 1ms interval.  So, in theory, I 
 should see 1000 messages logged on the backend (MongoDb) for each second 
 that goes by, but Im not.  In fact, I'm no where near that figure.  I 
 understand that there's latency involved (my app-monitor is running on 
 Heroku).  I also understand that from the time the scheduler kicks off a 
 message, CPU clock cycles go by as messages are passed around between the 
 actors and performing the random calculation for getting random predefined 
 messages.  But eventually, it should all catch up, right??

 I'm just getting my feet wet with Akka, so I'm sure there's some tuning 
 that needs to be addressed.


 Here is my application.conf.  (note: I omitted the debugging related 
 properties).  I've tried adjusting the parallelism-max and throughput but 
 they didn't seem to effect anything.

 akka {
   actor {

 default-dispatcher {
   executor = fork-join-executor
   fork-join-executor {
 parallelism-factor = 2.0
 parallelism-max = 10
 parallelism-min = 2
   }
   throughput = 100
 }
   }
 }



 Here are my machine's specs:

 *MacBook Pro (15-inch, 2.53GHz, Mid 2009)*
 *Processor* 2.53 GHz Intel Core 2 Duo
 *Memory* 8 GB 1067 MHz DDR3




-- 
  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 does akka actor helps in achieve concurrency without locking/syncronization

2015-04-15 Thread Michael Frank

On 04/15/15 04:47, Rohit Jain wrote:
How does using akka actor helps in achieving concurrency without use 
of any external locks?
Is it because at a moment only one message can be processed for one 
actor ? Hence no 2 threads can be acting upon same actor ?


that is correct.  processing within the receive loop of an actor is 
single threaded.


If that is the case, then maximum number of threads we require is 
equal to number of actors in our system.


if all your actors perform blocking work in their receive loop, then 
that would be true.  however, you should design your application to be 
non-blocking (http://www.reactivemanifesto.org/glossary#Non-Blocking).  
if you need to perform blocking work, then you should use Futures 
(http://doc.akka.io/docs/akka/2.3.9/scala/futures.html) to schedule the 
work on a separate, dedicated dispatcher 
(http://doc.akka.io/docs/akka/2.3.9/scala/dispatchers.html).  You can 
then pipe the result of the Future to an actor 
(http://doc.akka.io/docs/akka/2.3.9/scala/futures.html#Use_With_Actors) 
for further processing if necessary.


-Michael

--

 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] Simple HOCON question

2015-04-15 Thread Michael Frank

On 04/15/15 09:53, bearrito wrote:

Cross posted to stackoverflow

http://stackoverflow.com/questions/29655888/hocon-not-substituting-environment-variables

Anyone have any experience with this issue. Is what I'm attempting 
even feasible?


this is a shot in the dark, but are you using an older version of 
typesafe-config?  maybe its a newer-ish feature?  the feature seems to 
be advertised as you describe, but if you are pulling in typesafe-config 
as a transient dependency (say from akka), maybe you are getting an 
older version.


what happens if you remove the substitution in your .conf file (so 
parsing is successful) and then print out the contents of 
ConfigFactory.systemEnvironment()?  for reference: 
http://typesafehub.github.io/config/latest/api/com/typesafe/config/ConfigFactory.html#systemEnvironment--


-Michael

--

 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] Simple HOCON question

2015-04-15 Thread bearrito
Cross posted to stackoverflow

http://stackoverflow.com/questions/29655888/hocon-not-substituting-environment-variables

Anyone have any experience with this issue. Is what I'm attempting even 
feasible?

Thanks in advance,

-barrett

-- 
  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 does akka actor helps in achieve concurrency without locking/syncronization

2015-04-15 Thread Rohit Jain
Correct me If I am wrong, because of message communication design it 
inherently provides distributed locking as well. 

On Wednesday, April 15, 2015 at 10:37:36 PM UTC+5:30, Michael Frank wrote:

  On 04/15/15 04:47, Rohit Jain wrote:
  
  How does using akka actor helps in achieving concurrency without use of 
 any external locks?
  Is it because at a moment only one message can be processed for one 
 actor ? Hence no 2 threads can be acting upon same actor ?
  

 that is correct.  processing within the receive loop of an actor is single 
 threaded.

  If that is the case, then maximum number of threads we require is equal 
 to number of actors in our system.
  

 if all your actors perform blocking work in their receive loop, then that 
 would be true.  however, you should design your application to be 
 non-blocking (http://www.reactivemanifesto.org/glossary#Non-Blocking).  
 if you need to perform blocking work, then you should use Futures (
 http://doc.akka.io/docs/akka/2.3.9/scala/futures.html) to schedule the 
 work on a separate, dedicated dispatcher (
 http://doc.akka.io/docs/akka/2.3.9/scala/dispatchers.html).  You can then 
 pipe the result of the Future to an actor (
 http://doc.akka.io/docs/akka/2.3.9/scala/futures.html#Use_With_Actors) 
 for further processing if necessary.

 -Michael
  

-- 
  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] What is diffrence between actor, actor instance and actorref

2015-04-15 Thread Rohit Jain
What is actually an Actor in context of code. Is it the java class which 
extends UnTypedActor ? i.e. 1 Actor=1 Class. 
If yes, do we have multiple instance of it, simple referred using actorref. 
How does multiple instance of actorref for same actor differs from each 
other ?

What do we mean by actor failing or restart of an actor ? Do we just reload 
the class with last persisted data variables ?

-- 
  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: 500 ISE for Client Side Error Bug Report

2015-04-15 Thread Jim Hazen
I was originally thinking that this would be inconvenient for ES clients. 
 I could work around that.  However for anyone attempting to build a 
transparent proxy in front of ES (where they can't control client calls), 
this would be an impossible to fix solution if a GET with body was 
forbidden.

-- 
  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: 500 ISE for Client Side Error Bug Report

2015-04-15 Thread Jim Hazen
Hmm...

Spray currently allows this and products like ElasticSearch promote GET 
bodies.  This will be a breaking change for me as well once I migrate to 
akka-http.

How opinionated are the developers here?  Can this be more of a guideline 
than a rule? :)

-- 
  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] Simple HOCON question

2015-04-15 Thread bearrito
My project was using an ancient version. I upgraded to 1.2.1 and it seems 
to be working. 

Go get those stackoverflow points if that is your thing!

Thanks,

barrett

On Wednesday, April 15, 2015 at 1:19:19 PM UTC-4, Michael Frank wrote:

  On 04/15/15 09:53, bearrito wrote:
  
 Cross posted to stackoverflow


 http://stackoverflow.com/questions/29655888/hocon-not-substituting-environment-variables

 Anyone have any experience with this issue. Is what I'm attempting even 
 feasible?
  

 this is a shot in the dark, but are you using an older version of 
 typesafe-config?  maybe its a newer-ish feature?  the feature seems to be 
 advertised as you describe, but if you are pulling in typesafe-config as a 
 transient dependency (say from akka), maybe you are getting an older 
 version.

 what happens if you remove the substitution in your .conf file (so parsing 
 is successful) and then print out the contents of 
 ConfigFactory.systemEnvironment()?  for reference: 
 http://typesafehub.github.io/config/latest/api/com/typesafe/config/ConfigFactory.html#systemEnvironment
 --

 -Michael

  

-- 
  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] Simple HOCON question

2015-04-15 Thread Michael Frank

reposted to SO.  glad i was able to help :)

-Michael

On 04/15/15 12:07, bearrito wrote:
this is a shot in the dark, but are you using an older version of 
typesafe-config?  maybe its a newer-ish feature?  the feature seems to 
be advertised as you describe, but if you are pulling in 
typesafe-config as a transient dependency (say from akka), maybe you 
are getting an older version.


what happens if you remove the substitution in your .conf file (so 
parsing is successful) and then print out the contents of 
ConfigFactory.systemEnvironment()?  for reference: 
http://typesafehub.github.io/config/latest/api/com/typesafe/config/ConfigFactory.html#systemEnvironment 
http://typesafehub.github.io/config/latest/api/com/typesafe/config/ConfigFactory.html#systemEnvironment--


--

 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: Number of actors

2015-04-15 Thread Anil M
Thanks for you reply. I will look into the aggregator pattern.

On Wednesday, April 15, 2015 at 1:45:33 AM UTC-4, Adam wrote:

 Hi, 

 First of all, actors are very lightweight and you can have many of them, 
 while an ActorSystem is heavyweight and you should not have many of that 
 (typically you'd have one). 

 As for the pattern you describe - it all depends on the fine details, but 
 if I had to implement a service that needs to get a set of details and was 
 permitted (and required) to return partial results depending on some 
 timeout, I'd have one actor to manage the request, sending the smaller sub 
 requests and I'd indeed use the scheduler to cut this off if tge timeout 
 expires. 

 It might be useful for you to take a look at the aggregator pattern 
 referenced from the docs. It has a lot in common with this.

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


[akka-user] Re: Number of actors

2015-04-15 Thread Vaughn Vernon
Hi Anil,

I provide the Aggregator pattern and approximately 60 others in my upcoming 
book Reactive Enterprise with Actor Model. It's written for Scala and 
Akka, and you can see the preview here:

https://www.safaribooksonline.com/library/view/reactive-enterprise-with/9780133846904/

Best,
Vaughn


On Wednesday, April 15, 2015 at 7:33:10 PM UTC-6, Anil M wrote:

 Thanks for you reply. I will look into the aggregator pattern.

 On Wednesday, April 15, 2015 at 1:45:33 AM UTC-4, Adam wrote:

 Hi, 

 First of all, actors are very lightweight and you can have many of them, 
 while an ActorSystem is heavyweight and you should not have many of that 
 (typically you'd have one). 

 As for the pattern you describe - it all depends on the fine details, but 
 if I had to implement a service that needs to get a set of details and was 
 permitted (and required) to return partial results depending on some 
 timeout, I'd have one actor to manage the request, sending the smaller sub 
 requests and I'd indeed use the scheduler to cut this off if tge timeout 
 expires. 

 It might be useful for you to take a look at the aggregator pattern 
 referenced from the docs. It has a lot in common with this.



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


Re: [akka-user] How does akka actor helps in achieve concurrency without locking/syncronization

2015-04-15 Thread Rohit Jain


On Wednesday, April 15, 2015 at 10:37:36 PM UTC+5:30, Michael Frank wrote:

  On 04/15/15 04:47, Rohit Jain wrote:
  
  How does using akka actor helps in achieving concurrency without use of 
 any external locks?
  Is it because at a moment only one message can be processed for one 
 actor ? Hence no 2 threads can be acting upon same actor ?

  

 that is correct.  processing within the receive loop of an actor is single 
 threaded.

  How does akka make sure that while processing a certain message, no 
other message thread will be processed or there will be no context switch ? 
Or it just uses low level constructs of locking on a certain message before 
processing it, even though context switch for that message thread happens, 
it wont release the lock till message is processed (This can cause trouble 
in blocking I/O).


  If that is the case, then maximum number of threads we require is equal 
 to number of actors in our system.
  

 if all your actors perform blocking work in their receive loop, then that 
 would be true.  however, you should design your application to be 
 non-blocking (http://www.reactivemanifesto.org/glossary#Non-Blocking).  
 if you need to perform blocking work, then you should use Futures (
 http://doc.akka.io/docs/akka/2.3.9/scala/futures.html) to schedule the 
 work on a separate, dedicated dispatcher (
 http://doc.akka.io/docs/akka/2.3.9/scala/dispatchers.html).  You can then 
 pipe the result of the Future to an actor (
 http://doc.akka.io/docs/akka/2.3.9/scala/futures.html#Use_With_Actors) 
 for further processing if necessary.

 -Michael
  

-- 
  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] PubSub and lost (?) messages

2015-04-15 Thread Eugene Dzhurinsky
Hello!

I have 2 actors. deployed to different nodes on cluster:

On consumer:

   val mediator = DistributedPubSubExtension(context.system).mediator

  override def preStart(): Unit = {
log.debug(Subscribing to urls ⇒ {}, self)
mediator ! Subscribe(urls, self)
  }


and on producer:

  val mediator = DistributedPubSubExtension(context.system).mediator
  ...
  mediator ! Publish(urls, GiveMeWork)

I have the test, that verifies the flow between those actors - it starts 
the cluster locally and sets up the environment. It works 100% correctly 
locally, but when running on TeamCity - 1 times of 5 it gets stuck. In logs 
I can see that the message was sent to urls topic, but it seems never 
delivered to the consumer. With debug logs enabled and tracing the dead 
letters I see nothing suspicious - there are no dead letters.

Is it possible that the message may get lost, or consumer unsubscribes 
from the topic somehow? I double checked the logs, and the message is sent 
to the topic after the consumers are subscribed to it - but it would be 
nice to be able to trace down the delivery of the message in the topic.

Thanks!

Akka 2.3.9, Scala 2.11

P/S I'd like to create some simple test case out of my code, but it's 
rather complicated and involves FSM actors, so I'd like to try other 
advices before diving into this ice-hole.

-- 
  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: 500 ISE for Client Side Error Bug Report

2015-04-15 Thread André
Hi Kevin,

see 
https://github.com/akka/akka/blob/release-2.3-dev/akka-http-core/src/main/scala/akka/http/model/HttpMessage.scala#L133

Cheers,
André

On Wednesday, April 15, 2015 at 4:51:33 AM UTC+2, Kevin Meredith wrote:

 There's a Github issue, titled, 500 ISE for Client Side Error -  
 https://github.com/akka/akka/issues/17187.

 For the below error, I grepped for 

 cc2 [ERROR] [04/13/2015 16:01:07.698] 
 [cloud-controller-akka.actor.default-dispatcher-27] 
 [ActorSystem(cloud-controller)] Internal server error, sending 500 response
 cc2 java.lang.IllegalArgumentException: requirement failed: Requests with 
 this method must have an empty entity
 cc2 at scala.Predef$.require(Predef.scala:219)

 $ cd akka 
 $ grep -r method must have an empty entity * | grep -vi test | grep -vi spec
 $

 Where does this code exist? 

 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] [akka-ClusterSharding 2.3.7/2.3.9] After ClusterShardFailover ShardAllocation gets lost

2015-04-15 Thread Wolfgang Friedl
Hi again!

Out of interest, how is it possible to receive a terminated messages from 
Nodes which are still running? 
First I suspected that maybe the leave-command causes a terminated message 
if a watch an actor on a different Node, but my tests showed that this is 
not the case, so why is this the case for ShardRegions? I didn't find 
anything suspicious in the code of the ShardRegion? So maybe you can 
enlighten me I'm really curious ;)

Regards

Wolfgang

Am Mittwoch, 15. April 2015 08:01:21 UTC+2 schrieb Wolfgang Friedl:

 Hi Patrik!

 I've created an issue for this. 
 Thanks for the fast reply.

 Wolfgang 

  

-- 
  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-ClusterSharding 2.3.7/2.3.9] After ClusterShardFailover ShardAllocation gets lost

2015-04-15 Thread Patrik Nordwall
On Wed, Apr 15, 2015 at 8:16 AM, Wolfgang Friedl 
wolfgang.fri...@hotmail.com wrote:

 Hi again!

 Out of interest, how is it possible to receive a terminated messages from
 Nodes which are still running?


It watched an actor that was running on a node (ActorSystem) that was part
of the cluster, and when that node is removed from the cluster death watch
will trigger. The lifecycle of the actor itself and the ActorSystem for
that matter is not tied to the cluster membership, by default. That is the
bug in this case. Actors started by cluster sharding must be stopped when
the node is removed from the cluster.


 First I suspected that maybe the leave-command causes a terminated message
 if a watch an actor on a different Node, but my tests showed that this is
 not the case, so why is this the case for ShardRegions? I didn't find
 anything suspicious in the code of the ShardRegion? So maybe you can
 enlighten me I'm really curious ;)


The missing code is that when it receives MemberRemoved with its own
address it should context.stop(self).

/Patrik



 Regards

 Wolfgang


 Am Mittwoch, 15. April 2015 08:01:21 UTC+2 schrieb Wolfgang Friedl:

 Hi Patrik!

 I've created an issue for this.
 Thanks for the fast reply.

 Wolfgang

   --
  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 http://typesafe.com/ -  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] [akka-ClusterSharding 2.3.7/2.3.9] After ClusterShardFailover ShardAllocation gets lost

2015-04-15 Thread Patrik Nordwall
On Wed, Apr 15, 2015 at 10:36 AM, Wolfgang Friedl 
wolfgang.fri...@hotmail.com wrote:

 Got it!
 I saw I made a mistake in my sample. When I'm watching an actor on a Node
 which is leaving the cluster I now got an Terminated message!

 Thanks for the clarification.


You're welcome. Thanks for reporting!



   --
  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 http://typesafe.com/ -  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] [akka-http] parameter directive: read to a custom class

2015-04-15 Thread Yann Simon
For type safety, I use a value class for IDs, like:
case class ClaimId(id: String) extends AnyVal {
  override def toString: String = id
}

I'd like to read this id from a query parameter.
For the moment, I use this:
parameter('claim_id.as[String] ?) { claimId ⇒
  ... claimId.map(ClaimId.apply) ...
}
(see the code here:
https://github.com/sphereio/cloudqueues-simulator/blob/master/src/main/scala/io/sphere/cloudqueues/Routes.scala#L123
)

I'd prefer to read directly into a ClaimId, like that:
parameter('claim_id.as[ClaimId] ?) { claimId ⇒ ... }

Can somebody show me how to do that?

All ParamMagnet, ParamDef are sealed traits that I cannot use.
I checked the existing tests (
https://github.com/akka/akka/blob/releasing-akka-stream-and-http-experimental-1.0-M5/akka-http-tests%2Fsrc%2Ftest%2Fscala%2Fakka%2Fhttp%2Fserver%2Fdirectives%2FParameterDirectivesSpec.scala)
but have not found something similar.

Thanks,
Yann

-- 
  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-ClusterSharding 2.3.7/2.3.9] After ClusterShardFailover ShardAllocation gets lost

2015-04-15 Thread Wolfgang Friedl
Got it!
I saw I made a mistake in my sample. When I'm watching an actor on a Node 
which is leaving the cluster I now got an Terminated message!

Thanks for the clarification.


  

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