[akka-user] Akka FSM, persistence and timeouts

2016-09-21 Thread Eugene Dzhurinsky
Hello all!

I have to create the simple workflow execution engine, that supports 
timeouts in its states. The sample made-up definition and the sequence of 
the states could be as following:

1) Send the confirmation e-mail to the customer *once*
2) Await the confirmation event for 24 hours
3) If there is a timeout error - then send another e-mail to the customer 
with the reminder and wait for 48 hours
4) If there is the confirmation event - then complete the registration and 
send welcome e-mail
5) if there's another timeout from step 3 - then cancel the registration 
process and cleanup the database

I think that I could easily create *10K-100K* of instances of the actors in 
the JVM - actors seems to be cheap, however I'm not sure
- how the timeouts for the states will be processed, could I jam into some 
bottleneck with the scheduled events processing? What is the recommended 
thread pool size for 10K of actors, ballpark value?

- how do I *persist* the states of the workflow actors and *recover* them 
with the correct timeouts, if for some reason actor dies on step 2 after 10 
hours of waiting, and upon the restart I need to adjust the timeout to be 
not 24 hours, but 14 hours. I know that I can start FSM with any state and 
state data, perhaps I could also set the custom step timeout upon init of 
the FSM.

I think that I could create some sort of the database that may keep the 
state and state data of each of workflows actor, but may be I am 
reinventing the wheel and there's already some *akka-scheduler* contrib 
module I overlooked?

Thanks in advance!

-- 
>>  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] How to configure cluster for two machines

2016-09-21 Thread Viktor Klang
You're setting the port to 0 but are trying to connect to 2552?

-- 
Cheers,
√

On Sep 21, 2016 20:29, "Gerard W"  wrote:

> I'm using Akka 2.3.15 (java) and I'm trying to get a cluster with two
> members in two different hosts. Everything runs fine when I start the two
> nodes on a single machine, but then when I try to start up the second node
> on a different machine, it keeps getting "Association with remote system
> [...] has failed".
> I know I'm probably not configuring it right, but I don't know exactly how
> to do it.
>
> So in the hostA (ip 192.168.2.21) I'm running an actor on 2552 that joins
> successfully to the cluster. The application.conf looks like:
>
> akka {
>   actor {
> provider = "akka.cluster.ClusterActorRefProvider"
>   }
>   remote {
> log-remote-lifecycle-events = off
> netty.tcp {
>   hostname = "192.168.2.21"
>   port = 0
> }
>   }
>   cluster {
> seed-nodes = [
>   "akka.tcp://MulticastPocCluster@192.168.2.21:2552"]
>
>   }
> }
> akka.cluster.metrics.enabled=off
> akka.extensions=["akka.cluster.metrics.ClusterMetricsExtension"]
> akka.cluster.metrics.native-library-extract-folder=${user.
> dir}/target/native
>
> I've copied everything over to hostB (ip 192.168.2.55), modified the
> application.conf file to:
>
> akka {
>   actor {
> provider = "akka.cluster.ClusterActorRefProvider"
>   }
>   remote {
> log-remote-lifecycle-events = off
> netty.tcp {
>   hostname = "192.168.2.55"
>   port = 0
> }
>   }
>   cluster {
> seed-nodes = [
>   # Seed node in the other host
>   "akka.tcp://MulticastPocCluster@192.168.2.21:2552"]
>   }
> }
> akka.cluster.metrics.enabled=off
> akka.extensions=["akka.cluster.metrics.ClusterMetricsExtension"]
> akka.cluster.metrics.native-library-extract-folder=${user.
> dir}/target/native
>
> I've verified that I can ping hostA from hostB by ip address. But I get
> this error when I try to start up an actor on hostB:
>
> INFO] [09/21/2016 12:52:53.229] [MulticastPocCluster-akka.
> remote.default-remote-dispatcher-6] [akka.tcp://MulticastPocCluste
> r@192.168.2.55:2552/system/transports/akkaprotocolmanager.tcp0/
> akkaProtocol-tcp%3A%2F%2FMulticastPocCluster%40192.168.2.21%3A2552-1] No
> response from remote for outbound association. Associate timed out after
> [15000 ms].
> [WARN] [09/21/2016 12:52:53.232] [MulticastPocCluster-akka.
> remote.default-remote-dispatcher-5] [akka.tcp://MulticastPocCluste
> r@192.168.2.55:2552/system/endpointManager/reliableEndpointWriter-akka.
> tcp%3A%2F%2FMulticastPocCluster%40192.168.2.21%3A2552-0] Association with
> remote system [akka.tcp://MulticastPocCluster@192.168.2.21:2552] has
> failed, address is now gated for [5000] ms. Reason: [Association failed
> with [akka.tcp://MulticastPocCluster@192.168.2.21:2552]] Caused by: [No
> response from remote for outbound association. Associate timed out after
> [15000 ms].]
>
> Log from hostA:
>
> [INFO] [09/21/2016 12:51:14.402] [main] [akka.remote.Remoting] Starting
> remoting
> [INFO] [09/21/2016 12:51:14.649] [main] [akka.remote.Remoting] Remoting
> started; listening on addresses :[akka.tcp://MulticastPocClust
> er@192.168.2.21:2552]
> [INFO] [09/21/2016 12:51:14.663] [main] 
> [akka.cluster.Cluster(akka://MulticastPocCluster)]
> Cluster Node [akka.tcp://MulticastPocCluster@192.168.2.21:2552] -
> Starting up...
> [INFO] [09/21/2016 12:51:14.762] [main] 
> [akka.cluster.Cluster(akka://MulticastPocCluster)]
> Cluster Node [akka.tcp://MulticastPocCluster@192.168.2.21:2552] -
> Registered cluster JMX MBean [akka:type=Cluster]
> [INFO] [09/21/2016 12:51:14.762] [main] 
> [akka.cluster.Cluster(akka://MulticastPocCluster)]
> Cluster Node [akka.tcp://MulticastPocCluster@192.168.2.21:2552] - Started
> up successfully
> [INFO] [09/21/2016 12:51:14.796] 
> [MulticastPocCluster-akka.actor.default-dispatcher-2]
> [akka.cluster.Cluster(akka://MulticastPocCluster)] Cluster Node
> [akka.tcp://MulticastPocCluster@192.168.2.21:2552] - Node [akka.tcp://
> MulticastPocCluster@192.168.2.21:2552] is JOINING, roles []
> [INFO] [09/21/2016 12:51:14.809] 
> [MulticastPocCluster-akka.actor.default-dispatcher-2]
> [akka.cluster.Cluster(akka://MulticastPocCluster)] Cluster Node
> [akka.tcp://MulticastPocCluster@192.168.2.21:2552] - Leader is moving
> node [akka.tcp://MulticastPocCluster@192.168.2.21:2552] to [Up]
> sep 21, 2016 12:51:15 PM kamon.sigar.SigarProvisioner provision
> ADVERTENCIA: Sigar library is already provisioned.
> [INFO] [09/21/2016 12:51:15.376] 
> [MulticastPocCluster-akka.actor.default-dispatcher-3]
> [akka.cluster.Cluster(akka://MulticastPocCluster)] Cluster Node
> [akka.tcp://MulticastPocCluster@192.168.2.21:2552] - Metrics collection
> has started successfully
>
> Log from hostB:
>
> [INFO] [09/21/2016 12:52:37.915] [main] [akka.remote.Remoting] Starting
> remoting
> [INFO] [09/21/2016 12:52:38.087] [main] [akka.remote.Remoting] Remoting
> started; listening on addresses 

[akka-user] How to manage Fault-Tolerance Complexity for Akka Actors with Streams

2016-09-21 Thread Dagny T

I had found a good blog about the basics of the Akka Actor Model; and 
everything looked cool.

However, I then started following up to look at the Akka Docs for 
information about Best Practices to handle the complexities of distributed 
Fault-Tolerance.
At the moment; the options for handling this look pretty hairy to me; since 
there seems to be a lot of reinventing-the-wheel for policies to ensure 
Availability and Reliability.

I'm just trying to understand exactly how this would be used in Production; 
without completely stressing-out DevOps.
Maybe there's a higher-level framework or tool that everyone else uses 
instead?

Then, I saw a disclaimer in the Akka Docs about how certain APIs for Akka 
Streams don't work well in a Remote Akka Actor Cluster scenario(1)
ActorPublisher and ActorSubscriber
 cannot be used with remote actors, 
because if signals of the Reactive Streams protocol (e.g. request) are lost 
the the stream may deadlock.

Could anyone recommend a resource to learn about 'Next-Level, Best 
Practices for Akka Actor Fault-Tolerance'?
The Akka Documentation isn't able to provide this kind of integrated 
perspective that I'm looking for!

THANK YOU so much in advance for any information resources to help me find 
out for myself the answers to the following:

* - TODO 1:  SUPERVISOR-COORDINATED SHUTDOWN STRATEGY RECOMMENDED; but SPOF if 
MASTER SUPERVISOR fails!
*   - HOW to detect shutdown -- i.e. do we need to reinvent the wheel with our 
own 'heartbeat'-check policy?
*   - HOW to shutdown simply and gracefully; via having Supervisor MESSAGE 
Children, so they can finish processing their event queues
*   before final shutdown:
*   - http://doc.akka.io/api/akka/2.3.0/#akka.actor.SupervisorStrategy
*   SHUTDOWN (top-down or bottom-up?) of hierarchy via delegating 
"ActorSystem.terminate",
* OR 
"Manager.gracefulStop() with timeout"
* OR via 
Supervisor's "DeathWatch"
* OR via 
"Poison Pill"?
*
* - TODO 2:  FAULT-TOLERANCE --  how is that managed to RECONSTITUTE state to
*   bring up replacement Actor (e.g. recover from snapshot at time first Actor 
died,
*including replay of interim input message 
queue while first Actor unavailable)
*
*
* - TODO 3:  What is default message ordering to an Actor --  
serial-single-threaded, first-one-arriving-wins?
*However, with multiple Senders on one Receiver and network 
latency; may not guarantee message order to Receiver
*corresponding to Sender's message order.  i.e. Message Order is 
NOT guaranteed, BUT serialization of messaged to Actor IS
*
* - TODO 4:  find out best-practices for SUBSCRIBER retries on ACK-TIMEOUT 
failures 
*
*
* - TODO 5:  find out how to integrate with Cassandra distributed UUID 
generator in a CLUSTER scenario for creating message
*Sequence IDs to deal with ordering issues from (TODO 3) above







-- 
>>  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] Creating multiple instances of ActorSystem

2016-09-21 Thread Patrik Nordwall
It's fine to create more than one in the same jvm. It can be useful for
tests. Be careful to not pass ActorRef instances in a way that would not be
possible if the ActorSystems were in different jvms. Only pass them with
messages. Locate them initially with actorSelection.

/Patrik
ons 21 sep. 2016 kl. 16:36 skrev Justin du coeur :

> On Wed, Sep 21, 2016 at 10:24 AM, Mark Kaberman 
> wrote:
>
>> I am wondering if it is possible to create multiple instances of
>> ActorSystem within a single JVM?
>>
>
> Possible, yes, but it's rarely a good idea -- ActorSystems are very
> heavyweight, and there are almost no conventional circumstances where it is
> appropriate to do so.  I don't know offhand whether creating multiple
> ActorSystems with the same name is safe; it certainly seems likely to cause
> conflicts, especially if you have any remoting involved...
>
> --
> >> 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] Managing Lifetimes for Http and WebSocket Connections

2016-09-21 Thread Dagny T
I had taken code from the Akka Documentation about handling WebSocket 
connections server-side with Akka Streams; 
and was able to take the essentials of that to connect to a simple 
Javascript Client to send data to the Server, augment it on Server, then 
echo it back to the Client.

However, I still had the following specific questions about parts of that 
code (see TODO comments 4, 5, 6); THANKS in advance for any insight!

// TODO 4:  find out how to choose between  bind, bindAndHandleSync, or 
bindAndHandleAsync for most REACTIVE/RESPONSIVE processing
//  i.e. ALL methods wrap internal AKKA support for TCP backpressure;
//   but Async permits concurrent requests on a single connection 
without waiting for a response first
// TODO 5:  what are the most important failure handling scenarios to handle; 
or can this be handled internally with
//  any specific higher-level API that propagates errors through Try 
collections?
// - Handling HTTP Server failures in the Low-Level API
// 
http://doc.akka.io/docs/akka/2.4.10/scala/http/low-level-server-side-api.html#controlling-server-parallelism
// - routing-level exceptions
// 
http://doc.akka.io/docs/akka/2.4.10/scala/http/routing-dsl/exception-handling.html#exception-handling-scala
val bindingFuture =
  Http().bindAndHandleSync(requestHandler, interface = "localhost", port = 8080)

println(s"Server online at http://localhost:8080/\nPress RETURN to stop...")
Console.readLine()

// TODO 6: Is it good practice to keep WebSocket connection open, monitoring 
for data on either Client or Server side;
// i.e. is it OK to just wait until Server is shutdown instead of 
explicitly closing Websocket prior to that shutdown?
// If not, how do you close that WebSocket explicitly, and outside of 
the request handlers?
import system.dispatcher // for the future transformations
bindingFuture
  .flatMap(_.unbind()) // trigger unbinding from the port
  .onComplete(_ => system.terminate()) // and shutdown when done

-- 
>>  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] out-of-the-box support for json serialization for akka persistence?

2016-09-21 Thread Patrik Nordwall
For Lagom I wrote json serializer that is using Jackson. You can look at it
for inspiration. It's stored in Cassandra as bytes, but how it's stored is
less important as far as I can see.

/Patrik
ons 21 sep. 2016 kl. 17:58 skrev Tim Pigden :

> Hi Justin
> Thanks for the comments. However, as I said I have decided that I do want
> to use json asa format, so I'm really looking to see who has direct
> experience of that.
> The serialization format is less orthogonal that you might expect, given
> that the database table layouts are all part of the plugin and as far as I
> can see, all use blob rather than json format with no obvious way to change
> that.
> And yes the json-ness does make a difference to me. Without going into
> elaborate CQRS "Q" coding, it will enable the developers to find out about
> how the system is being used, what sort of messages are being created with
> what payloads, through simple sql. My increased data volumes are extremely
> unlikely to burden a single server db in the short to medium term.
>
> Tim
>
>
> On Wednesday, September 21, 2016 at 2:58:27 PM UTC+1, Justin du coeur
> wrote:
>
>> A few general reactions (personally, I'm using Kryo over Cassandra, so I
>> can't address the direct questions):
>>
>> Keep in mind that json is a relatively bulky serialization format -- it's
>> going to take rather more disk space than more typical options like
>> protobuf.
>>
>> In *general*, the serialization format and database are pretty orthogonal
>> concerns.  It's possible that json might have specific advantages when used
>> with a json-native DB like Mongo, but AFAICT the Cassandra driver is the
>> most mature in general.  Are you planning on using the json-ness in some
>> particular way?
>>
>> Finally, remember that json doesn't save you from all the complications
>> of schema evolution: you're still going to need to think about how you deal
>> with missing fields, name changes, and stuff like that.  It's probably a
>> bit easier than Kryo, but only a bit.  Schema evolution is a real bear --
>> making sure I can deal with it took most of my effort in getting
>> Persistence up and running...
>>
> On Wed, Sep 21, 2016 at 9:16 AM, Tim Pigden  wrote:
>>
> Hi
>>> Reading
>>>
>>> http://doc.akka.io/docs/akka/2.4.10/scala/persistence-schema-evolution.html
>>>
>>> and thinking about what we currently do, I've concluded that I'd like to
>>> serialize my events as json.
>>> The article suggests I should check the list of plugins to see which
>>> specifically support json. But I can't find clear indications that any of
>>> them do from the respective github pages (apologies if I've missed
>>> something). Most seem to want the target database tables to be a BLOB with
>>> no option of a native json type.
>>>
>>> My current database target is Postgres (because we use postgis for
>>> mapping and because I need a proper sql database for data warehouse).
>>> However, for the event serialization I could certainly contemplate
>>> something else if it made the current development path quicker and easier.
>>> MongoDB or Cassandra are obvious possible targets.
>>>
>>> So my question is: is anyone actually using json as a serialization
>>> format, and if so
>>> a) what database and driver?
>>> b) is the database-native json support being used (if any?)
>>> c) how much effort was it? I can already serialize everthing to json
>>> that needs to go in the persistence journal or snapshots.
>>>
>>> it's got to be something with active support/interest.
>>>
>>> Thanks
>>> tim
>>>
>> --
>>> >> 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: 

Re: [akka-user] On cluster node failure is there an automatic way to recover cluster shard persistent actors in the failed node to other node?

2016-09-21 Thread Patrik Nordwall
Automatic startup on other node is how it is supposed to work, and we have
tests for it. How do you down the dead node?

/Patrik
mån 19 sep. 2016 kl. 22:00 skrev Ajmal Babu :

> Working on AKKA persistence with cluster sharding and the flag
> akka.cluster.sharding.remember-entities set to "on". For some reason when
> one of the node dies in the cluster the entities in that node does not get
> automatically restarted in the other available nodes in the cluster. Is
> that the expected behavior? Is there an automatic recover-ability on node
> failure to move actors to another node, for such feature what is the right
> way to implement?
>
> --
> >> 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] How to configure cluster for two machines

2016-09-21 Thread Gerard W
I'm using Akka 2.3.15 (java) and I'm trying to get a cluster with two 
members in two different hosts. Everything runs fine when I start the two 
nodes on a single machine, but then when I try to start up the second node 
on a different machine, it keeps getting "Association with remote system 
[...] has failed". 
I know I'm probably not configuring it right, but I don't know exactly how 
to do it.

So in the hostA (ip 192.168.2.21) I'm running an actor on 2552 that joins 
successfully to the cluster. The application.conf looks like:

akka {
  actor {
provider = "akka.cluster.ClusterActorRefProvider"
  }  
  remote {
log-remote-lifecycle-events = off
netty.tcp {
  hostname = "192.168.2.21"
  port = 0
}
  }
  cluster {
seed-nodes = [
  "akka.tcp://MulticastPocCluster@192.168.2.21:2552"]

  }
}
akka.cluster.metrics.enabled=off
akka.extensions=["akka.cluster.metrics.ClusterMetricsExtension"]
akka.cluster.metrics.native-library-extract-folder=${user.dir}/target/native

I've copied everything over to hostB (ip 192.168.2.55), modified the 
application.conf file to:

akka {
  actor {
provider = "akka.cluster.ClusterActorRefProvider"
  }
  remote {
log-remote-lifecycle-events = off
netty.tcp {
  hostname = "192.168.2.55"
  port = 0
}
  }
  cluster {
seed-nodes = [
  # Seed node in the other host
  "akka.tcp://MulticastPocCluster@192.168.2.21:2552"]
  }
}
akka.cluster.metrics.enabled=off
akka.extensions=["akka.cluster.metrics.ClusterMetricsExtension"]
akka.cluster.metrics.native-library-extract-folder=${user.dir}/target/native

I've verified that I can ping hostA from hostB by ip address. But I get 
this error when I try to start up an actor on hostB:

INFO] [09/21/2016 12:52:53.229] 
[MulticastPocCluster-akka.remote.default-remote-dispatcher-6] 
[akka.tcp://MulticastPocCluster@192.168.2.55:2552/system/transports/akkaprotocolmanager.tcp0/akkaProtocol-tcp%3A%2F%2FMulticastPocCluster%40192.168.2.21%3A2552-1]
 
No response from remote for outbound association. Associate timed out after 
[15000 ms].
[WARN] [09/21/2016 12:52:53.232] 
[MulticastPocCluster-akka.remote.default-remote-dispatcher-5] 
[akka.tcp://MulticastPocCluster@192.168.2.55:2552/system/endpointManager/reliableEndpointWriter-akka.tcp%3A%2F%2FMulticastPocCluster%40192.168.2.21%3A2552-0]
 
Association with remote system 
[akka.tcp://MulticastPocCluster@192.168.2.21:2552] has failed, address is 
now gated for [5000] ms. Reason: [Association failed with 
[akka.tcp://MulticastPocCluster@192.168.2.21:2552]] Caused by: [No response 
from remote for outbound association. Associate timed out after [15000 ms].]

Log from hostA:

[INFO] [09/21/2016 12:51:14.402] [main] [akka.remote.Remoting] Starting 
remoting
[INFO] [09/21/2016 12:51:14.649] [main] [akka.remote.Remoting] Remoting 
started; listening on addresses 
:[akka.tcp://MulticastPocCluster@192.168.2.21:2552]
[INFO] [09/21/2016 12:51:14.663] [main] 
[akka.cluster.Cluster(akka://MulticastPocCluster)] Cluster Node 
[akka.tcp://MulticastPocCluster@192.168.2.21:2552] - Starting up...
[INFO] [09/21/2016 12:51:14.762] [main] 
[akka.cluster.Cluster(akka://MulticastPocCluster)] Cluster Node 
[akka.tcp://MulticastPocCluster@192.168.2.21:2552] - Registered cluster JMX 
MBean [akka:type=Cluster]
[INFO] [09/21/2016 12:51:14.762] [main] 
[akka.cluster.Cluster(akka://MulticastPocCluster)] Cluster Node 
[akka.tcp://MulticastPocCluster@192.168.2.21:2552] - Started up successfully
[INFO] [09/21/2016 12:51:14.796] 
[MulticastPocCluster-akka.actor.default-dispatcher-2] 
[akka.cluster.Cluster(akka://MulticastPocCluster)] Cluster Node 
[akka.tcp://MulticastPocCluster@192.168.2.21:2552] - Node 
[akka.tcp://MulticastPocCluster@192.168.2.21:2552] is JOINING, roles []
[INFO] [09/21/2016 12:51:14.809] 
[MulticastPocCluster-akka.actor.default-dispatcher-2] 
[akka.cluster.Cluster(akka://MulticastPocCluster)] Cluster Node 
[akka.tcp://MulticastPocCluster@192.168.2.21:2552] - Leader is moving node 
[akka.tcp://MulticastPocCluster@192.168.2.21:2552] to [Up]
sep 21, 2016 12:51:15 PM kamon.sigar.SigarProvisioner provision
ADVERTENCIA: Sigar library is already provisioned.
[INFO] [09/21/2016 12:51:15.376] 
[MulticastPocCluster-akka.actor.default-dispatcher-3] 
[akka.cluster.Cluster(akka://MulticastPocCluster)] Cluster Node 
[akka.tcp://MulticastPocCluster@192.168.2.21:2552] - Metrics collection has 
started successfully

Log from hostB:

[INFO] [09/21/2016 12:52:37.915] [main] [akka.remote.Remoting] Starting 
remoting
[INFO] [09/21/2016 12:52:38.087] [main] [akka.remote.Remoting] Remoting 
started; listening on addresses 
:[akka.tcp://MulticastPocCluster@192.168.2.55:2552]
[INFO] [09/21/2016 12:52:38.087] [main] 
[akka.cluster.Cluster(akka://MulticastPocCluster)] Cluster Node 
[akka.tcp://MulticastPocCluster@192.168.2.55:2552] - Starting up...
[INFO] [09/21/2016 12:52:38.165] [main] 
[akka.cluster.Cluster(akka://MulticastPocCluster)] Cluster Node 

[akka-user] Memory Bounding Akka Streams

2016-09-21 Thread Dagny T

Just wanted to check with folks if I had the correct implementation for how 
to protect from blowing up memory when working with Akka Streams.

I've merged a Lightbend Blog post's code, with the latest API changes for 
Akka v2.4.9, and the latest documentation about buffered streams in the 
v2.4.9 API Docs.

However, none of those explain these questions I have.  Please see question 
comments, regarding the code snippet below it!  THANKS in advance for any 
insights!

// TODO 3:  MODIFIED to calling buffered API within Graph mapping -- check 
assumptions!
//  - where INTERNAL Akka implementation calls onNext() to get next 
BUFFERED batch,
//so you don't have to worry about it as a DEV?
//  - NUMERIC bound of 10 refers to NUMBER of elements (of possibly 
complex types) on a
//UNIFORM-ELEMENT-TYPED stream, rather than Bytes, right?
//  - if source produces N < BUFFER_MAX elements; then those are simply 
passed through the pipeline without
//waiting to accumulate BUFFER_MAX elements
//


inputSource.buffer(10, OverflowStrategy.dropHead) ~> f1 ~> ...

-- 
>>  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] Creating multiple instances of ActorSystem

2016-09-21 Thread Justin du coeur
On Wed, Sep 21, 2016 at 10:24 AM, Mark Kaberman  wrote:

> I am wondering if it is possible to create multiple instances of
> ActorSystem within a single JVM?
>

Possible, yes, but it's rarely a good idea -- ActorSystems are very
heavyweight, and there are almost no conventional circumstances where it is
appropriate to do so.  I don't know offhand whether creating multiple
ActorSystems with the same name is safe; it certainly seems likely to cause
conflicts, especially if you have any remoting involved...

-- 
>>  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] Creating multiple instances of ActorSystem

2016-09-21 Thread Mark Kaberman
I am wondering if it is possible to create multiple instances of 
ActorSystem within a single JVM? 

I create my systems as

ActorSystem actorSystem = ActorSystem.create("mySystem", ConfigFactory.load
().getConfig("mySystem"));

and when I call startTime() of each system created it seems to indicate 
that the systems were created at different times. However when I terminate 
one system the messages which where sent within other systems end up in the 
dead letter box which seems to indicate that in reality only one system was 
created.

-- 
>>  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] out-of-the-box support for json serialization for akka persistence?

2016-09-21 Thread Justin du coeur
A few general reactions (personally, I'm using Kryo over Cassandra, so I
can't address the direct questions):

Keep in mind that json is a relatively bulky serialization format -- it's
going to take rather more disk space than more typical options like
protobuf.

In *general*, the serialization format and database are pretty orthogonal
concerns.  It's possible that json might have specific advantages when used
with a json-native DB like Mongo, but AFAICT the Cassandra driver is the
most mature in general.  Are you planning on using the json-ness in some
particular way?

Finally, remember that json doesn't save you from all the complications of
schema evolution: you're still going to need to think about how you deal
with missing fields, name changes, and stuff like that.  It's probably a
bit easier than Kryo, but only a bit.  Schema evolution is a real bear --
making sure I can deal with it took most of my effort in getting
Persistence up and running...

On Wed, Sep 21, 2016 at 9:16 AM, Tim Pigden  wrote:

> Hi
> Reading
> http://doc.akka.io/docs/akka/2.4.10/scala/persistence-schema
> -evolution.html
>
> and thinking about what we currently do, I've concluded that I'd like to
> serialize my events as json.
> The article suggests I should check the list of plugins to see which
> specifically support json. But I can't find clear indications that any of
> them do from the respective github pages (apologies if I've missed
> something). Most seem to want the target database tables to be a BLOB with
> no option of a native json type.
>
> My current database target is Postgres (because we use postgis for mapping
> and because I need a proper sql database for data warehouse). However, for
> the event serialization I could certainly contemplate something else if it
> made the current development path quicker and easier. MongoDB or Cassandra
> are obvious possible targets.
>
> So my question is: is anyone actually using json as a serialization
> format, and if so
> a) what database and driver?
> b) is the database-native json support being used (if any?)
> c) how much effort was it? I can already serialize everthing to json that
> needs to go in the persistence journal or snapshots.
>
> it's got to be something with active support/interest.
>
> Thanks
> tim
>
> --
> >> 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] out-of-the-box support for json serialization for akka persistence?

2016-09-21 Thread Tim Pigden
Hi
Reading 
http://doc.akka.io/docs/akka/2.4.10/scala/persistence-schema-evolution.html

and thinking about what we currently do, I've concluded that I'd like to 
serialize my events as json.
The article suggests I should check the list of plugins to see which 
specifically support json. But I can't find clear indications that any of 
them do from the respective github pages (apologies if I've missed 
something). Most seem to want the target database tables to be a BLOB with 
no option of a native json type.

My current database target is Postgres (because we use postgis for mapping 
and because I need a proper sql database for data warehouse). However, for 
the event serialization I could certainly contemplate something else if it 
made the current development path quicker and easier. MongoDB or Cassandra 
are obvious possible targets.

So my question is: is anyone actually using json as a serialization format, 
and if so
a) what database and driver?
b) is the database-native json support being used (if any?)
c) how much effort was it? I can already serialize everthing to json that 
needs to go in the persistence journal or snapshots.

it's got to be something with active support/interest.

Thanks
tim

-- 
>>  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 Stream] Happens-before relation and runForEach

2016-09-21 Thread Viktor Klang
Technically I think the solution holds water, there are appropriate
barriers in place. (multi-materialization aside)

However, as mentioned, fold() would be a much cleaner, safer and
maintainable solution.

-- 
Cheers,
√

On Sep 21, 2016 07:05, "Roland Kuhn"  wrote:

> Technically I'm not sure this is correct: since f is only called from
> within a single operator (and assuming only a single materialization) the
> shown code should work just fine. Of course it is necessary to know what
> you're doing when coding like this, and as Konrad says there are better
> alternatives available, but guaranteeing ordering for example for db writes
> would certainly be desirable.
>
> Regards, Roland
>
> Sent from my iPhone
>
> On 21 Sep 2016, at 01:33, Konrad Malawski 
> wrote:
>
>
> final Source source = // ...
> final MutableInt max = new MutableInt(Integer.MIN_VALUE);
> final Procedure f = i -> {
>   if (i > max.intValue()) {
> max.setValue(i);
>   }
> };
> final CompletionStage result = source
> .runForeach(f, materializer)
> .thenApply(__ -> max.intValue());
>
> Is the above code correct in the sense that it always commutes the maximum
> (or MIN_VALUE in case the stream is empty)?
>
> According to Akka Stream documentation
> 
>  on
> Stream Ordering, there is a Java happens-before relation between
> invocations of f. Do I still need to use AtomicInteger so that the effects
> are seen by all threads?
>
> You're side-effecting outside the stream, so nothing is guaranteed.
>
> Yes, it would have to be an atomic integer.
>
>
> Instead consider using a better operator for this kind of thing than
> foreach - like fold (runFold) which is enough for such operation you're
> doing here.
>
>
> Happy hakking.
>
> -- konrad
>
> --
> >> 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] Scala Akka Alignment

2016-09-21 Thread Endre Varga
Also, why not the latest version 2.4.10?

On Wed, Sep 21, 2016 at 1:19 AM, Konrad Malawski <
konrad.malaw...@lightbend.com> wrote:

> You can see which version of Scala an Akka artifact is released for by
> looking at the artifact names:
> http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22akka-remote_2.11%22
>
> So as you see, it's released for 2.11.
>
> That you're talking about jar files makes me thing you're mixing different
> akka versions... That's not supported, make sure it's all the same version
> of Akka.
>
> --
> Konrad `ktoso` Malawski
> Akka  @ Lightbend 
>
> On 20 September 2016 at 14:28:32, Joseph Mansigian (
> joseph.c.mansig...@gmail.com) wrote:
>
> I am trying to use scala 2.11.8 and akka 2.4.9 for remoting.  Not sure if
> these versions are compatible.  I noticed that there is an akka jar with
> scala which is confusing to me since I already hava akka jars on the
> classpath.  When I run code  I am getting:
>
>   java.lang.NoSuchMethodError: akka.util.Helpers$.
> toRootLowerCase(Ljava/lang/String;)Ljava/lang/String;
>
> Have the jar with some version of akka.util.Helpers$ on the classpath but
> apparently this version does not have the method cited in the error
> message.  Anyone recognize what is happening?  Source, classpath, directory
> structure, stacktrace, etc available on demand.   Thank you for helping.
>
> --
> >> 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.