Re: [akka-user] [akka-streams] FlexiMerge/FlexiRoute parameters

2015-06-02 Thread Adam Warski


 I've been writing some simple code using FlexiMerge/FlexiRoute, and I'm 
 wondering why both have a single required OperationAttributes parameter? 
 Maybe there should be a * at the end to allow 0-* such parameters?


 You can combine attributes with the and combinator if you want to attach 
 more than one.


Can I attach 0? :)
 

 A side-question, I'm not really sure why this is so, but when I have a 
 Merge, I can just do:

 in ~ merge ~ out

 But when I have a FlexiMerge, I need to do:

 in ~ flexiMerge.in0
  flexiMerge.out ~ out

 it seems Merge's shape is also an Inlet, but I can't find that in the 
 code :)


 No, Merge has a shape of UniformFanIn. The sugared version of connecting 
 merge/broadcast only works because the DSL understands UniformFanin/Fanout 
 shapes, but it does not know about other shapes, since they can have 
 different types for each port (inlet/outlet). 


Ah! Now I have:

class SplitRoute[T](splitFn: T = Either[T, T]) extends FlexiRoute[T, 
UniformFanOutShape[T, T]](
  new UniformFanOutShape(2), OperationAttributes.name(SplitRoute)) { ... }

and I can use the nicer DSL.

Thanks,
Adam 

-- 
  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 Streams - Issue with processing different length streams through drop/zip

2015-06-02 Thread Akka Team
Wow!

What did you use for the animation? I want that :D

-Endre

On Tue, Jun 2, 2015 at 12:10 AM, Lance Arlaus lance.arl...@gmail.com
wrote:

 Circling back on this, I created a blog post that explains the issue I
 encountered along with the solution of using a balancing buffer.


 http://blog.lancearlaus.com/akka/streams/scala/2015/05/27/Akka-Streams-Balancing-Buffer/

 I hope it helps those who encounter the same issue.


 On Saturday, May 9, 2015 at 11:49:48 AM UTC-4, Lance Arlaus wrote:

 No problem.
 Thanks for the quick response and here's the corresponding issue:
 https://github.com/akka/akka/issues/17435

 On Saturday, May 9, 2015 at 5:05:44 AM UTC-4, drewhk wrote:

 Hi Lance,

 On Sat, May 9, 2015 at 12:49 AM, Lance Arlaus lance@gmail.com
 wrote:

 Hi-

 I've encountered an issue with processing a stream that I fan out via
 broadcast and fan in via zip.
 The broadcast splits the stream in two with one branch containing a
 drop element.
 According to my read of the docs, I would expect the terminating zip to
 complete when the shorter of the two streams (the one with the drop)
 completes.
 However, the flow hangs waiting indefinitely.

 Here's the relevant part of a test case I put together to reproduce the
 problem.
 Note that the flow without the drop (the first flow) works fine with
 different length streams.
 What am I doing wrong?


 I don't think you are doing anything wrong. Btw, I suspect the bug being
 in Broadcast instead. Can you file a ticket please?

 -Endre



 Akka Stream Version: 1.0-RC2

 Thanks,
 Lance

   // This flow works fine
   def zipSource(num: Int, diff: Int) = Source() { implicit b =
 import akka.stream.scaladsl.FlowGraph.Implicits._

 val source0 = b.add(Source(1 to num))
 val source1 = b.add(Source(1 to (num + diff)))
 val zip = b.add(Zip[Int, Int])

 source0 ~ zip.in0
 source1 ~ zip.in1

 (zip.out)
   }

   // This flow waits indefinitely when diff  0
   def zipDropSource(num: Int, diff: Int) = Source() {  implicit b =
 import akka.stream.scaladsl.FlowGraph.Implicits._

 val source = b.add(Source(1 to (num + diff)))
 val bcast = b.add(Broadcast[Int](2))
 val drop = b.add(Flow[Int].drop(diff))
 val zip = b.add(Zip[Int, Int])

 source ~ bcast ~ zip.in0
   bcast ~ drop ~ zip.in1

 (zip.out)
   }

   // PASS
   Zip should complete with same length streams in {
 val future: Future[Int] = zipSource(10,
 10).runWith(Sink.fold(0)((s, i) = s + 1))
 whenReady(future)(_ shouldBe 10)
   }

   // PASS
   it should complete with different length streams in {
 val future: Future[Int] = zipSource(10,
 20).runWith(Sink.fold(0)((s, i) = s + 1))
 whenReady(future)(_ shouldBe 10)
   }

   // PASS
   Zip with drop should complete with same length streams in {
 val future: Future[Int] = zipDropSource(10,
 0).runWith(Sink.fold(0)((s, i) = s + 1))
 whenReady(future)(_ shouldBe 10)
   }

   // FAIL
   it should complete with different length streams in {
 val future: Future[Int] = zipDropSource(10,
 10).runWith(Sink.fold(0)((s, i) = s + 1))
 whenReady(future)(_ shouldBe 10)
   }

 }

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




-- 
Akka Team
Typesafe - Reactive apps on the JVM
Blog: letitcrash.com
Twitter: @akkateam

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

Re: [akka-user] Java: Yet another get or create actor question

2015-06-02 Thread Roland Kuhn
Thanks for raising this, we should fix it 
https://github.com/akka/akka/issues/17635 for Akka 2.4 by offering a method 
that gives you an Optional instead of a Scala Option.

Regards,

Roland

 1 jun 2015 kl. 02:50 skrev Guido Medina oxyg...@gmail.com:
 
 Is there any way to avoid the verbosity?, I try with a more functional 
 approach which was OK for IntelliJ but not for the Java 8 compiler, here is 
 the form that is working:
 
   private void applyToAccount(Currency currency, BalanceOperation operation) {
 context().child(currency.code).
   getOrElse(new AbstractFunction0OptionActorRef() {
 @Override
 public OptionActorRef apply() {
   return 
 Option.some(context().actorOf(balancePersistorProps(currency), 
 currency.code));
 }
   }).
   get().forward(operation, context);
   }
 
 
 But I was hoping the following would work, but Java 8 can't infer the type, 
 strange IntelliJ recognizes it I guess the mix of Java and Scala drives it 
 crazy:
 
  
 private void applyToAccount(Currency currency, BalanceOperation operation) {
 context().child(currency.code).
   getOrElse(() - 
 Option.some(context().actorOf(balancePersistorProps(currency), 
 currency.code))).
   get().forward(operation, context);
   }
 
 
 Best regards.
 
 -- 
  Read the docs: http://akka.io/docs/ http://akka.io/docs/
  Check the FAQ: 
  http://doc.akka.io/docs/akka/current/additional/faq.html 
  http://doc.akka.io/docs/akka/current/additional/faq.html
  Search the archives: https://groups.google.com/group/akka-user 
  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 
 http://groups.google.com/group/akka-user.
 For more options, visit https://groups.google.com/d/optout 
 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.


Re: [akka-user] akka remoting over ssl with client auth

2015-06-02 Thread Akka Team
Hi Jim,



On Mon, Jun 1, 2015 at 10:20 PM, Jim Newsham jim.news...@gmail.com wrote:


 Thanks Andre for your reply.  I am aware of the constraints of Akka
 remoting, and in fact I feel that the link you referenced actually supports
 an argument for two-way authentication.  Communication between remoting
 nodes must be symmetric, which implies that authentication should be
 performed in both directions and there should be no specific client/server
 roles (as would be implied by a one-way authentication).

 Consider what happens when only one-way authentication is used, and trust
 is only established in one direction -- say, because of improperly
 configured keystore/truststore on one of the nodes.  In this case,
 connection can only be established when initiated in one direction, but not
 in the opposite direction, which violates the symmetric communication
 requirement.  As a result, the peers will experience intermittent
 communication problems which may be hard to diagnose.  On the other hand if
 two-way authentication were required, the setup would fail-fast -- no
 communication would be established until the trust configuration is
 corrected.


These are good points, I will revive the ticket properly. I think it will
only make into 2.4 though, but you should follow the ticket for updates.

-Endre



 Regards,
 Jim

 On Monday, June 1, 2015 at 2:04:12 AM UTC-10, Akka Team wrote:

 Hi Jim,

 Akka Remoting has no support for this feature (see ticket
 https://github.com/akka/akka/issues/13874). While we might implement
 this in the future, you should consider that Akka remoting is designed to
 work intra-datacenter and not inter-datacenter. If inter-datacenter
 communciation is needed then it is recommended to use normal client-server
 technologies like akka io (for TCP) or spray (for HTTP), not just because
 of security, but because of the underlying assumptions in remoting (see
 http://doc.akka.io/docs/akka/2.3.11/general/remoting.html#Peer-to-Peer_vs__Client-Server
 )

 -Endre

 On Wed, May 27, 2015 at 12:04 AM, Jim Newsham jim.n...@gmail.com wrote:


 For security reasons, we would like to enable two-way ssl authentication
 for our akka remoting communication.  Is this possible?

 Thanks,
 Jim

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




 --
 Akka Team
 Typesafe - Reactive apps on the JVM
 Blog: letitcrash.com
 Twitter: @akkateam

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




-- 
Akka Team
Typesafe - Reactive apps on the JVM
Blog: letitcrash.com
Twitter: @akkateam

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


Re: [akka-user] Akka Streams - Issue with processing different length streams through drop/zip

2015-06-02 Thread Akka Team
Btw, small nitpick: The animation shows what I call the synchronous
execution model, where the demand starts from the end of the stream and
travels back and forth (branching out if necessary). In reality, these
stages individually demand the first element when they are started, and
they immediately request the next element once they started working on a
received element.

-Endre

On Tue, Jun 2, 2015 at 10:10 AM, Akka Team akka.offic...@gmail.com wrote:

 Wow!

 What did you use for the animation? I want that :D

 -Endre

 On Tue, Jun 2, 2015 at 12:10 AM, Lance Arlaus lance.arl...@gmail.com
 wrote:

 Circling back on this, I created a blog post that explains the issue I
 encountered along with the solution of using a balancing buffer.


 http://blog.lancearlaus.com/akka/streams/scala/2015/05/27/Akka-Streams-Balancing-Buffer/

 I hope it helps those who encounter the same issue.


 On Saturday, May 9, 2015 at 11:49:48 AM UTC-4, Lance Arlaus wrote:

 No problem.
 Thanks for the quick response and here's the corresponding issue:
 https://github.com/akka/akka/issues/17435

 On Saturday, May 9, 2015 at 5:05:44 AM UTC-4, drewhk wrote:

 Hi Lance,

 On Sat, May 9, 2015 at 12:49 AM, Lance Arlaus lance@gmail.com
 wrote:

 Hi-

 I've encountered an issue with processing a stream that I fan out via
 broadcast and fan in via zip.
 The broadcast splits the stream in two with one branch containing a
 drop element.
 According to my read of the docs, I would expect the terminating zip
 to complete when the shorter of the two streams (the one with the drop)
 completes.
 However, the flow hangs waiting indefinitely.

 Here's the relevant part of a test case I put together to reproduce
 the problem.
 Note that the flow without the drop (the first flow) works fine with
 different length streams.
 What am I doing wrong?


 I don't think you are doing anything wrong. Btw, I suspect the bug
 being in Broadcast instead. Can you file a ticket please?

 -Endre



 Akka Stream Version: 1.0-RC2

 Thanks,
 Lance

   // This flow works fine
   def zipSource(num: Int, diff: Int) = Source() { implicit b =
 import akka.stream.scaladsl.FlowGraph.Implicits._

 val source0 = b.add(Source(1 to num))
 val source1 = b.add(Source(1 to (num + diff)))
 val zip = b.add(Zip[Int, Int])

 source0 ~ zip.in0
 source1 ~ zip.in1

 (zip.out)
   }

   // This flow waits indefinitely when diff  0
   def zipDropSource(num: Int, diff: Int) = Source() {  implicit b =
 import akka.stream.scaladsl.FlowGraph.Implicits._

 val source = b.add(Source(1 to (num + diff)))
 val bcast = b.add(Broadcast[Int](2))
 val drop = b.add(Flow[Int].drop(diff))
 val zip = b.add(Zip[Int, Int])

 source ~ bcast ~ zip.in0
   bcast ~ drop ~ zip.in1

 (zip.out)
   }

   // PASS
   Zip should complete with same length streams in {
 val future: Future[Int] = zipSource(10,
 10).runWith(Sink.fold(0)((s, i) = s + 1))
 whenReady(future)(_ shouldBe 10)
   }

   // PASS
   it should complete with different length streams in {
 val future: Future[Int] = zipSource(10,
 20).runWith(Sink.fold(0)((s, i) = s + 1))
 whenReady(future)(_ shouldBe 10)
   }

   // PASS
   Zip with drop should complete with same length streams in {
 val future: Future[Int] = zipDropSource(10,
 0).runWith(Sink.fold(0)((s, i) = s + 1))
 whenReady(future)(_ shouldBe 10)
   }

   // FAIL
   it should complete with different length streams in {
 val future: Future[Int] = zipDropSource(10,
 10).runWith(Sink.fold(0)((s, i) = s + 1))
 whenReady(future)(_ shouldBe 10)
   }

 }

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




 --
 Akka Team
 Typesafe - Reactive apps on the JVM
 Blog: letitcrash.com
 Twitter: @akkateam




-- 
Akka Team
Typesafe - Reactive apps on the JVM
Blog: letitcrash.com

[akka-user] On Reconnecting Client Connections

2015-06-02 Thread Peter Swift
Hello,
  I'm working on a client-side application atop tcp streams, and I'm 
curious what is the recommended approach for handling reconnects. I'm 
thinking to wrap the underlying transport flow in an AsyncStage, and then 
rematerialize the transport on completion. It would look something like 
this:

class ReconnectionStage[In, Out](transport: Flow[In, Out, Any], 
maxInFlight: Int) extends AsyncStage[In, Out, Any] {
  private var inFlight = 0
  private val buffer = FixedSizeBuffer[Out](maxInFlight)

  private var fm: FlowMaterializer = _
  private var callback: AsyncCallback[Any] = _
  private var runnableFlow: RunnableFlow[(ActorRef, Future[Unit])] = _

  private var input: ActorRef = _

  private def connect() {
val (ref, future) = runnableFlow.run()(fm)
input = ref
future.onComplete( _ = callback.invoke(Reconnect))(fm.executionContext)
  }
  
  override def preStart(ctx: AsyncContext[Out, Any]) {
fm = ctx.materializer
callback = ctx.getAsyncCallback()
runnableFlow = Source.actorRef(maxInFlight, OverflowStrategy.fail)
  .via(transport).toMat(Sink.foreach(callback.invoke))(Keep.both)
  }
  ...
}

It's a bit involved, and I haven't yet finished -- so I guess I'm just here 
to check if I'm even on the right track :)

Cheers,
Peter

-- 
  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 to test for exception from actor after waiting for some time?

2015-06-02 Thread Harit Himanshu
Hi

Here is how my actor works

package com.learner.ahka.ruforever

import akka.actor.Status.Failure
import akka.actor.{Actor, ActorLogging, Props}
import akka.event.LoggingReceive
import akka.pattern.pipe

object Runner {
  def props(race: Race) = Props(classOf[Runner], race)
}

class Runner(race: Race) extends Actor with ActorLogging {

  import context.dispatcher

  @throws[Exception](classOf[Exception])
  override def postRestart(reason: Throwable): Unit = context.parent ! 
RestartRunner

  override def receive: Receive = LoggingReceive {
case Start = {
  sender ! OK
  log.debug(running...)
  Thread.sleep(10)
  throw new RuntimeException(MarathonRunner is tired)
}

case StartWithFuture =
  log.debug(I am starting to run)
  race.start pipeTo self

case Failure(throwable) = throw throwable

case Stop =
  log.debug(stopping runner)
  context.stop(self)
  }
}


I want to test that an exception is thrown, so my test looks like  

import akka.actor.ActorSystem
import akka.testkit.{ImplicitSender, TestActorRef, TestKit}
import org.scalatest._

class RunnerSpec extends TestKit(ActorSystem(testSystem))
with WordSpecLike
with MustMatchers
with ImplicitSender {
  A Runner Actor must {
return message to Sender in {
  val runner = TestActorRef(new Runner(new Marathon), testRunner)
  runner ! Start
  expectMsg(OK)
}

must fail after running for a while in {
  val runner = TestActorRef(new Runner(new Marathon))
Thread.sleep(10)
intercept[RuntimeException]{runner ! Start}
}
  }
}

The test fails for  must fail after running for a while. I also tried

within(20 millis) {
  val runner = TestActorRef(new Runner(new Marathon))
Thread.sleep(10)
intercept[RuntimeException]{runner ! Start}
}

and this did not work either. There are two interesting observations from 
the logs though


   1. The exception is actually thrown
   2. The actor gets restarted. The supervisionStrategy is in parent and 
   child doesn't know about it, then why does it gets restarted?

What is not right here?

Thank you

Log
[DEBUG] [06/02/2015 11:00:37.783] [ScalaTest-run] 
[EventStream(akka://testSystem)] logger log1-Logging$DefaultLogger started
[DEBUG] [06/02/2015 11:00:37.799] [ScalaTest-run] 
[EventStream(akka://testSystem)] Default Loggers started
[DEBUG] [06/02/2015 11:00:37.806] 
[testSystem-akka.actor.default-dispatcher-4] [akka://testSystem/system] now 
supervising Actor[akka://testSystem/system/deadLetterListener#959366574]
[DEBUG] [06/02/2015 11:00:37.808] 
[testSystem-akka.actor.default-dispatcher-3] 
[akka://testSystem/system/deadLetterListener] started 
(akka.event.DeadLetterListener@4456c305)
[DEBUG] [06/02/2015 11:00:37.830] 
[testSystem-akka.actor.default-dispatcher-4] 
[akka://testSystem/system/testActor1] started 
(akka.testkit.TestActor@7956e808)
[DEBUG] [06/02/2015 11:00:37.831] 
[testSystem-akka.actor.default-dispatcher-4] [akka://testSystem/system] now 
supervising Actor[akka://testSystem/system/testActor1#-500730560][DEBUG] 
[06/02/2015 11:00:38.263] [testSystem-akka.actor.default-dispatcher-3] 
[akka://testSystem/user] now supervising 
TestActor[akka://testSystem/user/testRunner]
[DEBUG] [06/02/2015 11:00:38.267] [ScalaTest-run-running-RunnerSpec] 
[akka://testSystem/user/testRunner] started 
(com.learner.ahka.ruforever.Runner@2657d4dd)
[DEBUG] [06/02/2015 11:00:38.269] [ScalaTest-run-running-RunnerSpec] 
[akka://testSystem/user/testRunner] received handled message Start
[DEBUG] [06/02/2015 11:00:38.274] [ScalaTest-run-running-RunnerSpec] 
[akka://testSystem/user/testRunner] running...
[ERROR] [06/02/2015 11:00:38.290] 
[testSystem-akka.actor.default-dispatcher-4] 
[akka://testSystem/user/testRunner] MarathonRunner is tired
*java.lang.RuntimeException: MarathonRunner is tired*
at 
com.learner.ahka.ruforever.Runner$$anonfun$receive$1.applyOrElse(Runner.scala:24)
at 
scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:36)
at akka.event.LoggingReceive.apply(LoggingReceive.scala:62)
at akka.event.LoggingReceive.apply(LoggingReceive.scala:50)
at scala.PartialFunction$class.applyOrElse(PartialFunction.scala:123)
at akka.event.LoggingReceive.applyOrElse(LoggingReceive.scala:50)
at akka.actor.Actor$class.aroundReceive(Actor.scala:467)
at com.learner.ahka.ruforever.Runner.aroundReceive(Runner.scala:12)
at akka.actor.ActorCell.receiveMessage(ActorCell.scala:516)
at akka.actor.ActorCell.invoke(ActorCell.scala:487)
at 
akka.testkit.CallingThreadDispatcher.process$1(CallingThreadDispatcher.scala:251)
at 
akka.testkit.CallingThreadDispatcher.runQueue(CallingThreadDispatcher.scala:284)
at 
akka.testkit.CallingThreadDispatcher.dispatch(CallingThreadDispatcher.scala:208)
at akka.actor.dungeon.Dispatch$class.sendMessage(Dispatch.scala:123)
at akka.actor.ActorCell.sendMessage(ActorCell.scala:369)
at akka.actor.Cell$class.sendMessage(ActorCell.scala:290)
at 

[akka-user] Re: getting config back from getContext().system()

2015-06-02 Thread TS
Thanks, That works.

On Tuesday, June 2, 2015 at 9:17:43 AM UTC-7, Guido Medina wrote:

 I'm doing that from Java by calling the Scala API's, like this:

 context().system().settings().config()


-- 
  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 to configure downing in akka cluster when a singleton is present

2015-06-02 Thread Michael Irzh


I read in Akka's documentation that when using cluster singleton one should 
avoid using automatic downing. I don't understand how should downing be 
configured in that case. I understand that I may subscribe to cluster 
membership events and plan my strategy according to those messages. 
However, I don't understand how practically it will be different from 
automatic downing.


When a node is somehow partitioned from the cluster, if automatic downing 
is used, the partitioned node will think that the entire cluster went 
missing and start a cluster of its own (with its own singleton). But, on 
the other hand, I can't keep unreachable nodes in unreachable state forever 
because the cluster won't reach convergence (new nodes won't be able to 
join) and if the partitioned node is the singleton itself a new singleton 
node won't be assigned and therefor, according to my understanding, the 
only thing that is left to do is to remove unreachable nodes after some 
grace time which is exactly what automatic downing does.


What do I miss here?


p.s

Also posted at stackoverflow:

http://stackoverflow.com/questions/30575174/how-to-configure-downing-in-akka-cluster-when-a-singleton-is-present

-- 
  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] [Solved] Re: How to test for exception from actor after waiting for some time?

2015-06-02 Thread Harit Himanshu
I solved it with help. The reasons were

1.) If in test you do not provide the superVisionStrategy, Default kicks in 
which is to restart
2.) I had to use expectTerminated  

The code looks like 

class RunnerSpec extends TestKit(ActorSystem(testSystem))with 
FlatSpecLikewith MustMatcherswith ImplicitSender {
  behavior of A Marathon runner

  it must must fail with exception in {
val supervisorRef = TestActorRef[DummySupervisor]
val runnerRef = TestActorRef(Runner.props(new Marathon), supervisorRef, 
runnerFail)
runnerRef ! Start
expectMsg(OK)
watch(runnerRef)
expectTerminated(runnerRef, 10 millis)
  }}
class DummySupervisor extends Coach {
  override def supervisorStrategy: SupervisorStrategy = OneForOneStrategy() {
case _: RuntimeException = stop
  }}


On Tuesday, June 2, 2015 at 11:01:47 AM UTC-7, Harit Himanshu wrote:

 Hi

 Here is how my actor works

 package com.learner.ahka.ruforever

 import akka.actor.Status.Failure
 import akka.actor.{Actor, ActorLogging, Props}
 import akka.event.LoggingReceive
 import akka.pattern.pipe

 object Runner {
   def props(race: Race) = Props(classOf[Runner], race)
 }

 class Runner(race: Race) extends Actor with ActorLogging {

   import context.dispatcher

   @throws[Exception](classOf[Exception])
   override def postRestart(reason: Throwable): Unit = context.parent ! 
 RestartRunner

   override def receive: Receive = LoggingReceive {
 case Start = {
   sender ! OK
   log.debug(running...)
   Thread.sleep(10)
   throw new RuntimeException(MarathonRunner is tired)
 }

 case StartWithFuture =
   log.debug(I am starting to run)
   race.start pipeTo self

 case Failure(throwable) = throw throwable

 case Stop =
   log.debug(stopping runner)
   context.stop(self)
   }
 }


 I want to test that an exception is thrown, so my test looks like  

 import akka.actor.ActorSystem
 import akka.testkit.{ImplicitSender, TestActorRef, TestKit}
 import org.scalatest._

 class RunnerSpec extends TestKit(ActorSystem(testSystem))
 with WordSpecLike
 with MustMatchers
 with ImplicitSender {
   A Runner Actor must {
 return message to Sender in {
   val runner = TestActorRef(new Runner(new Marathon), testRunner)
   runner ! Start
   expectMsg(OK)
 }

 must fail after running for a while in {
   val runner = TestActorRef(new Runner(new Marathon))
 Thread.sleep(10)
 intercept[RuntimeException]{runner ! Start}
 }
   }
 }

 The test fails for  must fail after running for a while. I also tried

 within(20 millis) {
   val runner = TestActorRef(new Runner(new Marathon))
 Thread.sleep(10)
 intercept[RuntimeException]{runner ! Start}
 }

 and this did not work either. There are two interesting observations from 
 the logs though


1. The exception is actually thrown
2. The actor gets restarted. The supervisionStrategy is in parent and 
child doesn't know about it, then why does it gets restarted?

 What is not right here?

 Thank you

 Log
 [DEBUG] [06/02/2015 11:00:37.783] [ScalaTest-run] 
 [EventStream(akka://testSystem)] logger log1-Logging$DefaultLogger started
 [DEBUG] [06/02/2015 11:00:37.799] [ScalaTest-run] 
 [EventStream(akka://testSystem)] Default Loggers started
 [DEBUG] [06/02/2015 11:00:37.806] 
 [testSystem-akka.actor.default-dispatcher-4] [akka://testSystem/system] now 
 supervising Actor[akka://testSystem/system/deadLetterListener#959366574]
 [DEBUG] [06/02/2015 11:00:37.808] 
 [testSystem-akka.actor.default-dispatcher-3] 
 [akka://testSystem/system/deadLetterListener] started 
 (akka.event.DeadLetterListener@4456c305)
 [DEBUG] [06/02/2015 11:00:37.830] 
 [testSystem-akka.actor.default-dispatcher-4] 
 [akka://testSystem/system/testActor1] started 
 (akka.testkit.TestActor@7956e808)
 [DEBUG] [06/02/2015 11:00:37.831] 
 [testSystem-akka.actor.default-dispatcher-4] [akka://testSystem/system] now 
 supervising Actor[akka://testSystem/system/testActor1#-500730560][DEBUG] 
 [06/02/2015 11:00:38.263] [testSystem-akka.actor.default-dispatcher-3] 
 [akka://testSystem/user] now supervising 
 TestActor[akka://testSystem/user/testRunner]
 [DEBUG] [06/02/2015 11:00:38.267] [ScalaTest-run-running-RunnerSpec] 
 [akka://testSystem/user/testRunner] started 
 (com.learner.ahka.ruforever.Runner@2657d4dd)
 [DEBUG] [06/02/2015 11:00:38.269] [ScalaTest-run-running-RunnerSpec] 
 [akka://testSystem/user/testRunner] received handled message Start
 [DEBUG] [06/02/2015 11:00:38.274] [ScalaTest-run-running-RunnerSpec] 
 [akka://testSystem/user/testRunner] running...
 [ERROR] [06/02/2015 11:00:38.290] 
 [testSystem-akka.actor.default-dispatcher-4] 
 [akka://testSystem/user/testRunner] MarathonRunner is tired
 *java.lang.RuntimeException: MarathonRunner is tired*
 at 
 com.learner.ahka.ruforever.Runner$$anonfun$receive$1.applyOrElse(Runner.scala:24)
 at 
 scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:36)
 at 

[akka-user] [akka-http] Write directive ensuring request entity is HttpEntity.Default?

2015-06-02 Thread Michael Hamrah
I'd like to create a directive that matches when the request.entity is of 
type HttpEntity.Default. Specifically, I'd like to know when the 
Content-Length header is set. It seems that I can't use any of the 
HeaderDirectives because Content-Length is not part of request.headers, but 
instead a property of the http entity property, depending on the type of 
entity.

Do you have suggestions on either: 

* Filtering on Content-Length being set in a header in a route
* Calling extractRequest, but only if the request.entity is of 
HttpEntity.Default
* Adding a directive matching on HttpEntity.Default.

Thanks,

Mike

-- 
  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: akka/parboiled2/ParserInput Not found but only when running scalatest in Scala Ide

2015-06-02 Thread Gary Struthers
Pardon my myopia, IDE build path was org.parboiled should be 
aka-parsing-experimental. 
Now it works in ide.

Gary

-- 
  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] Connection reset by peer in Akka Streams RC2

2015-06-02 Thread Russell Cohen
Hi All,
  We've been trying to debug a tricky intermittent failure mode we're 
having with akka-streams. We are setting up a large fan in (~32 nodes) and 
periodically one of the nodes will inexplicably lead to an RST packet being 
sent, aborting the entire graph. Below, I have debug logging from the 
fan-in master as well as from the child that sent the failing packet along 
with my commentary:


Fan in master:

[DEBUG] [06/02/2015 18:13:09.228] [nrt-akka.actor.default-dispatcher-25] [
akka.tcp://nrt@long-nrt-1:2551/system/IO-TCP/selectors/$a/143] Attempting 
connection to [long-nrt-20/IP_REDACTED:2552]
[DEBUG] [06/02/2015 18:13:09.229] [nrt-akka.actor.default-dispatcher-19] [
akka.tcp://nrt@long-nrt-1:2551/system/IO-TCP/selectors/$a/143] Connection 
established to [long-nrt-20/IP_REDACTED:2552]
[DEBUG] [06/02/2015 18:13:09.230] [nrt-akka.actor.default-dispatcher-25] [
akka.tcp://nrt@long-nrt-1:2551/system/IO-TCP/selectors/$a/143] 
[Actor[akka://nrt/system/IO-TCP-STREAM/client-127-long-nrt-20%2IP_REDACTED%3A2552#-368113801]]
 
registered as connection handler
[DEBUG] [06/02/2015 18:13:09.230] [nrt-akka.actor.default-dispatcher-20] [
akka.tcp://nrt@long-nrt-1:2551/system/IO-TCP/selectors/$a/143] Wrote [8] 
bytes to channel
[DEBUG] [06/02/2015 18:13:09.230] [nrt-akka.actor.default-dispatcher-20] [
akka.tcp://nrt@long-nrt-1:2551/system/IO-TCP/selectors/$a/143] Got 
ConfirmedClose command, sending FIN.
[DEBUG] [06/02/2015 18:13:09.324] [nrt-akka.actor.default-dispatcher-20] [
akka.tcp://nrt@long-nrt-1:2551/system/IO-TCP/selectors/$a/143] Read [7695] 
bytes.
[DEBUG] [06/02/2015 18:13:09.324] [nrt-akka.actor.default-dispatcher-25] [
akka.tcp://nrt@long-nrt-1:2551/system/IO-TCP/selectors/$a/143] Read [9545] 
bytes.
[DEBUG] [06/02/2015 18:13:09.325] [nrt-akka.actor.default-dispatcher-23] [
akka.tcp://nrt@long-nrt-1:2551/system/IO-TCP/selectors/$a/143] Read [1794] 
bytes.
[DEBUG] [06/02/2015 18:13:09.325] [nrt-akka.actor.default-dispatcher-20] [
akka.tcp://nrt@long-nrt-1:2551/system/IO-TCP/selectors/$a/143] Read [1794] 
bytes.
[DEBUG] [06/02/2015 18:13:09.333] [nrt-akka.actor.default-dispatcher-25] [
akka.tcp://nrt@long-nrt-1:2551/system/IO-TCP/selectors/$a/143] Read [12439] 
bytes.
[DEBUG] [06/02/2015 18:13:09.340] [nrt-akka.actor.default-dispatcher-20] [
akka.tcp://nrt@long-nrt-1:2551/system/IO-TCP/selectors/$a/143] Read [1566] 
bytes.
[DEBUG] [06/02/2015 18:13:09.346] [nrt-akka.actor.default-dispatcher-2] [
akka.tcp://nrt@long-nrt-1:2551/system/IO-TCP/selectors/$a/143] Read [5210] 
bytes.
[DEBUG] [06/02/2015 18:13:09.346] [nrt-akka.actor.default-dispatcher-20] [
akka.tcp://nrt@long-nrt-1:2551/system/IO-TCP/selectors/$a/143] Read [4344] 
bytes.
(snip)
[DEBUG] [06/02/2015 18:13:24.800] [nrt-akka.actor.default-dispatcher-27] [
akka.tcp://nrt@long-nrt-1:2551/system/IO-TCP/selectors/$a/143] Read 
[131072] bytes.
[DEBUG] [06/02/2015 18:13:24.800] [nrt-akka.actor.default-dispatcher-27] [
akka.tcp://nrt@long-nrt-1:2551/system/IO-TCP/selectors/$a/143] Read 
[131072] bytes.
[DEBUG] [06/02/2015 18:13:25.066] [nrt-akka.actor.default-dispatcher-23] [
akka.tcp://nrt@long-nrt-1:2551/system/IO-TCP/selectors/$a/143] Read 
[131072] bytes.
[DEBUG] [06/02/2015 18:13:25.066] [nrt-akka.actor.default-dispatcher-23] [
akka.tcp://nrt@long-nrt-1:2551/system/IO-TCP/selectors/$a/143] Read 
[131072] bytes.
[DEBUG] [06/02/2015 18:13:25.302] [nrt-akka.actor.default-dispatcher-24] [
akka.tcp://nrt@long-nrt-1:2551/system/IO-TCP/selectors/$a/143] Read 
[131072] bytes.
[DEBUG] [06/02/2015 18:13:25.302] [nrt-akka.actor.default-dispatcher-24] [
akka.tcp://nrt@long-nrt-1:2551/system/IO-TCP/selectors/$a/143] Read 
[131072] bytes.
[DEBUG] [06/02/2015 18:13:31.169] [nrt-akka.actor.default-dispatcher-23] [
akka.tcp://nrt@long-nrt-1:2551/system/IO-TCP/selectors/$a/143] Read 
[131072] bytes.
[DEBUG] [06/02/2015 18:13:31.170] [nrt-akka.actor.default-dispatcher-3] [
akka.tcp://nrt@long-nrt-1:2551/system/IO-TCP/selectors/$a/143] Read 
[105496] bytes.
[DEBUG] [06/02/2015 18:13:31.911] [nrt-akka.actor.default-dispatcher-2] [
akka.tcp://nrt@long-nrt-1:2551/system/IO-TCP/selectors/$a/143] Closing 
connection due to IO error java.io.IOException: Connection reset by peer
(Abort message propagates to other streams)

Fan in failing slave:
[DEBUG] [06/02/2015 18:13:09.230] [nrt-akka.actor.default-dispatcher-26] [
akka.tcp://nrt@long-nrt-20:2551/system/IO-TCP/selectors/$a/10] 
[Actor[akka://nrt/system/IO-TCP-STREAM/server-1-long-nrt-20%2FIP_REDACTED%3A2552/$j#733080811]]
 
registered as connection handler
[DEBUG] [06/02/2015 18:13:09.230] [nrt-akka.actor.default-dispatcher-25] [
akka.tcp://nrt@long-nrt-20:2551/system/IO-TCP/selectors/$a/10] Read [8] 
bytes.
[DEBUG] [06/02/2015 18:13:09.233] [nrt-akka.actor.default-dispatcher-26] [
akka.tcp://nrt@long-nrt-20:2551/system/IO-TCP/selectors/$a/10] Read [-1] 
bytes.
[DEBUG] [06/02/2015 18:13:09.233] [nrt-akka.actor.default-dispatcher-26] [
akka.tcp://nrt@long-nrt-20:2551/system/IO-TCP/selectors/$a/10] Read 
returned 

[akka-user] Re: Connection reset by peer in Akka Streams RC2

2015-06-02 Thread Russell Cohen
It's probably worth mentioning that this isn't a regression, it was also 
happening in M2 and persisted when we upgraded.

On Tuesday, June 2, 2015 at 7:05:09 PM UTC-7, Russell Cohen wrote:

 Hi All,
   We've been trying to debug a tricky intermittent failure mode we're 
 having with akka-streams. We are setting up a large fan in (~32 nodes) and 
 periodically one of the nodes will inexplicably lead to an RST packet being 
 sent, aborting the entire graph. Below, I have debug logging from the 
 fan-in master as well as from the child that sent the failing packet along 
 with my commentary:


 Fan in master:

 [DEBUG] [06/02/2015 18:13:09.228] [nrt-akka.actor.default-dispatcher-25] [
 akka.tcp://nrt@long-nrt-1:2551/system/IO-TCP/selectors/$a/143] Attempting 
 connection to [long-nrt-20/IP_REDACTED:2552]
 [DEBUG] [06/02/2015 18:13:09.229] [nrt-akka.actor.default-dispatcher-19] [
 akka.tcp://nrt@long-nrt-1:2551/system/IO-TCP/selectors/$a/143] Connection 
 established to [long-nrt-20/IP_REDACTED:2552]
 [DEBUG] [06/02/2015 18:13:09.230] [nrt-akka.actor.default-dispatcher-25] [
 akka.tcp://nrt@long-nrt-1:2551/system/IO-TCP/selectors/$a/143] 
 [Actor[akka://nrt/system/IO-TCP-STREAM/client-127-long-nrt-20%2IP_REDACTED%3A2552#-368113801]]
  
 registered as connection handler
 [DEBUG] [06/02/2015 18:13:09.230] [nrt-akka.actor.default-dispatcher-20] [
 akka.tcp://nrt@long-nrt-1:2551/system/IO-TCP/selectors/$a/143] Wrote [8] 
 bytes to channel
 [DEBUG] [06/02/2015 18:13:09.230] [nrt-akka.actor.default-dispatcher-20] [
 akka.tcp://nrt@long-nrt-1:2551/system/IO-TCP/selectors/$a/143] Got 
 ConfirmedClose command, sending FIN.
 [DEBUG] [06/02/2015 18:13:09.324] [nrt-akka.actor.default-dispatcher-20] [
 akka.tcp://nrt@long-nrt-1:2551/system/IO-TCP/selectors/$a/143] Read 
 [7695] bytes.
 [DEBUG] [06/02/2015 18:13:09.324] [nrt-akka.actor.default-dispatcher-25] [
 akka.tcp://nrt@long-nrt-1:2551/system/IO-TCP/selectors/$a/143] Read 
 [9545] bytes.
 [DEBUG] [06/02/2015 18:13:09.325] [nrt-akka.actor.default-dispatcher-23] [
 akka.tcp://nrt@long-nrt-1:2551/system/IO-TCP/selectors/$a/143] Read 
 [1794] bytes.
 [DEBUG] [06/02/2015 18:13:09.325] [nrt-akka.actor.default-dispatcher-20] [
 akka.tcp://nrt@long-nrt-1:2551/system/IO-TCP/selectors/$a/143] Read 
 [1794] bytes.
 [DEBUG] [06/02/2015 18:13:09.333] [nrt-akka.actor.default-dispatcher-25] [
 akka.tcp://nrt@long-nrt-1:2551/system/IO-TCP/selectors/$a/143] Read 
 [12439] bytes.
 [DEBUG] [06/02/2015 18:13:09.340] [nrt-akka.actor.default-dispatcher-20] [
 akka.tcp://nrt@long-nrt-1:2551/system/IO-TCP/selectors/$a/143] Read 
 [1566] bytes.
 [DEBUG] [06/02/2015 18:13:09.346] [nrt-akka.actor.default-dispatcher-2] [
 akka.tcp://nrt@long-nrt-1:2551/system/IO-TCP/selectors/$a/143] Read 
 [5210] bytes.
 [DEBUG] [06/02/2015 18:13:09.346] [nrt-akka.actor.default-dispatcher-20] [
 akka.tcp://nrt@long-nrt-1:2551/system/IO-TCP/selectors/$a/143] Read 
 [4344] bytes.
 (snip)
 [DEBUG] [06/02/2015 18:13:24.800] [nrt-akka.actor.default-dispatcher-27] [
 akka.tcp://nrt@long-nrt-1:2551/system/IO-TCP/selectors/$a/143] Read 
 [131072] bytes.
 [DEBUG] [06/02/2015 18:13:24.800] [nrt-akka.actor.default-dispatcher-27] [
 akka.tcp://nrt@long-nrt-1:2551/system/IO-TCP/selectors/$a/143] Read 
 [131072] bytes.
 [DEBUG] [06/02/2015 18:13:25.066] [nrt-akka.actor.default-dispatcher-23] [
 akka.tcp://nrt@long-nrt-1:2551/system/IO-TCP/selectors/$a/143] Read 
 [131072] bytes.
 [DEBUG] [06/02/2015 18:13:25.066] [nrt-akka.actor.default-dispatcher-23] [
 akka.tcp://nrt@long-nrt-1:2551/system/IO-TCP/selectors/$a/143] Read 
 [131072] bytes.
 [DEBUG] [06/02/2015 18:13:25.302] [nrt-akka.actor.default-dispatcher-24] [
 akka.tcp://nrt@long-nrt-1:2551/system/IO-TCP/selectors/$a/143] Read 
 [131072] bytes.
 [DEBUG] [06/02/2015 18:13:25.302] [nrt-akka.actor.default-dispatcher-24] [
 akka.tcp://nrt@long-nrt-1:2551/system/IO-TCP/selectors/$a/143] Read 
 [131072] bytes.
 [DEBUG] [06/02/2015 18:13:31.169] [nrt-akka.actor.default-dispatcher-23] [
 akka.tcp://nrt@long-nrt-1:2551/system/IO-TCP/selectors/$a/143] Read 
 [131072] bytes.
 [DEBUG] [06/02/2015 18:13:31.170] [nrt-akka.actor.default-dispatcher-3] [
 akka.tcp://nrt@long-nrt-1:2551/system/IO-TCP/selectors/$a/143] Read 
 [105496] bytes.
 [DEBUG] [06/02/2015 18:13:31.911] [nrt-akka.actor.default-dispatcher-2] [
 akka.tcp://nrt@long-nrt-1:2551/system/IO-TCP/selectors/$a/143] Closing 
 connection due to IO error java.io.IOException: Connection reset by peer
 (Abort message propagates to other streams)

 Fan in failing slave:
 [DEBUG] [06/02/2015 18:13:09.230] [nrt-akka.actor.default-dispatcher-26] [
 akka.tcp://nrt@long-nrt-20:2551/system/IO-TCP/selectors/$a/10] 
 [Actor[akka://nrt/system/IO-TCP-STREAM/server-1-long-nrt-20%2FIP_REDACTED%3A2552/$j#733080811]]
  
 registered as connection handler
 [DEBUG] [06/02/2015 18:13:09.230] [nrt-akka.actor.default-dispatcher-25] [
 akka.tcp://nrt@long-nrt-20:2551/system/IO-TCP/selectors/$a/10] Read [8] 
 bytes.
 [DEBUG] [06/02/2015 18:13:09.233] 

Re: [akka-user] Java: Yet another get or create actor question

2015-06-02 Thread Viktor Klang
In the mean time there's getChild + Optional.ofNullable

On Tue, Jun 2, 2015 at 11:43 AM, Roland Kuhn goo...@rkuhn.info wrote:

 Thanks for raising this, we should fix it
 https://github.com/akka/akka/issues/17635 for Akka 2.4 by offering a
 method that gives you an Optional instead of a Scala Option.

 Regards,

 Roland

 1 jun 2015 kl. 02:50 skrev Guido Medina oxyg...@gmail.com:

 Is there any way to avoid the verbosity?, I try with a more functional
 approach which was OK for IntelliJ but not for the Java 8 compiler, here is
 the form that is working:

   private void applyToAccount(Currency currency, BalanceOperation
 operation) {
 context().child(currency.code).
   getOrElse(new AbstractFunction0OptionActorRef() {
 @Override
 public OptionActorRef apply() {
   return Option.some(context().actorOf(balancePersistorProps(
 currency), currency.code));
 }
   }).
   get().forward(operation, context);
   }


 But I was hoping the following would work, but Java 8 can't infer the
 type, strange IntelliJ recognizes it I guess the mix of Java and Scala
 drives it crazy:


 private void applyToAccount(Currency currency, BalanceOperation operation)
 {
 context().child(currency.code).
   getOrElse(() - Option.some(context().actorOf(balancePersistorProps(
 currency), currency.code))).
   get().forward(operation, context);
   }


 Best regards.

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




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




-- 
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] akka stream - download large file in chunks

2015-06-02 Thread Viktor Klang
Hi,

This?
http://doc.akka.io/docs/akka-stream-and-http-experimental/1.0-RC3/scala/http/client-side/index.html


On Tue, Jun 2, 2015 at 12:01 PM, programad...@gmail.com wrote:

 Hi,

 I am trying to download a file from a website using the akka stream,
 because today I have a problem of heap size.

 I have been through the documentation and I haven't found any good
 examples. Anybody has any suggestion or examples how I can do it in a good
 way?


 Regards

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




-- 
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] akka stream - download large file in chunks

2015-06-02 Thread programadora
Hi,

I am trying to download a file from a website using the akka stream, 
because today I have a problem of heap size.

I have been through the documentation and I haven't found any good 
examples. Anybody has any suggestion or examples how I can do it in a good 
way?


Regards

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


[akka-user] Re: getting config back from getContext().system()

2015-06-02 Thread Christian Kitzmueller
I'm not sure about the java interface, in scala you can use : 
system.settings.config

BR,
Christian


Am Dienstag, 2. Juni 2015 00:36:09 UTC+2 schrieb TS:

 ActorSystem.create takes a config during creation. Is there a way to get 
 it back from getContext().system() ? 

 I have some custom entries in application.conf and want to read them back 

 Thanks, TS


-- 
  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 can we test an actor with out going http request

2015-06-02 Thread Roland Kuhn
Hi Avi,

in order to switch out the actual HTTP part you’ll have to configure your Actor 
with this part, e.g. by providing a function “HttpRequest = 
Future[HttpResponse]” or a “Flow[HttpRequest, HttpResponse, _]” or similar. 
Then in your production code you plug in the HTTP client pool and in your tests 
you can simply stub it out by a function that provides canned answers.

Regards,

Roland

 1 jun 2015 kl. 02:52 skrev Avi Levi 123...@gmail.com:
 
 Thank you Konrad .
 I am not sure I got you. 
 IIUC you suggest to create an external service actor that will accept 
 messages and rout them to the proper external API and will send the response 
 back . if that is correct then again how can I test it ? the testkit allow me 
 to test incoming requests to my API .
 I might didn't explain myself correctly or I am missing something .
 my actor needs to call some external api . something like this :
 class MyActor extends Actor {
 def receive = {
 case GetCities(countryCode:String) = //do http request from external system 
 to get the cities 
  }
 }  
 
 
 
 
 
 2015-06-01 1:00 GMT+03:00 Konrad Malawski kt...@typesafe.com 
 mailto:kt...@typesafe.com:
 I agree with Giovanni's hints here - your domain actors should talk using 
 your domain language (the messages).
 Of course you can always just create an HttpRequest message (see http model 
 in the docs) if you want to send that,
 however I'd recommend to test the http things more for the routing and 
 checking if the proper domain message is sent 
 as reaction to such http request (check out our routing testkit: 
 https://github.com/akka/akka/blob/release-2.3-dev/akka-http-testkit/src/test/scala/akka/http/scaladsl/testkit/ScalatestRouteTestSpec.scala
  
 https://github.com/akka/akka/blob/release-2.3-dev/akka-http-testkit/src/test/scala/akka/http/scaladsl/testkit/ScalatestRouteTestSpec.scala
  ), and then test domain things with normal domain messages.
 
 On Mon, May 25, 2015 at 9:53 AM, Giovanni Alberto Caporaletti 
 paradi...@gmail.com mailto:paradi...@gmail.com wrote:
 Try to separate your login between internal business actors that you can unit 
 test and a gateway sub-system to connect to external systems. 
 The gateway would translate all the connection logic from the external domain 
 to your internal domain, including errors and other possible states.  You 
 could need to handle state and/or any kind of retry logic/failure 
 compensation etc.
 
 The external system (http) would appear as a message-driven actor to your 
 bounded context, speaking your domain language, thus being unit testable.
 The gateway subsystem will be independently integration-tested. You could 
 have a mock http server in your integration tests to verify the external 
 calls and the translation.
 
 Cheers
 G
 
 
 On Sunday, 24 May 2015 10:52:10 UTC+2, Avi wrote:
 Hi ,
 I have an actor that is sending outbound http request.
 I would like top  test that actor ,is there an option to mock that call ? 
 what is the correct way for doing that ? 
 
 Best
 Avi
 
 -- 
  Read the docs: http://akka.io/docs/ http://akka.io/docs/
  Check the FAQ: 
  http://doc.akka.io/docs/akka/current/additional/faq.html 
  http://doc.akka.io/docs/akka/current/additional/faq.html
  Search the archives: https://groups.google.com/group/akka-user 
  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 
 http://groups.google.com/group/akka-user.
 For more options, visit https://groups.google.com/d/optout 
 https://groups.google.com/d/optout.
 
 
 
 -- 
 Cheers,
 Konrad 'ktoso' Malawski
 Akka http://akka.io/ @ Typesafe http://typesafe.com/
 
 -- 
  Read the docs: http://akka.io/docs/ http://akka.io/docs/
  Check the FAQ: 
  http://doc.akka.io/docs/akka/current/additional/faq.html 
  http://doc.akka.io/docs/akka/current/additional/faq.html
  Search the archives: https://groups.google.com/group/akka-user 
  https://groups.google.com/group/akka-user
 --- 
 You received this message because you are subscribed to a topic in the Google 
 Groups Akka User List group.
 To unsubscribe from this topic, visit 
 https://groups.google.com/d/topic/akka-user/-rsD467ADC4/unsubscribe 
 https://groups.google.com/d/topic/akka-user/-rsD467ADC4/unsubscribe.
 To unsubscribe from this group and all its topics, 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 
 

Re: [akka-user] akka stream - download large file in chunks

2015-06-02 Thread Viktor Klang
Hi,

a good start, in my opinion, would be if you could show what you have tried
and what is not working.

On Tue, Jun 2, 2015 at 1:36 PM, programad...@gmail.com wrote:

 Thank you for it, but I had already the documentation link, as well as
 links from stack overflow and other links in github with some examples that
 don't work anymore..

 I really think that all problems can be solved using in the documentation,
 I would like some specifics links and examples, as I am sure you read all
 the documentation and understood all you would gladly share more
 significant information.

 And if you have any suggestion how I could improve my question, please do.


 Cheers




 On Tuesday, June 2, 2015 at 12:33:03 PM UTC+2, √ wrote:

 Hi,

 This?
 http://doc.akka.io/docs/akka-stream-and-http-experimental/1.0-RC3/scala/http/client-side/index.html


 On Tue, Jun 2, 2015 at 12:01 PM, progra...@gmail.com wrote:

 Hi,

 I am trying to download a file from a website using the akka stream,
 because today I have a problem of heap size.

 I have been through the documentation and I haven't found any good
 examples. Anybody has any suggestion or examples how I can do it in a good
 way?


 Regards

 --
  Read the docs: http://akka.io/docs/
  Check the FAQ:
 http://doc.akka.io/docs/akka/current/additional/faq.html
  Search the archives:
 https://groups.google.com/group/akka-user
 ---
 You received this message because you are subscribed to the Google
 Groups Akka User List group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to akka-user+...@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.




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




-- 
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: Akka Cluster - nodes disagree on cluster size

2015-06-02 Thread Anders Båtstrand
I now encountered the problem again: The cluster (3 nodes) suddenly has two 
leaders, and only one of the nodes reported all the other nodes to be part 
of the cluster.

While it might have been triggered by high CPU, I am not sure why it did 
not self-heal. Should not the gossip converge?

When I checked the system, all applications were running fine, with almost 
no load.

What I don't understand is the following:

If one node reports another node to be up, how can it be possible that the 
other node reports the first node to be down (I am using auto-down)?

Best regards,

Anders

-- 
  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] weird for {} compilation error when using actor ? msg

2015-06-02 Thread Kostas kougios
I've this code 

implicit val to = Timeout(timeout)
import context.dispatcher

val futures = for {
   actor - actors
   r - actor ? msg
} yield Response(r)


(actors is a Seq[ActorRef])

But I get this compilation error:

Error:(25, 7) type mismatch;
 found   : scala.concurrent.Future[Response]
 required: scala.collection.GenTraversableOnce[?]
r - actor ? msg
  ^

This is weird, shouldn't it work as per 
http://doc.akka.io/docs/akka/snapshot/scala/actors.html / Ask: 
Send-And-Receive-Future ?


-- 
  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: weird for {} compilation error when using actor ? msg

2015-06-02 Thread Kostas kougios
I suppose it is because first I iterate a Seq[] and then it expects 
sequences. Probably will have to go back to .map-ing.

On Tuesday, 2 June 2015 07:10:10 UTC+1, Kostas kougios wrote:

 I've this code 

 implicit val to = Timeout(timeout)
 import context.dispatcher

 val futures = for {
actor - actors
r - actor ? msg
 } yield Response(r)


 (actors is a Seq[ActorRef])

 But I get this compilation error:

 Error:(25, 7) type mismatch;
  found   : scala.concurrent.Future[Response]
  required: scala.collection.GenTraversableOnce[?]
 r - actor ? msg
   ^

 This is weird, shouldn't it work as per 
 http://doc.akka.io/docs/akka/snapshot/scala/actors.html / Ask: 
 Send-And-Receive-Future ?




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