[akka-user] Unresponsive akka persistence Cassandra journal causes View to stop polling

2014-09-04 Thread Michael Diamant
My team uses akka-persistence 2.3.3 and akka-persistence-cassandra 0.3.1. 
 Recently, in production, my team observed a View that did not appear to be 
polling as expected.  The application had been running for about 12 hours 
(and previously has run for much longer without issue).  Updates to 
Cassandra did not propagate to the consuming application.  The consumer did 
not emit any error level logging (in production, logging is set to error). 
 The application is run on multiple nodes.  Restarting one application 
instance fixed the issue (i.e. the View read all events on start-up and 
continued polling as expected).

Having limited instrumentation available, there is not much else that I can 
specify with certainty about the running instances with suspected broken 
Views.  The View actor is created with the default supervision strategy 
(i.e. restart on exception), which rules out the scenario that the actor 
was stopped.  Additionally, local tests were performed to confirm this 
behavior in the event of an exception.  

The hypothesis my team formed to explain the situation is that perhaps a 
call to Cassandra via the akka-persistence-cassandra journal never 
returned.  There are several issues related to the DataStax driver (e.g. 
https://datastax-oss.atlassian.net/browse/JAVA-268) that might be at play 
here.  These issues appear to be resolved in 2.0.4, while 
akka-persistence-cassandra is compiled against 2.0.1.  My team will upgrade 
accordingly.

Assuming this is the issue, I want to voice my concern about how 
akka-persistence handles journals that fail to return a response. 
 Following the code, akka.persistence.Recovery tells the journal to read:
journal ! ReplayMessages(lastSequenceNr + 1L, toSnr, replayMax, 
processorId, self)

Then, based on the response type (success/failure), appropriate callbacks 
are invoked until ultimately in View, onReplayComplete() is invoked.  This 
function is responsible for scheduling the next polling attempt.  If the 
journal fails to respond, then the View never seeks to poll again because 
there is no timeout mechanism (that I am aware of).

If what I'm talking through holds water, would it make sense to consider 
adding a timeout to the View to ensure it continues to attempt polling for 
updates?  It could also make sense to instrument a policy for reporting an 
error when this stale condition is discovered.  I'm happy to think through 
the proposed enhancements further should the hypothesis be validated.

-- 
  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] (Non)Blocking for a Future / Pausing the Mailbox

2014-09-04 Thread Alexandru Nedelcu
I wonder if there's any means for pausing the processing of an actor's
mailbox of messages.

Actually what I have in mind is blocking for the result of a `Future`
without blocking the underlying thread per-se. It would be pretty cool if I
had the possibility of doing a non-blocking `Await.result`.

The use-case I have is this - say I want to save something in some
database, but I don't want the actor to evolve and process new messages
until that save operation is done. It's not something that happens
frequently, so I'm not really worried about the latency, but doing
`Await.result` just feels wrong.

Of course, the alternative would be to communicate the demand back to the
sender after the Future completes, as a sort of acknowledgement that it can
send the next message. But it gets tricky in case the actor receives
messages from multiple senders and blocking for the result just seems
natural.

And short of implementing my own half-backed buffer and state machine for
incoming messages, how could I block the actor for the result of a Future
without actually blocking the thread?

-- 
Alexandru Nedelcu
www.bionicspirit.com

PGP Public Key:
https://bionicspirit.com/key.aexpk

-- 
  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] Unresponsive akka persistence Cassandra journal causes View to stop polling

2014-09-04 Thread Roland Kuhn
Hi Michael,

thanks for the well-reasoned report, you are right that this should be made 
more resilient, please file a ticket. It might be that we fix this together 
with the changes we are planning on the read-side of things, see this thread 
(that I will respond to soon to wrap it up).

Regards,

Roland

4 sep 2014 kl. 03:02 skrev Michael Diamant diamant.mich...@gmail.com:

 My team uses akka-persistence 2.3.3 and akka-persistence-cassandra 0.3.1.  
 Recently, in production, my team observed a View that did not appear to be 
 polling as expected.  The application had been running for about 12 hours 
 (and previously has run for much longer without issue).  Updates to Cassandra 
 did not propagate to the consuming application.  The consumer did not emit 
 any error level logging (in production, logging is set to error).  The 
 application is run on multiple nodes.  Restarting one application instance 
 fixed the issue (i.e. the View read all events on start-up and continued 
 polling as expected).
 
 Having limited instrumentation available, there is not much else that I can 
 specify with certainty about the running instances with suspected broken 
 Views.  The View actor is created with the default supervision strategy (i.e. 
 restart on exception), which rules out the scenario that the actor was 
 stopped.  Additionally, local tests were performed to confirm this behavior 
 in the event of an exception.  
 
 The hypothesis my team formed to explain the situation is that perhaps a call 
 to Cassandra via the akka-persistence-cassandra journal never returned.  
 There are several issues related to the DataStax driver (e.g. 
 https://datastax-oss.atlassian.net/browse/JAVA-268) that might be at play 
 here.  These issues appear to be resolved in 2.0.4, while 
 akka-persistence-cassandra is compiled against 2.0.1.  My team will upgrade 
 accordingly.
 
 Assuming this is the issue, I want to voice my concern about how 
 akka-persistence handles journals that fail to return a response.  Following 
 the code, akka.persistence.Recovery tells the journal to read:
 journal ! ReplayMessages(lastSequenceNr + 1L, toSnr, replayMax, processorId, 
 self)
 
 Then, based on the response type (success/failure), appropriate callbacks are 
 invoked until ultimately in View, onReplayComplete() is invoked.  This 
 function is responsible for scheduling the next polling attempt.  If the 
 journal fails to respond, then the View never seeks to poll again because 
 there is no timeout mechanism (that I am aware of).
 
 If what I'm talking through holds water, would it make sense to consider 
 adding a timeout to the View to ensure it continues to attempt polling for 
 updates?  It could also make sense to instrument a policy for reporting an 
 error when this stale condition is discovered.  I'm happy to think through 
 the proposed enhancements further should the hypothesis be validated.
 
 -- 
  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.



Dr. Roland Kuhn
Akka Tech Lead
Typesafe – Reactive apps on the JVM.
twitter: @rolandkuhn


-- 
  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] Unresponsive akka persistence Cassandra journal causes View to stop polling

2014-09-04 Thread Martin Krasser

Hi Michael,

akka-persistence relies on asyncReplayMessages to complete the returned 
Future either with a result or a failure in any case (incl. a timeout). 
In this case, a response to ReplayMessages will always be generated. The 
communication between the journal actor and persistent actors 
(processors) is always local, so we can (at the moment) assume no 
request or response messages are lost.


The problem is more related to the cassandra journal implementation i.e. 
there seem to be some failure scenarios where the Future returned by 
asyncReplayMessages is not completed, which shouldn't be the case. 
Please open a ticket in akka-persistence-cassandra with information how 
to reproduce this failure scenario, if possible.


Nevertheless, having a timeout mechanism directly in akka-persistence 
would be a reasonable addition. If I remember correctly, this was 
already discussed somewhere on akka-user or the issue tracker.


Thanks,
Martin

On 04.09.14 03:02, Michael Diamant wrote:
My team uses akka-persistence 2.3.3 and akka-persistence-cassandra 
0.3.1.  Recently, in production, my team observed a View that did not 
appear to be polling as expected.  The application had been running 
for about 12 hours (and previously has run for much longer without 
issue).  Updates to Cassandra did not propagate to the consuming 
application.  The consumer did not emit any error level logging (in 
production, logging is set to error).  The application is run on 
multiple nodes.  Restarting one application instance fixed the issue 
(i.e. the View read all events on start-up and continued polling as 
expected).


Having limited instrumentation available, there is not much else that 
I can specify with certainty about the running instances with 
suspected broken Views.  The View actor is created with the default 
supervision strategy (i.e. restart on exception), which rules out the 
scenario that the actor was stopped.  Additionally, local tests were 
performed to confirm this behavior in the event of an exception.


The hypothesis my team formed to explain the situation is that perhaps 
a call to Cassandra via the akka-persistence-cassandra journal never 
returned.  There are several issues related to the DataStax driver 
(e.g. https://datastax-oss.atlassian.net/browse/JAVA-268) that might 
be at play here.  These issues appear to be resolved in 2.0.4, while 
akka-persistence-cassandra is compiled against 2.0.1.  My team will 
upgrade accordingly.


Assuming this is the issue, I want to voice my concern about how 
akka-persistence handles journals that fail to return a response. 
 Following the code, akka.persistence.Recovery tells the journal to read:
journal ! ReplayMessages(lastSequenceNr + 1L, toSnr, replayMax, 
processorId, self)


Then, based on the response type (success/failure), appropriate 
callbacks are invoked until ultimately in View, onReplayComplete() is 
invoked.  This function is responsible for scheduling the next polling 
attempt.  If the journal fails to respond, then the View never seeks 
to poll again because there is no timeout mechanism (that I am aware of).


If what I'm talking through holds water, would it make sense to 
consider adding a timeout to the View to ensure it continues to 
attempt polling for updates?  It could also make sense to instrument a 
policy for reporting an error when this stale condition is discovered. 
 I'm happy to think through the proposed enhancements further should 
the hypothesis be validated.

--
 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 
mailto:akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com 
mailto: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.


--
Martin Krasser

blog:http://krasserm.blogspot.com
code:http://github.com/krasserm
twitter: http://twitter.com/mrt1nz

--

 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] (Non)Blocking for a Future / Pausing the Mailbox

2014-09-04 Thread Roland Kuhn
Hi Alexandru,

your thinking seems to be natural, assuming that the Actor’s mailbox is 
something that you can use and manage to your heart’s content. What we have 
come to realize is that the Mailbox is just an infrastructure piece that has 
the sole purpose of getting message to the actor, nothing else. This mechanism 
should not depend on the actor’s state or be manageable, it just implements the 
Actor Model. Therefore I would suggest that you place your logic in the actor 
itself to make it explicit:

val nominal: Receive = {
  case Request(x) =
askSomeone(x) pipeTo self
context.become(blocked())
  case x = doThings()
}

def blocked(queue: List[Request] = Nil, stored: Int = 0): Receive = {
  case Result(y) =
saveResult(y)
context.become(nominal)
  case Status.Failure(ex) =
// storing failed, do something appropriate
  case x: Request =
// other requests are either stored for later or denied at this point
// storage should be limited and explicit, e.g.
if (stored == max) sender() ! Denied
else context.become(blocked(x :: queue, stored + 1)
}

Keeping the actor responsive is the main goal here; whether you physically 
block it in Await.result or logically by not consuming any messages does not 
matter (of course Await.result also has global disadvantages in addition, as 
you are aware).

Regards,

Roland

4 sep 2014 kl. 09:47 skrev Alexandru Nedelcu a...@bionicspirit.com:

 I wonder if there's any means for pausing the processing of an actor's 
 mailbox of messages.
 
 Actually what I have in mind is blocking for the result of a `Future` without 
 blocking the underlying thread per-se. It would be pretty cool if I had the 
 possibility of doing a non-blocking `Await.result`.
 
 The use-case I have is this - say I want to save something in some database, 
 but I don't want the actor to evolve and process new messages until that save 
 operation is done. It's not something that happens frequently, so I'm not 
 really worried about the latency, but doing `Await.result` just feels wrong.
 
 Of course, the alternative would be to communicate the demand back to the 
 sender after the Future completes, as a sort of acknowledgement that it can 
 send the next message. But it gets tricky in case the actor receives messages 
 from multiple senders and blocking for the result just seems natural.
 
 And short of implementing my own half-backed buffer and state machine for 
 incoming messages, how could I block the actor for the result of a Future 
 without actually blocking the thread?
 
 -- 
 Alexandru Nedelcu
 www.bionicspirit.com
 
 PGP Public Key:
 https://bionicspirit.com/key.aexpk
 
 -- 
  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.



Dr. Roland Kuhn
Akka Tech Lead
Typesafe – Reactive apps on the JVM.
twitter: @rolandkuhn


-- 
  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: How to split an inbound stream on a delimiter character using Akka Streams

2014-09-04 Thread √iktor Ҡlang
Hi Chris,

I think we can shrink the code a bit:

scala class DotChopper extends Transformer[ByteString, ByteString] {
 |   var buffer: ByteString = ByteString.empty
 |   def chop(find: Byte, input: ByteString, startAt: Int, res:
List[ByteString]): (List[ByteString], ByteString) = input.indexOf(find,
startAt) match {
 | case -1 = (res.reverse, input.compact)
 | case x  =
 |   val chunk = input.take(x)
 |   chop(find, input.drop(x + 1), 0, if (chunk.isEmpty) res else
chunk :: res)
 |   }
 |   override def onNext(msg: ByteString) = {
 | val buf = buffer
 | val (output, rest) = chop('.', buf ++ msg, buf.length, Nil)
 | buffer = rest
 | output
 |   }
 |  //override onComplete too if you want to flush the buffer onComplete
 | }
defined class DotChopper

scala new DotChopper
res21: DotChopper = DotChopper@11939712

scala res21.onNext(ByteString())
res22: List[akka.util.ByteString] = List()

scala res21.onNext(ByteString())
res23: List[akka.util.ByteString] = List()

scala res21.onNext(ByteString(foo))
res24: List[akka.util.ByteString] = List()

scala res21.onNext(ByteString(bar))
res25: List[akka.util.ByteString] = List()

scala res21.onNext(ByteString(.))
res26: List[akka.util.ByteString] = List(ByteString(102, 111, 111, 98, 97,
114))

scala res26.map(_.utf8String)
res27: List[String] = List(foobar)

scala res21.onNext(ByteString(...p..i.g...d.o.g.))
res28: List[akka.util.ByteString] = List(ByteString(112), ByteString(105),
ByteString(103), ByteString(100), ByteString(111), ByteString(103))

scala res28.map(_.utf8String)
res29: List[String] = List(p, i, g, d, o, g)

scala res21.onNext(ByteString())
res30: List[akka.util.ByteString] = List()


On Wed, Sep 3, 2014 at 6:50 PM, Chris Baxter cbax...@gmail.com wrote:

 So transform worked for me.  Here is my quick and dirty impl of a
 Transformer and then using that Transformer in a Flow.  Thanks again for
 the help guys.

 class PeriodDelimitedTransformer extends
 Transformer[ByteString,String]{
   val buffer = new ByteStringBuilder

   def onNext(msg:ByteString) = {
 val msgString = msg.utf8String
 val delimIndex = msgString.indexOf('.')
 if (delimIndex == -1){
   buffer.append(msg)
   List.empty
 }
 else{
   val parts = msgString.split(\\.)
   val endsWithDelim = msgString.endsWith(.)

   buffer.putBytes(parts.head.getBytes())
   val currentPiece = buffer.result.utf8String
   val otherPieces = parts.tail.dropRight(1).toList

   buffer.clear
   val lastPart =
   if (endsWithDelim){
   List(parts.last)
   }
   else{
   buffer.putBytes(parts.last.getBytes())
   List.empty
   }


   val result = currentPiece :: otherPieces ::: lastPart
   result
 }

   }
 }
  object BasicTransformation {
   def main(args: Array[String]): Unit = {
 implicit val system = ActorSystem(Sys)
 implicit val mater = FlowMaterializer(MaterializerSettings())

 val data = List(ByteString(Lorem Ipsum is), ByteString(
 simply.Dummy text of.The prin), ByteString(ting.And typesetting
 industry.))
 Flow(data).transform(new
 PeriodDelimitedTransformer).foreach(println(_))
   }
 }

 On Wednesday, September 3, 2014 8:15:33 AM UTC-4, Chris Baxter wrote:

 Posted this on Stackoverflow but haven't seen any activity on it so I
 figured I'd post it here as well.

 I've been playing around with the experimental Akka Streams API a bit and
 I have a use case that I wanted to see how to implement.  For my use case,
 I have a `StreamTcp` based `Flow` that is being fed from binding the input
 stream of connections to my server socket.  The Flow that I have is based
 on `ByteString` data coming into it.  The data that is coming in is going
 to have a delimiter in it that means I should treat everything before the
 delimiter as one message and everything after and up to the next delimiter
 as the next message.  So playing around with a simpler example, using no
 sockets and just static text, this is what I came up with:

 import akka.actor.ActorSystem
 import akka.stream.{ FlowMaterializer, MaterializerSettings }
 import akka.stream.scaladsl.Flow
 import scala.util.{ Failure, Success }
 import akka.util.ByteString
  object BasicTransformation {
   def main(args: Array[String]): Unit = {
 implicit val system = ActorSystem(Sys)
 val data = ByteString(Lorem Ipsum is simply.Dummy text of the
 printing.And typesetting industry.)
 Flow(data).
   splitWhen(c = c == '.').
   foreach{producer =
 Flow(producer).
   filter(c = c != '.').
   fold(new StringBuilder)((sb, c) = sb.append(c.toChar)).
   map(_.toString).
   filter(!_.isEmpty).
   foreach(println(_)).
   consume(FlowMaterializer(MaterializerSettings()))
   }.
   onComplete(FlowMaterializer(MaterializerSettings())) {
 case any =
   system.shutdown
   

Re: [akka-user] Re: Facing Sharding issue in akka-contrib_2.10-2.3.4.jar

2014-09-04 Thread Prakhyat Mallikarjun


 Hi Patrik,

 We solved the issue. The only issue is, we have to mention seed node's in 
configuration. We included below snippet in existing configuration,

 cluster {

seed-nodes = [

  akka.tcp://WorkerSystem@127.0.0.1:4001

 ]

  auto-down-unreachable-after = 20s

 }

I thought for cluster of one node to work, only 
akka.cluster.ClusterActorRefProvider 
is required in configuration. We did not include seed nodes. 

For a cluster to come up ClusterActorRefProvider and seed nodes(in case of 
one node mention self) are must. The configuration should include both.
Front end/Master are in one cluster. Worker node is in different cluster.

Lot of thanks for guiding us through in solving this issue. It helped a lot.

-Prakhyat M M
 

 On Wed, Sep 3, 2014 at 3:22 PM, Prakhyat Mallikarjun prakh...@gmail.com 
 javascript: wrote:

 Patrik,

 Bingo...you got me.

 Alright, then I know what is wrong. You are using cluster sharding on the 
 worker nodes. That is not done in the activator template.
 [Prakhyat]Yes. You are correct.

 The WorkerSystem is not part of the cluster, perhaps not part of any 
 cluster, or do you have a separate cluster for all worker nodes?
 [Prakhyat] The WorkerSystem is not part of the cluster. The workers 
 connect to master by ClusterClient. If you see worker configuration there 
 is no configuration for cluster or seed nodes. It is bare minimum 
 configuration,
 akka {
  actor.provider = akka.cluster.ClusterActorRefProvider
  extensions = [akka.contrib.pattern.ClusterReceptionistExtension]
  remote.netty.tcp.port=4001
  remote.netty.tcp.hostname=127.0.0.1
 }
 contact-points = [
   akka.tcp://ClusterSystem@127.0.0.1:2551   
// Master nodes info
 ]

 As I understand from configuration worker is not part of any cluster. 
 Correct me if I am wrong.

 Do you see the WorkerSystem nodes as Up? Probably not, and then there is 
 no coordinator for the worker nodes, and thereby no progress.
 [Prakhyat] I will check on this have to check the logs. 

 If my guessing is correct you can solve this by make sure that the worker 
 nodes join a separate worker cluster.
 [Prakhyat] Are you asking us to try including worker node with separate 
 cluster? I will try this. In any case please guide me which is the right 
 way. 

 You should also consider if you have a good reason to not include the 
 worker nodes in the same cluster as the master/frontend nodes?
 [Prakhyat] We have not tried workers in same cluster as master and front. 
 If worker is in same cluster as master, do you see ClusterClient required? 
 We thought to use ClusterClient, workers should be in different cluster 
 then master. Correct me if I am wrong.

 Will you have more than 1000 worker nodes? Are they untrusted or unstable?
 [Prakhyat] Yes workers can go beyond 1000. They are trusted.

 If you answer yes on any of these questions then you might have a good 
 reason to not include the worker nodes in the same cluster, otherwise I 
 think you should simplify the architecture by using one single cluster. In 
 that case you would not use ClusterClient, but instead use 
 DistributedPubSub for similar things.
 [Prakhyat] Let me know from the above points, what steps are recommended. 


 If you want to use cluster sharding on the worker node, they must be part 
 of some cluster. You could make them part of the same cluster as the 
 master/frontend, or you can use a separate cluster for the worker nodes.

 Both these options means that you will have a large cluster (1000+ nodes). 
 Even though we have tested large clusters 
 http://typesafe.com/blog/running-a-2400-akka-nodes-cluster-on-google-compute-engine
  with 
 good results there is some point when there will be too much 
 activity/failures and the cluster will not be stable enough. Then you must 
 split up the cluster in smaller separate clusters. I don't know if it makes 
 sense for you to run a few 100 worker nodes in such a cluster, and have 
 many such clusters.

 /Patrik
  



 -Prakhyat M M

 On Wednesday, 3 September 2014 18:23:14 UTC+5:30, Patrik Nordwall wrote:

 Alright, then I know what is wrong. You are using cluster sharding on the 
 worker nodes. That is not done in the activator template.

 The WorkerSystem is not part of the cluster, perhaps not part of any 
 cluster, or do you have a separate cluster for all worker nodes?
 Do you see the WorkerSystem nodes as Up? Probably not, and then there is 
 no coordinator for the worker nodes, and thereby no progress.

 If my guessing is correct you can solve this by make sure that the worker 
 nodes join a separate worker cluster.

 You should also consider if you have a good reason to not include the 
 worker nodes in the same cluster as the master/frontend nodes?
 Will you have more than 1000 worker nodes? Are they untrusted or unstable?
 If you answer yes on any of these questions then you might have a good 
 reason to not include the worker 

[akka-user] [scala] Ask pattern: how to return an exception

2014-09-04 Thread Jaap Taal
Let's say I have an actor that interacts with an FTP server (which is done 
by blocking code from an existing FTP lib).

I have code that uses '?' like this:

val response:Future[Boolean] = ftpActor ? DoesFileExist(filename)

What is the best way to model a general error. I've read that using try 
catch in the actor is not the best way to do it 
(http://doc.akka.io/docs/akka/snapshot/java/howto.html#Single-Use_Actor_Trees_with_High-Level_Error_Reporting).

This custom supervision described in that howto is not what I'm aiming for. 
The ftpActor works 99% of the time, but for the instances that it doesn't, 
the ftpActor doesn't notify the sender of this failure.
Examples could be an incorrectly configured username password.
The caller of DoesFileExist receives a timeout exception which is not 
really what's going on.

So what's generally the best way to have a unhappy path with such an actor? 
I really don't want to add more actors into the equation, just to support 
the unhappy flow.


Thanks,
Jaap

-- 
  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] [scala] Ask pattern: how to return an exception

2014-09-04 Thread √iktor Ҡlang
Hi Jaap,

This is located here in the documentation:

Using ask will send a message to the receiving Actor as with tell, and the
receiving actor must reply withsender() ! reply in order to complete the
returned Future with a value. The ask operation involves creating an
internal actor for handling this reply, which needs to have a timeout after
which it is destroyed in order not to leak resources; see more below.

Warning

To complete the future with an exception you need send a Failure message to
the sender. This is *not done automatically* when an actor throws an
exception while processing a message.


   1. try {
   2.   val result = operation()
   3.   sender() ! result
   4. } catch {
   5.   case e: Exception =
   6. sender() ! akka.actor.Status.Failure(e)
   7. throw e
   8. }



http://doc.akka.io/docs/akka/2.3.5/scala/actors.html

On Thu, Sep 4, 2014 at 1:22 PM, Jaap Taal j...@q42.nl wrote:

 Let's say I have an actor that interacts with an FTP server (which is done
 by blocking code from an existing FTP lib).

 I have code that uses '?' like this:

 val response:Future[Boolean] = ftpActor ? DoesFileExist(filename)

 What is the best way to model a general error. I've read that using try
 catch in the actor is not the best way to do it (
 http://doc.akka.io/docs/akka/snapshot/java/howto.html#Single-Use_Actor_Trees_with_High-Level_Error_Reporting
 ).

 This custom supervision described in that howto is not what I'm aiming
 for. The ftpActor works 99% of the time, but for the instances that it
 doesn't, the ftpActor doesn't notify the sender of this failure.
 Examples could be an incorrectly configured username password.
 The caller of DoesFileExist receives a timeout exception which is not
 really what's going on.

 So what's generally the best way to have a unhappy path with such an
 actor? I really don't want to add more actors into the equation, just to
 support the unhappy flow.


 Thanks,
 Jaap

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




-- 
Cheers,
√

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


Re: [akka-user] in-memory

2014-09-04 Thread ffif
Thanks Konrad Malawski

On Wednesday, September 3, 2014 6:52:09 PM UTC+4:30, Konrad Malawski wrote:

 Hi!
 Yes.

 :-)

 -- 
 Konrad 'ktoso' Malawski
 On 3 Sep 2014 16:21, ffif foroughi...@gmail.com javascript: wrote:

 Hi everybody
 I am new in akka and have two question. If akka supports in memory 
 process?
 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+...@googlegroups.com javascript:.
 To post to this group, send email to akka...@googlegroups.com 
 javascript:.
 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: in-memory

2014-09-04 Thread ffif
my second question : 
what is the diffrence between akka and scala? can we compare them?

On Wednesday, September 3, 2014 6:50:12 PM UTC+4:30, ffif wrote:

 Hi everybody
 I am new in akka and have two question. If akka supports in memory process?
 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] in-memory

2014-09-04 Thread ffif
Thanks so much Konrad Malawski. do you know any reference about it?

On Wednesday, September 3, 2014 6:52:09 PM UTC+4:30, Konrad Malawski wrote:

 Hi!
 Yes.

 :-)

 -- 
 Konrad 'ktoso' Malawski
 On 3 Sep 2014 16:21, ffif foroughi...@gmail.com javascript: wrote:

 Hi everybody
 I am new in akka and have two question. If akka supports in memory 
 process?
 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+...@googlegroups.com javascript:.
 To post to this group, send email to akka...@googlegroups.com 
 javascript:.
 Visit this group at http://groups.google.com/group/akka-user.
 For more options, visit https://groups.google.com/d/optout.



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


Re: [akka-user] in-memory

2014-09-04 Thread √iktor Ҡlang
You'll want to read the documentation: http://akka.io/docs/


On Thu, Sep 4, 2014 at 2:46 PM, ffif foroughi.foro...@gmail.com wrote:

 Thanks so much Konrad Malawski. do you know any reference about it?


 On Wednesday, September 3, 2014 6:52:09 PM UTC+4:30, Konrad Malawski wrote:

 Hi!
 Yes.

 :-)

 --
 Konrad 'ktoso' Malawski
 On 3 Sep 2014 16:21, ffif foroughi...@gmail.com wrote:

 Hi everybody
 I am new in akka and have two question. If akka supports in memory
 process?
 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+...@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 subscribed to the Google Groups
 Akka User List group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to akka-user+unsubscr...@googlegroups.com.
 To post to this group, send email to akka-user@googlegroups.com.
 Visit this group at http://groups.google.com/group/akka-user.
 For more options, visit https://groups.google.com/d/optout.




-- 
Cheers,
√

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


[akka-user] Re: in-memory

2014-09-04 Thread ffif

Thanks so much

-- 
  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] sbt-multi-jvm question

2014-09-04 Thread Roland Kuhn
Hmm, it seems that this question was never answered; did you figure it out? (I 
don’t have IntegrationTest config or similar in my projects)

5 jun 2014 kl. 05:35 skrev Scott Clasen scott.cla...@gmail.com:

 Figured Id ask here since there are probably a lot of users of the plugin here
 
 Any one know the sbt incantation to add the classes present in the 
 IntegrationTest config (src/it/scala) to the classpath of the 
 multi-jvm-plugin.
 
 I have a util class in my integration tests that isnt found when compiling 
 multi-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.



Dr. Roland Kuhn
Akka Tech Lead
Typesafe – Reactive apps on the JVM.
twitter: @rolandkuhn


-- 
  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] (Non)Blocking for a Future / Pausing the Mailbox

2014-09-04 Thread Alexandru Nedelcu
Thanks Roland,

I wanted to avoid the manual plumbing somehow, but I guess it's not that
bad.
Nice sample.


On Thu, Sep 4, 2014 at 11:02 AM, Roland Kuhn goo...@rkuhn.info wrote:

 Hi Alexandru,

 your thinking seems to be natural, assuming that the Actor’s mailbox is
 something that you can use and manage to your heart’s content. What we have
 come to realize is that the Mailbox is just an infrastructure piece that
 has the sole purpose of getting message to the actor, nothing else. This
 mechanism should not depend on the actor’s state or be manageable, it just
 implements the Actor Model. Therefore I would suggest that you place your
 logic in the actor itself to make it explicit:

 val nominal: Receive = {
   case Request(x) =
 askSomeone(x) pipeTo self
 context.become(blocked())
   case x = doThings()
 }

 def blocked(queue: List[Request] = Nil, stored: Int = 0): Receive = {
   case Result(y) =
 saveResult(y)
 context.become(nominal)
   case Status.Failure(ex) =
 // storing failed, do something appropriate
   case x: Request =
 // other requests are either stored for later or denied at this point
 // storage should be limited and explicit, e.g.
 if (stored == max) sender() ! Denied
 else context.become(blocked(x :: queue, stored + 1)
 }

 Keeping the actor responsive is the main goal here; whether you physically
 block it in Await.result or logically by not consuming any messages does
 not matter (of course Await.result also has global disadvantages in
 addition, as you are aware).

 Regards,

 Roland

 4 sep 2014 kl. 09:47 skrev Alexandru Nedelcu a...@bionicspirit.com:

 I wonder if there's any means for pausing the processing of an actor's
 mailbox of messages.

 Actually what I have in mind is blocking for the result of a `Future`
 without blocking the underlying thread per-se. It would be pretty cool if I
 had the possibility of doing a non-blocking `Await.result`.

 The use-case I have is this - say I want to save something in some
 database, but I don't want the actor to evolve and process new messages
 until that save operation is done. It's not something that happens
 frequently, so I'm not really worried about the latency, but doing
 `Await.result` just feels wrong.

 Of course, the alternative would be to communicate the demand back to the
 sender after the Future completes, as a sort of acknowledgement that it can
 send the next message. But it gets tricky in case the actor receives
 messages from multiple senders and blocking for the result just seems
 natural.

 And short of implementing my own half-backed buffer and state machine for
 incoming messages, how could I block the actor for the result of a Future
 without actually blocking the thread?

 --
 Alexandru Nedelcu
 www.bionicspirit.com

 PGP Public Key:
 https://bionicspirit.com/key.aexpk

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




 *Dr. Roland Kuhn*
 *Akka Tech Lead*
 Typesafe http://typesafe.com/ – Reactive apps on the JVM.
 twitter: @rolandkuhn
  http://twitter.com/#!/rolandkuhn

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




-- 
Alexandru Nedelcu
www.bionicspirit.com

PGP Public Key:
https://bionicspirit.com/key.aexpk

-- 
  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] Help! Having trouble overriding my application.conf file with environment-specific conf

2014-09-04 Thread lakshmi
Hello,

I'm using Akka with Java 8. Here is my directory structure and jsvc command 
that runs the application as a daemon

*Directory structure:*

myapp
 \-myapp.jar
 \-configuration
\--application.conf
\--application-dev.conf
\--lib
\--mylib1.jar
\--mylib2.jar
\--daemon-base.sh
\--run.sh


*application-dev.conf:*

include application

akka {
..
..
..
}



*Application run command:*

jsvc.exec -cp 
/deploydir/myapp:/deploydir/myapp/myapp-1.0-SNAPSHOT.jar:/deploydir/myapp:/deploydir/myapp/lib/*.jar:/deploydir/myapp/configuration
 
*-Dconfig.file=/deploydir/myapp/configuration/application-dev.conf* 
-Dakka.log-config-on-start=on -pidfile .myapp.pid 
com.company.myapp.daemon.MyAppDaemon

*MyApp.java:*

Config configuration = ConfigFactory.parseFile(new 
File(configuration/application.conf))
.withFallback(ConfigFactory.load());

*Log of config on startup:*

# merge of configuration/application.conf: 4,system 
properties,/deploydir/myapp/configuration/application-dev.conf: 
3,/deploydir/myapp/configuration/application.conf: 4,system 
properties,reference.conf: 7-77



As you can see in the jsvc command, I am overriding application.conf by 
providing -Dconfig.file. However, when I log the configuration on startup I 
see it is actually overriding the other way. I am not sure what the numbers 
mean exactly, but at least the final result takes the values from 
application.conf instead of application-dev.conf. 

Can you please help me figure out what is wrong with my code?

Thanks a lot!

lakshmi

-- 
  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: Help! Having trouble overriding my application.conf file with environment-specific conf

2014-09-04 Thread lakshmi
Here is the actual config I am interested in overriding:

In configuration/application.conf:

redis {
  back-off-retry {
interval-millis = 100
factor = 2
  }

  host = 10.200.14.60
  port = 6379 
}

In configuration/application.conf:

redis {
  host = 127.0.0.1
}

- lakshmi

On Thursday, September 4, 2014 8:52:44 AM UTC-7, lakshmi wrote:

 Hello,

 I'm using Akka with Java 8. Here is my directory structure and jsvc 
 command that runs the application as a daemon

 *Directory structure:*

 myapp
  \-myapp.jar
  \-configuration
 \--application.conf
 \--application-dev.conf
 \--lib
 \--mylib1.jar
 \--mylib2.jar
 \--daemon-base.sh
 \--run.sh


 *application-dev.conf:*

 include application

 akka {
 ..
 ..
 ..
 }



 *Application run command:*

 jsvc.exec -cp 
 /deploydir/myapp:/deploydir/myapp/myapp-1.0-SNAPSHOT.jar:/deploydir/myapp:/deploydir/myapp/lib/*.jar:/deploydir/myapp/configuration
  
 *-Dconfig.file=/deploydir/myapp/configuration/application-dev.conf* 
 -Dakka.log-config-on-start=on -pidfile .myapp.pid 
 com.company.myapp.daemon.MyAppDaemon

 *MyApp.java:*

 Config configuration = ConfigFactory.parseFile(new 
 File(configuration/application.conf))
 .withFallback(ConfigFactory.load());

 *Log of config on startup:*

 # merge of configuration/application.conf: 4,system 
 properties,/deploydir/myapp/configuration/application-dev.conf: 
 3,/deploydir/myapp/configuration/application.conf: 4,system 
 properties,reference.conf: 7-77



 As you can see in the jsvc command, I am overriding application.conf by 
 providing -Dconfig.file. However, when I log the configuration on startup I 
 see it is actually overriding the other way. I am not sure what the numbers 
 mean exactly, but at least the final result takes the values from 
 application.conf instead of application-dev.conf. 

 Can you please help me figure out what is wrong with my code?

 Thanks a lot!

 lakshmi


-- 
  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: Help! Having trouble overriding my application.conf file with environment-specific conf

2014-09-04 Thread lakshmi
Actually, it looks like I fixed whatever was wrong by letting the default 
load happen, as it already seems to pick up all configuration files from 
the configuration directory.

In MyApp.java, change from:

 Config configuration = ConfigFactory.parseFile(new 
File(configuration/application.conf))
.withFallback(ConfigFactory.load());

To:
Config configuration = ConfigFactory.load();

- lakshmi



On Thursday, September 4, 2014 10:32:58 AM UTC-7, lakshmi wrote:

 Here is the actual config I am interested in overriding:

 In configuration/application.conf:

 redis {
   back-off-retry {
 interval-millis = 100
 factor = 2
   }

   host = 10.200.14.60
   port = 6379 
 }

 In configuration/application.conf:

 redis {
   host = 127.0.0.1
 }

 - lakshmi

 On Thursday, September 4, 2014 8:52:44 AM UTC-7, lakshmi wrote:

 Hello,

 I'm using Akka with Java 8. Here is my directory structure and jsvc 
 command that runs the application as a daemon

 *Directory structure:*

 myapp
  \-myapp.jar
  \-configuration
 \--application.conf
 \--application-dev.conf
 \--lib
 \--mylib1.jar
 \--mylib2.jar
 \--daemon-base.sh
 \--run.sh


 *application-dev.conf:*

 include application

 akka {
 ..
 ..
 ..
 }



 *Application run command:*

 jsvc.exec -cp 
 /deploydir/myapp:/deploydir/myapp/myapp-1.0-SNAPSHOT.jar:/deploydir/myapp:/deploydir/myapp/lib/*.jar:/deploydir/myapp/configuration
  
 *-Dconfig.file=/deploydir/myapp/configuration/application-dev.conf* 
 -Dakka.log-config-on-start=on -pidfile .myapp.pid 
 com.company.myapp.daemon.MyAppDaemon

 *MyApp.java:*

 Config configuration = ConfigFactory.parseFile(new 
 File(configuration/application.conf))
 .withFallback(ConfigFactory.load());

 *Log of config on startup:*

 # merge of configuration/application.conf: 4,system 
 properties,/deploydir/myapp/configuration/application-dev.conf: 
 3,/deploydir/myapp/configuration/application.conf: 4,system 
 properties,reference.conf: 7-77



 As you can see in the jsvc command, I am overriding application.conf by 
 providing -Dconfig.file. However, when I log the configuration on startup I 
 see it is actually overriding the other way. I am not sure what the numbers 
 mean exactly, but at least the final result takes the values from 
 application.conf instead of application-dev.conf. 

 Can you please help me figure out what is wrong with my code?

 Thanks a lot!

 lakshmi



-- 
  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: Integration tests with akka persistence

2014-09-04 Thread Bartłomiej Szczepanik
1) is not feasible in this case, I do cassandra-specific operations. But
definitely I will think about it for unit testing my persistent actors.

2) Thanks, I have no idea why I missed so simple and elegant solution!

3) Indeed, after replacing the Thread.sleeps according to your suggestion
the test is still flaky, what means the real problem is different.

Thanks for help!
Bartłomiej


2014-09-04 19:45 GMT+02:00 Tim Pigden tim.pig...@optrak.com:

 This might not help, but I've done various different things at different
 times:
 1. if you're not testing the Casandra persistence per se, but the other
 components, consider using an in-memory storage plugin. This will very fast
 and on an otherwise unused machine should not display high variability in
 wait times. So a small wait may be sufficient. if you fire up another
 PersistentActor with the same id at the end then it will try to replay the
 messages from the journal so you can check they are all there.
 2. Figure out if there's a logical point at which one of the actors can
 signal I'm done to some run-time specified actor. Use this in your test
 with an ExpectMsg to wait until it's done. Maybe extend an  base actor
 class with some form of mock to achieve this. So I have base class actors,
 with empty return signal methods and extend them in test to make it
 actually do something. It means you go into production with a call to an
 empty method but it's small scale in the scheme of things.
 3. Question whether or not the large variability in time is itself a test
 failure. I've often increased time waiting for a message only to find that
 the delay was caused by a bug of some sort.


 On Thursday, September 4, 2014 4:55:43 PM UTC+1, Bartłomiej Szczepanik
 wrote:

 Dear Akka users,

 I am working on a simple CQRS framework on top of the akka persistence. I
 am unsuccessfully trying to create a non-flaky integration test which
 involves:

- spawning some persistent actors
- sending some messages to them
- *waiting for a while to make sure that the journal will be updated* 
 (cassandra
in my case)
- replay events using a direct journal reader

 The problem is with the third step. Simply waiting for a while seems to
 be not enough in some cases, even if I set a longer time (several seconds).
 Can you recommend me a way to have a more reliable test? Can I wait somehow
 until all persistAsync methods will be completed fully and events visible
 in the journal?

 Thanks,
 Bartłomiej

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