[akka-user] Re: Update http routes

2016-01-29 Thread Ubaldo Taladríz
Hi, Did you solve this? I need to add http routes dinamically.

Regards,
Ubaldo

El jueves, 24 de diciembre de 2015, 6:17:27 (UTC-3), greg@bcgdv.com 
escribió:
>
> Hi,
>
> for my scenario, I need to modify http routes dynamically at runtime by 
> one of the actors. Can I do it without restarting http server?
>
> Regards,
> Greg 
>

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


[akka-user] Dynamically add HTTP Routes

2016-01-29 Thread Ubaldo Taladríz
Hi, I'm trying to dynamically add http routes to a server without restarting
Is it possible?
I'm using Akka-http

Regards
Ubaldo

-- 
>>  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 https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


Re: [akka-user] scan and map

2016-01-29 Thread Martynas Mickevičius
Hi,

you can do that using scan with something like this (not compiled):

flow.scan(zero = (0, 0)) {
  case ((prevScan, prevElem), elem) => (prevScan, elem)
}

On Thu, Jan 28, 2016 at 6:05 PM, Richard Rodseth  wrote:

> In akka-streams, scan is like fold, in that it takes a zero and a function
> to do the accumulating, but it emits each accumulated value rather than the
> final result.
>
> But what if I wanted to emit tuples of the accumulated value and the
> stream element?
>
> Is there an operator I've missed or would scanMap (?) be a useful addition?
>
>
> --
> >> 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 https://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Martynas Mickevičius
Typesafe  – Reactive
 Apps on the JVM

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


Re: [akka-user] scan and map

2016-01-29 Thread Endre Varga
On Fri, Jan 29, 2016 at 1:21 PM, Martynas Mickevičius <
martynas.mickevic...@typesafe.com> wrote:

> Hi,
>
> you can do that using scan with something like this (not compiled):
>
> flow.scan(zero = (0, 0)) {
>   case ((prevScan, prevElem), elem) => (prevScan, elem)
> }
>

Almost, you missed the aggregator function:

   case ((prevScan, prevElem), elem) => (aggregator(prevScan, elem), elem)

-Endre


> On Thu, Jan 28, 2016 at 6:05 PM, Richard Rodseth 
> wrote:
>
>> In akka-streams, scan is like fold, in that it takes a zero and a
>> function to do the accumulating, but it emits each accumulated value rather
>> than the final result.
>>
>> But what if I wanted to emit tuples of the accumulated value and the
>> stream element?
>>
>> Is there an operator I've missed or would scanMap (?) be a useful
>> addition?
>>
>>
>> --
>> >> 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 https://groups.google.com/group/akka-user.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> Martynas Mickevičius
> Typesafe  – Reactive
>  Apps on the JVM
>
> --
> >> Read the docs: http://akka.io/docs/
> >> Check the FAQ:
> http://doc.akka.io/docs/akka/current/additional/faq.html
> >> Search the archives: https://groups.google.com/group/akka-user
> ---
> You received this message because you are subscribed to the Google Groups
> "Akka User List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to akka-user+unsubscr...@googlegroups.com.
> To post to this group, send email to akka-user@googlegroups.com.
> Visit this group at https://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 https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


Re: [akka-user] Akka Remote via UDP only responds to first client. Timeouts for any others that connect.

2016-01-29 Thread Martynas Mickevičius
Can you look if after first successful connection ActorSystem0 is still
bound to the 4201 port? The port should be listed in the output of *ss -ua*
command.

On Thu, Jan 28, 2016 at 8:08 PM, Chris Benninger 
wrote:

> Hi guys,
>
> I'm trying to get Akka Remote actors working via UDP. Everything works
> beautifully over TCP, but I need it over UDP. The documentation seems quite
> sparse with regards to UDP but it is mentioned. The behaviour I'm seeing is
> ActorSystem1 connects to ActorSystem0 fine, but once a single connection is
> already established, any future connections by ActorSystem2 for example
> will timeout and fail to connect. I captured this in wireshark and all that
> happens is that the client ActorSystem2 sends a UDP packet at ActorSystem0
> and gets an ICMP Destination unreachable (port unreachable) in response and
> nothing further.
>
> Connection string from client:  akka.udp://actorsystem@
> :4201/user/serveractor
>
> Configuration is straight from reference config (from here:
> http://doc.akka.io/docs/akka/current/general/configuration.html#Listing_of_the_Reference_Configuration)
>  with this added:
>
>   akka.remote.netty.udp = ${akka.remote.netty.tcp}
>   akka.remote.netty.udp {
> transport-protocol = udp
> hostname = "serverip"
> port = 4201
>   }
>
> Any help would be greatly appreciated
>
> --
> >> Read the docs: http://akka.io/docs/
> >> Check the FAQ:
> http://doc.akka.io/docs/akka/current/additional/faq.html
> >> Search the archives: https://groups.google.com/group/akka-user
> ---
> You received this message because you are subscribed to the Google Groups
> "Akka User List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to akka-user+unsubscr...@googlegroups.com.
> To post to this group, send email to akka-user@googlegroups.com.
> Visit this group at https://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Martynas Mickevičius
Typesafe  – Reactive
 Apps on the JVM

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


Re: [akka-user] Akka 2.4.1 cluster ShardCoordinator not starting

2016-01-29 Thread Martynas Mickevičius
Hi,

did you configure any persistence journal plugin and have journal backend
ready?

For testing and playing around purposes you can use in-memory journal
plugin by adding these two configuration lines


*# use the journal plugin provided with akka*


*akka.persistence.journal.plugin = akka.persistence.journal.leveldb# use
the java one*
*akka.persistence.journal.leveldb.native = off*

and add the following library

*"org.iq80.leveldb" % "leveldb" % "0.7",*

to your dependencies to add the storage implementation itself.

On Thu, Jan 28, 2016 at 10:50 PM, Rafał Kowalski 
wrote:

> Hi,
>
> I'm exploring the wonderful world of Akka cluster and sharding at the
> moment.  So far, I've setup just one persistent actor `PublicationActor`
> and I start the cluster sharding as follows:
>
> --8<---cut here---start->8---
> ClusterSharding(system).start(
>   typeName = PublicationActor.shardName,
>   entityProps = Props[PublicationActor],
>   settings = ClusterShardingSettings(system),
>   extractEntityId = PublicationActor.extractEntityId,
>   extractShardId = PublicationActor.extractShardId
> )
> --8<---cut here---end--->8---
>
> For some reason, the ShardCoordinator is never started or determined and
> I see this message in my logs of all nodes:
>
> --8<---cut here---start->8---
> [WARN] [01/28/2016 21:45:37.280]
> [ClusterSystem-akka.actor.default-dispatcher-19]
> [akka.tcp://ClusterSystem@obelix:2551/system/sharding/pub] Trying to
> register to coordinator at [None], but no acknowledgement. Total [1]
> buffered messages.
> --8<---cut here---end--->8---
>
> I have two cluster `seed-nodes` set up but I haven't touched any
> cluster.sharding settings yet.  What might be the problem here?  What am
> I missing?
>
> Thanks,
> cheers
> --
> -rafał
>
> --
> >>  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 https://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Martynas Mickevičius
Typesafe  – Reactive
 Apps on the JVM

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


Re: [akka-user] Dynamic flow multiplexer

2016-01-29 Thread Viktor Klang
Hi Jakob,

Perhaps create a fanout Publisher from the Sink and materialize the
consumers as Subscribers and connect them to the Publisher?

-- 
Cheers,
√
On Jan 28, 2016 6:28 AM, "Jakob Odersky"  wrote:

> What is the best approach to "connecting" streams at run-time?
>
> My use-case is a server that has an established connection to some
> backend service, modeled as a flow. Several clients can connect
> through websockets, also modeled as flows.
>
> If the number of clients was known at materialization, this scenario
> would translate smoothly into a fan-out stage, as illustrated in the
> following figure:
>
>   <=> Client 1
> [I/O] <=> [Parser] <=> [FanOut]   <=> Client 2
> ...
>   <=> Client N
>
>
> The catch however is that during run-time, clients should be able
> connect and disconnect, without having to re-materialize (i.e.
> restart) the whole graph.
>
> I know that this kind of "mutable" configuration is not an appropriate
> situation to use graphs directly and have thought of another solution.
> My idea is to implement the above FanOut with a "multiplexer" actor. I
> would also implement custom GraphLogics that would interface with
> incoming connections (and also for the backend) and communicate with
> the multiplexer actor once materialized.
>
> Before I dive into that however, I was wondering if Akka already
> provides some similar solution out-of-the-box?
>
> thanks,
> --Jakob
>
> --
> >>  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 https://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 https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


Re: [akka-user] Akka 2.4.1 cluster ShardCoordinator not starting

2016-01-29 Thread Patrik Nordwall
Note that the leveldb journal can't really be used with Cluster Sharding,
because it is a local only journal. Yes, you can play with it with one
cluster node, otherwise you need to a distributed journal, such as
akka-persistence-cassandra
.

Have you tried the activator template, as a starting point?

On Fri, Jan 29, 2016 at 1:36 PM, Martynas Mickevičius <
martynas.mickevic...@typesafe.com> wrote:

> Hi,
>
> did you configure any persistence journal plugin and have journal backend
> ready?
>
> For testing and playing around purposes you can use in-memory journal
> plugin by adding these two configuration lines
>
>
> *# use the journal plugin provided with akka*
>
>
> *akka.persistence.journal.plugin = akka.persistence.journal.leveldb# use
> the java one*
> *akka.persistence.journal.leveldb.native = off*
>
> and add the following library
>
> *"org.iq80.leveldb" % "leveldb" % "0.7",*
>
> to your dependencies to add the storage implementation itself.
>
> On Thu, Jan 28, 2016 at 10:50 PM, Rafał Kowalski 
> wrote:
>
>> Hi,
>>
>> I'm exploring the wonderful world of Akka cluster and sharding at the
>> moment.  So far, I've setup just one persistent actor `PublicationActor`
>> and I start the cluster sharding as follows:
>>
>> --8<---cut here---start->8---
>> ClusterSharding(system).start(
>>   typeName = PublicationActor.shardName,
>>   entityProps = Props[PublicationActor],
>>   settings = ClusterShardingSettings(system),
>>   extractEntityId = PublicationActor.extractEntityId,
>>   extractShardId = PublicationActor.extractShardId
>> )
>> --8<---cut here---end--->8---
>>
>> For some reason, the ShardCoordinator is never started or determined and
>> I see this message in my logs of all nodes:
>>
>> --8<---cut here---start->8---
>> [WARN] [01/28/2016 21:45:37.280]
>> [ClusterSystem-akka.actor.default-dispatcher-19]
>> [akka.tcp://ClusterSystem@obelix:2551/system/sharding/pub] Trying to
>> register to coordinator at [None], but no acknowledgement. Total [1]
>> buffered messages.
>> --8<---cut here---end--->8---
>>
>> I have two cluster `seed-nodes` set up but I haven't touched any
>> cluster.sharding settings yet.  What might be the problem here?  What am
>> I missing?
>>
>> Thanks,
>> cheers
>> --
>> -rafał
>>
>> --
>> >>  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 https://groups.google.com/group/akka-user.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> Martynas Mickevičius
> Typesafe  – Reactive
>  Apps on the JVM
>
> --
> >> Read the docs: http://akka.io/docs/
> >> Check the FAQ:
> http://doc.akka.io/docs/akka/current/additional/faq.html
> >> Search the archives: https://groups.google.com/group/akka-user
> ---
> You received this message because you are subscribed to the Google Groups
> "Akka User List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to akka-user+unsubscr...@googlegroups.com.
> To post to this group, send email to akka-user@googlegroups.com.
> Visit this group at https://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>



-- 

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

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


Re: [akka-user] Trying to configure ActorSystems

2016-01-29 Thread Patrik Nordwall
Remove the import system.dispatcher and you will see that you need to
provide an ExecutionContext, which you can lookup from the config, via the
system.dispatchers.lookup (I think)

fre 29 jan. 2016 kl. 01:42 skrev Ian Nowland :

> Hello,
>
> I'm trying to configure an ActorSystem, but no matter what I do, seem to
> be getting the default dispatcher. Here's what I've got going on:
>
> val customConf = ConfigFactory.parseString(
>   """
> |akka {
> |
> |  actor{
> |
> |/function-scheduler {
> |  dispatcher = function-scheduler-dispatcher
> |}
> |
> |function-scheduler-dispatcher {
> |  type = Dispatcher
> |  executor = "fork-join-executor"
> |  fork-join-executor {
> |# Min number of threads
> |parallelism-min = 2
> |# available processors * factor
> |parallelism-factor = 4.0
> |# Max number of threads
> |parallelism-max = 32
> |  }
> |}
> |  }
> |
> |}
>   """.stripMargin)
>
> val system:ActorSystem =
> ActorSystem("function-scheduler",ConfigFactory.load(customConf))
> import system.dispatcher
>
> def scheduleOnce(delayTime: Long)(f:() => Unit):Unit = {
>   import scala.language.postfixOps
>   system.scheduler.scheduleOnce(delayTime milliseconds) {
> f()
>   }
> }
>
> As you can see, what I'm trying to do is use a scheduler to be able to
> schedule arbitrary tasks. The problem is that everything I've tried in that
> customConf still results in system using the akka.actor.default-dispatcher.
> I definitely don't understand how the configuration stuff works, but my
> theory is that I'm configuring the dispatcher that would be used for
> created ActorRefs if I was to call something like:
>
> val myActor =
> system.actorOf(Props[MyActor].withDispatcher("function-scheduler-dispatcher"),
> "myactor1")
>
> rather than configuring the system itself.
>
> --
> >> 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 https://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 https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


Re: [akka-user] Akka cluster sharding exception propagation to the parent actor

2016-01-29 Thread Patrik Nordwall
BackoffSupervisor has support for that in Akka 2.4.1
/Patrik
fre 29 jan. 2016 kl. 00:17 skrev Владимир Морозов :

> Hi,
>
> I have similar problem, my PersistentActor begin restart forever when
> inside receiveCommand throws some exception. How I can manage that
> restarts? Creating actor from BackoffSupervisor not help.
>
> Regards,
> Vladimir
>
> понедельник, 16 ноября 2015 г., 18:01:03 UTC+3 пользователь Patrik
> Nordwall написал:
>>
>> Are those exceptions because you send new messages to the entity actor?
>> Do they stop when you stop sending messages to the actor?
>>
>> BackoffSupervisor only helps for persist failures (database exception) or
>> failures during recovery, i.e. when the actor is stopped. If you throw
>> exception in receiveCommand it will trigger a normal restart, which will
>> trigger a persistent actor replay.
>>
>> Please read this section of the docs:
>> http://doc.akka.io/docs/akka/2.4.0/scala/persistence.html#Failures
>> Also, try the BackoffSupervisor. Let me know if you still have problems
>> after that and we will try to sort them out.
>>
>> Regards,
>> Patrik
>>
>>
>>
>>
>>
>> On Thu, Nov 12, 2015 at 3:54 AM, sd d  wrote:
>>
>> Hello,
>>
>> In a multi node cluster sharding scenario if a persistent actor throws an
>> exception, it is not propagating to the Parent Actor supervisor strategy,
>> instead the persistent actor retries for ever, I haven't tried the
>> BackOffSupervisor yet but does it help in propagating the exception to the
>> parent actor or it periodically increases the timeout and tries again and
>> again till the exception is resolved.
>>
>> Ideally, if there is a database exception in the persistent actor, i
>> would like the supervisor actor open the circuit breaker. So, far I haven't
>> had much success in getting this to work.
>>
>> I looked at the following thread, looks like this has been resolved in
>> Akka 2.4 release.
>> https://github.com/akka/akka/issues/18487
>>
>> I took an example from this URL (
>> https://github.com/henrymai/akka/blob/master/akka-cluster-sharding/src/test/java/akka/cluster/sharding/ClusterShardingTest.java)
>> and added an exception scenario to test the exception propagation scenario
>> but it is not working as expected instead re-tries for ever following is
>> the sample log.
>>
>> My changes can be found at this github URL (
>> https://github.com/sdab75/akka-cluster-sharding-test/blob/master/src/main/java/akka/cluster/sharding/ClusterShardingTest.java),
>> this example will recreate the exception i was talking about.
>>
>> I am just wondering, if any of got this scenario working. Appreciate any
>> help in resolving this issue.
>>
>> I generate the exception the following way.
>>
>> void updateState(CounterChanged event) {
>> System.out.println("updating ###");
>> if(true){
>> throw new RuntimeException("Intentional Error 
>> ");
>> }
>> count += event.delta;
>> }
>>
>>
>>
>>
>> Error Log:
>>
>> C:\java\jdk1.8.0_25\bin\java -Didea.launcher.port=7533
>> "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA
>> Community Edition 14.1.5\bin" -Dfile.encoding=windows-1252 -classpath
>> 

Re: [akka-user] Trying to configure ActorSystems

2016-01-29 Thread Ian Nowland
So, I've tried replacing the

import system.dispatcher

with

implicit val executionContext = 
system.dispatchers.lookup("akka.actor.habari-function-scheduler-dispatcher")

but I'm still getting the system.dispatcher as the akka.default

On Friday, January 29, 2016 at 12:34:28 PM UTC-5, Patrik Nordwall wrote:
>
> Remove the import system.dispatcher and you will see that you need to 
> provide an ExecutionContext, which you can lookup from the config, via the 
> system.dispatchers.lookup (I think)
>
> fre 29 jan. 2016 kl. 01:42 skrev Ian Nowland  >:
>
>> Hello,
>>
>> I'm trying to configure an ActorSystem, but no matter what I do, seem to 
>> be getting the default dispatcher. Here's what I've got going on:
>>
>> val customConf = ConfigFactory.parseString(
>>   """
>> |akka {
>> |
>> |  actor{
>> |
>> |/function-scheduler {
>> |  dispatcher = function-scheduler-dispatcher
>> |}
>> |
>> |function-scheduler-dispatcher {
>> |  type = Dispatcher
>> |  executor = "fork-join-executor"
>> |  fork-join-executor {
>> |# Min number of threads
>> |parallelism-min = 2
>> |# available processors * factor
>> |parallelism-factor = 4.0
>> |# Max number of threads
>> |parallelism-max = 32
>> |  }
>> |}
>> |  }
>> |
>> |}
>>   """.stripMargin)
>>
>> val system:ActorSystem = 
>> ActorSystem("function-scheduler",ConfigFactory.load(customConf))
>> import system.dispatcher
>>
>> def scheduleOnce(delayTime: Long)(f:() => Unit):Unit = {
>>   import scala.language.postfixOps
>>   system.scheduler.scheduleOnce(delayTime milliseconds) {
>> f()
>>   }
>> }
>>
>> As you can see, what I'm trying to do is use a scheduler to be able to 
>> schedule arbitrary tasks. The problem is that everything I've tried in that 
>> customConf still results in system using the akka.actor.default-dispatcher. 
>> I definitely don't understand how the configuration stuff works, but my 
>> theory is that I'm configuring the dispatcher that would be used for 
>> created ActorRefs if I was to call something like:
>>
>> val myActor = 
>> system.actorOf(Props[MyActor].withDispatcher("function-scheduler-dispatcher"),
>>  
>> "myactor1")
>>
>> rather than configuring the system itself.
>>
>> -- 
>> >> 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 https://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 https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


Re: [akka-user] StateData mutability in AbstractFSM

2016-01-29 Thread Konrad Malawski
Technically it may be safe in that case, you're in an Actor after all.
However I'd argue it's bad style as it mixes an API designed for immutable data 
passing (the data param of FSM),
in a mutable way, which can/will lead to confusion when someone else reads your 
code.

If you want to have (or are forced to by some API that exposes such) mutable 
state, just keel a variable in the Actor's body.

Also remember that in general:
"mutable reference to immutable data" is better than "immutable reference to 
mutable data",
since the danger of leaking the object in a message is not an issue in the 
first case.

-- 
Cheers,
Konrad 'ktoso’ Malawski
Akka @ Typesafe

On 30 January 2016 at 04:47:27, James P (jsp0...@gmail.com) wrote:

Hi folks,

Good day. I'm just starting with Akka (Java with Lambda) and I have a question 
regarding AbstractFSM. 

When using "akka.actor.FSM.State.using(Data)" does "Data" need to be immutable?

Example:
when(State.Idle,
matchEvent(Event.class, StateData.class,
(event, stateData) ->
stay().using(new StateData(;

when(State.Active,
matchEvent(Event.class, StateData.class,
(event, stateData) -> goTo(State.Idle).using(stateData.mutate(;


                ...
               public class StateData{
public StateData mutate(){
//mutate myself
return this;
}
             
 Is it safe to mutate the data this way? I'm uncertain since I saw that 
"akka.actor.AbstractFSM.onTransition(PartialFunction, BoxedUnit>)" allows you to access both the current stateData 
and the nextStateData. 

 
Any help would be much appreciated. Thanks and have a great day.
--
>> 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 https://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 https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


Re: [akka-user] StateData mutability in AbstractFSM

2016-01-29 Thread James P
Hi Konrad,

Thanks for the guidance, much appreciated! Good points, will try to stick 
to immutable data params for FSM. Have a great weekend :)


On Friday, January 29, 2016 at 3:40:23 PM UTC-8, Konrad Malawski wrote:
>
> Technically it may be safe in that case, you're in an Actor after all.
> However I'd argue it's bad style as it mixes an API designed for immutable 
> data passing (the data param of FSM),
> in a mutable way, which can/will lead to confusion when someone else reads 
> your code.
>
> If you want to have (or are forced to by some API that exposes such) 
> mutable state, just keel a variable in the Actor's body.
>
> Also remember that in general:
> "mutable reference to immutable data" is better than "immutable reference 
> to mutable data",
> since the danger of leaking the object in a message is not an issue in the 
> first case.
>
> -- 
> Cheers,
> Konrad 'ktoso’ Malawski
> Akka  @ Typesafe 
>
> On 30 January 2016 at 04:47:27, James P (jsp...@gmail.com ) 
> wrote:
>
> Hi folks, 
>
> Good day. I'm just starting with Akka (Java with Lambda) and I have a 
> question regarding AbstractFSM. 
>
> When using "*akka.actor.FSM.State.using(Data)*" does "*Data*" need to be 
> immutable?
>
> Example:
> *when(State.Idle,*
> *matchEvent(Event.class, StateData.class,*
> *(event, stateData) ->*
> *stay().using(new StateData(;*
>
> *when(State.Active,*
> *matchEvent(Event.class, StateData.class,*
> *(event, stateData) -> goTo(State.Idle).using(stateData.mutate(;*
>
>
> ...
>   * public class StateData{*
> *public StateData mutate(){*
> *//mutate myself*
> *return this;*
> *}*
>  
>  Is it safe to mutate the data this way? I'm uncertain since I saw that 
> "*akka.actor.AbstractFSM.onTransition(PartialFunction BatchingState>, BoxedUnit>)*" allows you to access both the current 
> stateData and the nextStateData. 
>
>  
> Any help would be much appreciated. Thanks and have a great day.
> --
> >> 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 https://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 https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


[akka-user] Delay using Akka Stream Source with PlayFramework 2.5

2016-01-29 Thread Loïc Descotte
Hi,

In Play 2.5 Akka Stream is the default stream processing library.

I don't know if it's a Play or an Akka Stream problem,  I'm trying to 
stream some messages with an Akka Stream Source from a Play controller : 

def timeline(keyword: String) = Action {
val source = Source.tick(initialDelay = 0 second, interval = 1 second, 
tick = keyword)
Ok.chunked(source)
  }


When I call the action, it takes about 1 minute before the stream is 
rendered in the browser. But when it's displayed, the 60/70 first keyword 
appears in one shot, then the stream is working normally with 1 message by 
second. 

I've tried to define the source outside the action at the controller level 
to avoid initialization problems, but a request always takes about1 minute 
to display.

Did i miss something?

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 https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


Re: [akka-user] StateData mutability in AbstractFSM

2016-01-29 Thread James P
Haha, love it. Will print that out and stick a copy on the side of my 
monitor to keep me reminded :D

On Friday, January 29, 2016 at 5:24:51 PM UTC-8, Konrad Malawski wrote:
>
> Yup, happy hakking!
>
> // related, a visualisation of the generalised form of the problem from a 
> talk I'm about to deliver:
> // 
> https://www.evernote.com/l/AAkD5JPO-rVM3J5S7bnd1g_awyWstD8kCOIB/image.png
>  ;-)
>
> -- 
> Cheers,
> Konrad 'ktoso’ Malawski
> Akka  @ Typesafe 
>
> On 30 January 2016 at 09:51:41, James P (jsp...@gmail.com ) 
> wrote:
>
> Hi Konrad, 
>
> Thanks for the guidance, much appreciated! Good points, will try to stick 
> to immutable data params for FSM. Have a great weekend :)
>
>
> On Friday, January 29, 2016 at 3:40:23 PM UTC-8, Konrad Malawski wrote: 
>>
>> Technically it may be safe in that case, you're in an Actor after all.
>> However I'd argue it's bad style as it mixes an API designed for 
>> immutable data passing (the data param of FSM),
>> in a mutable way, which can/will lead to confusion when someone else 
>> reads your code.
>>
>> If you want to have (or are forced to by some API that exposes such) 
>> mutable state, just keel a variable in the Actor's body.
>>
>> Also remember that in general:
>> "mutable reference to immutable data" is better than "immutable reference 
>> to mutable data",
>> since the danger of leaking the object in a message is not an issue in 
>> the first case.
>>
>> -- 
>> Cheers,
>> Konrad 'ktoso’ Malawski
>> Akka  @ Typesafe 
>>
>> On 30 January 2016 at 04:47:27, James P (jsp...@gmail.com) wrote:
>>
>> Hi folks, 
>>
>> Good day. I'm just starting with Akka (Java with Lambda) and I have a 
>> question regarding AbstractFSM. 
>>
>> When using "*akka.actor.FSM.State.using(Data)*" does "*Data*" need to be 
>> immutable?
>>
>> Example:
>> *when(State.Idle,*
>> *matchEvent(Event.class, StateData.class,*
>> *(event, stateData) ->*
>> *stay().using(new StateData(;*
>>
>> *when(State.Active,*
>> *matchEvent(Event.class, StateData.class,*
>> *(event, stateData) -> goTo(State.Idle).using(stateData.mutate(;*
>>
>>
>> ...
>>   * public class StateData{*
>> *public StateData mutate(){*
>> *//mutate myself*
>> *return this;*
>> *}*
>>  
>>  Is it safe to mutate the data this way? I'm uncertain since I saw that 
>> "*akka.actor.AbstractFSM.onTransition(PartialFunction> BatchingState>, BoxedUnit>)*" allows you to access both the current 
>> stateData and the nextStateData. 
>>
>>  
>> Any help would be much appreciated. Thanks and have a great day.
>> --
>> >> 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 https://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+...@googlegroups.com .
> To post to this group, send email to akka...@googlegroups.com 
> .
> Visit this group at https://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 https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


Re: [akka-user] StateData mutability in AbstractFSM

2016-01-29 Thread Konrad Malawski
Yup, happy hakking!

// related, a visualisation of the generalised form of the problem from a talk 
I'm about to deliver:
// https://www.evernote.com/l/AAkD5JPO-rVM3J5S7bnd1g_awyWstD8kCOIB/image.png ;-)

-- 
Cheers,
Konrad 'ktoso’ Malawski
Akka @ Typesafe

On 30 January 2016 at 09:51:41, James P (jsp0...@gmail.com) wrote:

Hi Konrad,

Thanks for the guidance, much appreciated! Good points, will try to stick to 
immutable data params for FSM. Have a great weekend :)


On Friday, January 29, 2016 at 3:40:23 PM UTC-8, Konrad Malawski wrote:
Technically it may be safe in that case, you're in an Actor after all.
However I'd argue it's bad style as it mixes an API designed for immutable data 
passing (the data param of FSM),
in a mutable way, which can/will lead to confusion when someone else reads your 
code.

If you want to have (or are forced to by some API that exposes such) mutable 
state, just keel a variable in the Actor's body.

Also remember that in general:
"mutable reference to immutable data" is better than "immutable reference to 
mutable data",
since the danger of leaking the object in a message is not an issue in the 
first case.

-- 
Cheers,
Konrad 'ktoso’ Malawski
Akka @ Typesafe

On 30 January 2016 at 04:47:27, James P (jsp...@gmail.com) wrote:

Hi folks,

Good day. I'm just starting with Akka (Java with Lambda) and I have a question 
regarding AbstractFSM. 

When using "akka.actor.FSM.State.using(Data)" does "Data" need to be immutable?

Example:
when(State.Idle,
matchEvent(Event.class, StateData.class,
(event, stateData) ->
stay().using(new StateData(;

when(State.Active,
matchEvent(Event.class, StateData.class,
(event, stateData) -> goTo(State.Idle).using(stateData.mutate(;


                ...
               public class StateData{
public StateData mutate(){
//mutate myself
return this;
}
             
 Is it safe to mutate the data this way? I'm uncertain since I saw that 
"akka.actor.AbstractFSM.onTransition(PartialFunction, BoxedUnit>)" allows you to access both the current stateData 
and the nextStateData. 

 
Any help would be much appreciated. Thanks and have a great day.
--
>> 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 https://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 https://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 https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


[akka-user] Security analysis of Akka

2016-01-29 Thread smileallways
Hi Akka Gurus,
 Has anybody done security analysis of Akka infrastructure.  I am looking 
at Akka for implementation, but I want to make sure that there are no 
security holes in Akka implementation.

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 https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


[akka-user] Re: Dynamic flow multiplexer

2016-01-29 Thread Paul Kinsky
I used `SourceQueue` to handle this case: first materialize a graph that 
takes elements offered to a source queue, then create a sink that consumes 
elements and publishes them to that source queue:

  val kafkaSink: Sink[Event, Unit] = //...

  val kafkaPublisherGraph: RunnableGraph[SourceQueue[Event]] =
Source.queue[Event](1024, OverflowStrategy.backpressure)
  .to(kafkaSink)

  val sourceQueue: SourceQueue[Event] = kafkaPublisherGraph.run

  def queueWriter[T](queue: SourceQueue[T]): Sink[T, Unit] =
Flow[T]
  .mapAsync(1)( elem => queue.offer(elem).map( notDropped => (notDropped, 
elem) ) )
  .to(Sink.foreach{
case (false, elem) => println(s"error: elem $elem rejected by queue")
case (true, elem) =>
  })




full 
example: 
https://github.com/pkinsky/ws_to_kafka/blob/master/src/main/scala/com/pkinsky/StreamingUpload.scala

On Wednesday, January 27, 2016 at 9:28:36 PM UTC-8, Jakob Odersky wrote:
>
> What is the best approach to "connecting" streams at run-time? 
>
> My use-case is a server that has an established connection to some 
> backend service, modeled as a flow. Several clients can connect 
> through websockets, also modeled as flows. 
>
> If the number of clients was known at materialization, this scenario 
> would translate smoothly into a fan-out stage, as illustrated in the 
> following figure: 
>
>   <=> Client 1 
> [I/O] <=> [Parser] <=> [FanOut]   <=> Client 2 
> ... 
>   <=> Client N 
>
>
> The catch however is that during run-time, clients should be able 
> connect and disconnect, without having to re-materialize (i.e. 
> restart) the whole graph. 
>
> I know that this kind of "mutable" configuration is not an appropriate 
> situation to use graphs directly and have thought of another solution. 
> My idea is to implement the above FanOut with a "multiplexer" actor. I 
> would also implement custom GraphLogics that would interface with 
> incoming connections (and also for the backend) and communicate with 
> the multiplexer actor once materialized. 
>
> Before I dive into that however, I was wondering if Akka already 
> provides some similar solution out-of-the-box? 
>
> thanks, 
> --Jakob 
>

-- 
>>  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 https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


Re: [akka-user] Dynamic flow multiplexer

2016-01-29 Thread Jakob Odersky
Hey Viktor,
I never thought of using the underlying reactive streams API directly
but it sounds like a good idea!

cheers,
--Jakob

On Fri, Jan 29, 2016 at 12:45 AM, Viktor Klang  wrote:
> Hi Jakob,
>
> Perhaps create a fanout Publisher from the Sink and materialize the
> consumers as Subscribers and connect them to the Publisher?
>
> --
> Cheers,
> √
>
> On Jan 28, 2016 6:28 AM, "Jakob Odersky"  wrote:
>>
>> What is the best approach to "connecting" streams at run-time?
>>
>> My use-case is a server that has an established connection to some
>> backend service, modeled as a flow. Several clients can connect
>> through websockets, also modeled as flows.
>>
>> If the number of clients was known at materialization, this scenario
>> would translate smoothly into a fan-out stage, as illustrated in the
>> following figure:
>>
>>   <=> Client 1
>> [I/O] <=> [Parser] <=> [FanOut]   <=> Client 2
>> ...
>>   <=> Client N
>>
>>
>> The catch however is that during run-time, clients should be able
>> connect and disconnect, without having to re-materialize (i.e.
>> restart) the whole graph.
>>
>> I know that this kind of "mutable" configuration is not an appropriate
>> situation to use graphs directly and have thought of another solution.
>> My idea is to implement the above FanOut with a "multiplexer" actor. I
>> would also implement custom GraphLogics that would interface with
>> incoming connections (and also for the backend) and communicate with
>> the multiplexer actor once materialized.
>>
>> Before I dive into that however, I was wondering if Akka already
>> provides some similar solution out-of-the-box?
>>
>> thanks,
>> --Jakob
>>
>> --
>> >>  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 https://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 https://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 https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


Re: [akka-user] Dynamic flow multiplexer

2016-01-29 Thread Viktor Klang
Hi Jakob,

Let us know how that solution fares!

-- 
Cheers,
√
On Jan 29, 2016 8:10 PM, "Jakob Odersky"  wrote:

> Hey Viktor,
> I never thought of using the underlying reactive streams API directly
> but it sounds like a good idea!
>
> cheers,
> --Jakob
>
> On Fri, Jan 29, 2016 at 12:45 AM, Viktor Klang 
> wrote:
> > Hi Jakob,
> >
> > Perhaps create a fanout Publisher from the Sink and materialize the
> > consumers as Subscribers and connect them to the Publisher?
> >
> > --
> > Cheers,
> > √
> >
> > On Jan 28, 2016 6:28 AM, "Jakob Odersky"  wrote:
> >>
> >> What is the best approach to "connecting" streams at run-time?
> >>
> >> My use-case is a server that has an established connection to some
> >> backend service, modeled as a flow. Several clients can connect
> >> through websockets, also modeled as flows.
> >>
> >> If the number of clients was known at materialization, this scenario
> >> would translate smoothly into a fan-out stage, as illustrated in the
> >> following figure:
> >>
> >>   <=> Client 1
> >> [I/O] <=> [Parser] <=> [FanOut]   <=> Client 2
> >> ...
> >>   <=> Client N
> >>
> >>
> >> The catch however is that during run-time, clients should be able
> >> connect and disconnect, without having to re-materialize (i.e.
> >> restart) the whole graph.
> >>
> >> I know that this kind of "mutable" configuration is not an appropriate
> >> situation to use graphs directly and have thought of another solution.
> >> My idea is to implement the above FanOut with a "multiplexer" actor. I
> >> would also implement custom GraphLogics that would interface with
> >> incoming connections (and also for the backend) and communicate with
> >> the multiplexer actor once materialized.
> >>
> >> Before I dive into that however, I was wondering if Akka already
> >> provides some similar solution out-of-the-box?
> >>
> >> thanks,
> >> --Jakob
> >>
> >> --
> >> >>  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 https://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 https://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 https://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 https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


[akka-user] StateData mutability in AbstractFSM

2016-01-29 Thread James P
Hi folks,

Good day. I'm just starting with Akka (Java with Lambda) and I have a 
question regarding AbstractFSM. 

When using "*akka.actor.FSM.State.using(Data)*" does "*Data*" need to be 
immutable?

Example:
*when(State.Idle,*
* matchEvent(Event.class, StateData.class,*
* (event, stateData) ->*
* stay().using(new StateData(;*

* when(State.Active,*
* matchEvent(Event.class, StateData.class,*
* (event, stateData) -> goTo(State.Idle).using(stateData.mutate(;*


...
  * public class StateData{*
* public StateData mutate(){*
* //mutate myself*
* return this;*
* }*
 
 Is it safe to mutate the data this way? I'm uncertain since I saw that 
"*akka.actor.AbstractFSM.onTransition(PartialFunction, BoxedUnit>)*" allows you to access both the current 
stateData and the nextStateData. 

 
Any help would be much appreciated. Thanks and have a great day.

-- 
>>  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 https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


[akka-user] Re: Akka 2.4.1 cluster ShardCoordinator not starting

2016-01-29 Thread Rafał Kowalski
-> On Fri, 29 Jan 2016 17:40:24 +0100, Patrik Nordwall 
 said:

> Note that the leveldb journal can't really be used with Cluster Sharding, 
> because it is a local only journal. Yes, you can play with it with one 
> cluster node,
> otherwise you need to a distributed journal, such as 
> akka-persistence-cassandra.

I've configured persistency using the cassandra-journal plugin.  Here is
the relevant snippet from the configuration:

--8<---cut here---start->8---
   persistence {

 journal {
   max-message-batch-size = 200
   max-confirmation-batch-size = 1
   max-deletion-batch-size = 1
   plugin = "cassandra-journal"
 }
 snapshot-store {
   plugin = "cassandra-snapshot-store"
   }
   }
--8<---cut here---end--->8---

Full configuration is here: https://gist.github.com/4aa8f1e900dbbbdf3f44

> Have you tried the activator template, as a starting point?

Yes, I have and I've tried to model my application after the
akka-cluster-sharding-scala template.  They use Akka 2.4.0 and leveldb
for the journal though.  Do you think the persistence setting is the
problem?  I can try to change to their leveldb settings and see what
happens.

> On Fri, Jan 29, 2016 at 1:36 PM, Martynas Mickevičius 
>  wrote:


>  Hi,

>  did you configure any persistence journal plugin and have journal backend 
> ready?

>  For testing and playing around purposes you can use in-memory journal plugin 
> by adding these two configuration lines

>  # use the journal plugin provided with akka
>  akka.persistence.journal.plugin = akka.persistence.journal.leveldb

>  # use the java one
>  akka.persistence.journal.leveldb.native = off

>  and add the following library

>  "org.iq80.leveldb" % "leveldb" % "0.7",

>  to your dependencies to add the storage implementation itself.

>  On Thu, Jan 28, 2016 at 10:50 PM, Rafał Kowalski  
> wrote:


>  Hi,

>  I'm exploring the wonderful world of Akka cluster and sharding at the
>  moment. So far, I've setup just one persistent actor `PublicationActor`
>  and I start the cluster sharding as follows:

>  --8<---cut here---start->8---
>  ClusterSharding(system).start(
>  typeName = PublicationActor.shardName,
>  entityProps = Props[PublicationActor],
>  settings = ClusterShardingSettings(system),
>  extractEntityId = PublicationActor.extractEntityId,
>  extractShardId = PublicationActor.extractShardId
>  )
>  --8<---cut here---end--->8---

>  For some reason, the ShardCoordinator is never started or determined and
>  I see this message in my logs of all nodes:

>  --8<---cut here---start->8---
>  [WARN] [01/28/2016 21:45:37.280] 
> [ClusterSystem-akka.actor.default-dispatcher-19]
>  [akka.tcp://ClusterSystem@obelix:2551/system/sharding/pub] Trying to 
> register to coordinator at [None], but no acknowledgement. Total [1]
>  buffered messages.
>  --8<---cut here---end--->8---

>  I have two cluster `seed-nodes` set up but I haven't touched any
>  cluster.sharding settings yet. What might be the problem here? What am
>  I missing?

>  Thanks,
>  cheers
>  --
>  -rafał

>  --
>>> 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 https://groups.google.com/group/akka-user.
>  For more options, visit https://groups.google.com/d/optout.


>  -- 
>  Martynas Mickevičius
>  Typesafe – Reactive Apps on the JVM


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


> -- 


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

> -- 
>>> Read the docs: http://akka.io/docs/
>>> Check the FAQ: 
>>> 

Re: [akka-user] scan and map

2016-01-29 Thread Richard Rodseth
Thanks!

Sent from my phone - will be brief

> On Jan 29, 2016, at 5:25 AM, Endre Varga  wrote:
> 
> 
> 
>> On Fri, Jan 29, 2016 at 1:21 PM, Martynas Mickevičius 
>>  wrote:
>> Hi,
>> 
>> you can do that using scan with something like this (not compiled):
>> 
>> flow.scan(zero = (0, 0)) {
>>   case ((prevScan, prevElem), elem) => (prevScan, elem)
>> }
> 
> Almost, you missed the aggregator function:
> 
>case ((prevScan, prevElem), elem) => (aggregator(prevScan, elem), elem)
> 
> -Endre
> 
>> 
>>> On Thu, Jan 28, 2016 at 6:05 PM, Richard Rodseth  wrote:
>>> In akka-streams, scan is like fold, in that it takes a zero and a function 
>>> to do the accumulating, but it emits each accumulated value rather than the 
>>> final result.
>>> 
>>> But what if I wanted to emit tuples of the accumulated value and the stream 
>>> element?
>>> 
>>> Is there an operator I've missed or would scanMap (?) be a useful addition?
>>> 
>>> 
>>> -- 
>>> >> 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 https://groups.google.com/group/akka-user.
>>> For more options, visit https://groups.google.com/d/optout.
>> 
>> 
>> 
>> -- 
>> Martynas Mickevičius
>> Typesafe – Reactive Apps on the JVM
>> -- 
>> >> Read the docs: http://akka.io/docs/
>> >> Check the FAQ: 
>> >> http://doc.akka.io/docs/akka/current/additional/faq.html
>> >> Search the archives: https://groups.google.com/group/akka-user
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Akka User List" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to akka-user+unsubscr...@googlegroups.com.
>> To post to this group, send email to akka-user@googlegroups.com.
>> Visit this group at https://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 https://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 https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.