Re: [akka-user] Akka TCP with Actors vs Akka Streams and Flows/Graphs

2016-07-27 Thread Akka Team
Hi,

Akka streams is defintely fit for "main stream development with semi
complex business logic", it is however not a framework but a tool in a
toolkit. As such it does have a learning threshold (just like actors do if
you are new to that concept), so some problems may not initially be
expressible using it, and of course not all problems does fit perfectly
with the paradigm.

If you are happy with your actor based solution, I don't see an obvious
need to rewrite using streams, although I personally find the IO part very
nicely expressed with streams. You could also just introduce streams in
parts of your system where you need back pressure and it is an abstraction
that fits the problem, the only thing to think of is the asynchronous
boundaries and where you go from backpressured to not backpressured and how
to deal with that.

1. Sounds like the cross connection session buffer would be nicely kept as
an actor, you can interact with actors from your flows using the ask
pattern and mapAsync, there are also additional stages specifically
designed to interact with actors (Source.actorRef and
Sink.{actorRef|actorRefWithAck} for example).
2. This is just application logic and highly application specific,
deserialize incoming messages and provide a stream or stage that closes the
stream if any other than a valid auth message comes from the client, and
thereafter lets the messages through.
3. To guarantee at least once delivery after the parsing a message you
would have to persist it before parsing, the app could crash, the OS could
crash, the server hardware could fail just the moment after parsing but
before anything has been done with it.

The section on using TCP with streams may be useful:
http://doc.akka.io/docs/akka/2.4.8/scala/stream/stream-io.html#Streaming_TCP

--
Johan

On Tue, Jul 26, 2016 at 9:06 AM, Jarl André Hübenthal 
wrote:

> Has some developed an akka stream based TCP server where connections is
> kept open and frame delimited messages is pouring in, and is eventually
> stored somewhere in a database? It seems to be such a simple pattern that i
> am surprised to not find any examples for it. But maybe the world is not so
> simple, or maybe akka streams arent targeted for main stream development
> with semi complex business logic. I need session management, authentication
> (crude) and cross connection session buffer, where connections can connect,
> send a partial message, disconnect for some reason, reconnect and send the
> last part of the message. The first message is always an HELO message (or
> login message). I feel the actor way of doing it is too fragile and
> resource consuming. I have like a river dance of actors doing all the
> wiring to keep session buffer for each connection, store the data and also
> to make sure that each message is at least stored once (only once in fact
> since i use unique index on table).
>
> Today I have:
>
> ActorSystem1(ServerActor -> ConnectionActor * N -> SessionActor * N) ->
> ActorSystem2(BackendRouterActor -> BackendWorkerActor)
>
> The ServerActor is where akka tcp sets up the the server, with host and
> port.
>
> ConnectionActor is one per connection, and validates the first message
> received as a login message. If not a login message, disconnects. If valid
> login message, creates a new SessionActor or finds an existing one, and
> then passes all further messages to the SessionActor.
>
> SessionActor is a persistent actor and keeps in its journal message
> buffer, last message received and message counter, and will process the
> buffer for each incoming message chunk. It searches with a tail recursive
> function (but I could also done look ahead) for messages that ends with
> delimiter, parses this messages into an Event object and sends this off to
> the BackendRouterActor.
>
> BackendRouterActor is a persistent At least once delivery actor, that when
> receives an Event object persists it and sends it off to the worker. If not
> confirmed within a time limt, resends, as usual with ALOD.
>
> I know there may be some weaknesses in this architecture, so general
> advice on the architecture would be great.
>
> But my main question, drawn in direct or abstract lines, how can this be
> done with Akka Streams?
>
> I see three problems (things i dont know the solution for) with akka
> streams:
>
> 1) The cross connection session buffer and other parameters related to
> session
> 2) Connection authentication (HELO message, which must be specific format)
> 2) At least once delivery where all parsed events MUST be stored.
>
> Someone who can shed some insight on possible solutions to these problems
> and the topic in general, how to convert such an actor based stateful app
> to akka streams?
>
> --
> >> 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 

Re: [akka-user] Re: Tcp TLS example with client auth

2016-07-27 Thread Akka Team
Hi Magnus,

The TLS stage does actually have some end user documentation, look at the
TLS object and its factory methods. We use the TLS module in Akka HTTP so
those sources may be interesting to look at. Additionally, if it is just
about configuration, then the documentation for the Typesafe SSL Config
library is possibly helpful: http://typesafehub.github.io/ssl-config/

--
Johan

On Wed, Jul 27, 2016 at 5:29 AM, Vinay Gajjala  wrote:

> Hello Magnus
>
> This is not an answer to your problem but I am trying to get an answer to
> my problem. I am working on a POC developing a TCP server which listens on
> device traffic. I was able to implement the server using Akka IO (v2.3.14)
> and trying to figure out how to configure TLS for this TCP server. I read
> the documentation and online posts but could not figure out. Maybe I am
> missing the obvious.
>
> I see you question is around TCP+TLS so I decided to ask.
>
> Hoping you have  something that  might help me.
>
> Thanks
> Vinay
>
>
> On Friday, May 13, 2016 at 3:10:29 AM UTC-5, Magnus Andersson wrote:
>>
>> Hi
>>
>> I have a TCP+TLS pipeline in with Akka Streams that is not working. It
>> does work when creating a test and wrapping a Client TLS stage, I can read
>> the client certificate without problems. But when I run it and try to
>> connect with client software using the same keys/certificates for openssl I
>> get connection refused. If I remove the TLS wrapper and turn off TLS on
>> client side the TCP server works fine.
>>
>> Since the TLS stage have no end user documentation today, I'm hoping
>> someone have built a (simple) sample app that uses TLS over TCP and don't
>> mind sharing it? Preferably something that uses client certificates, I am
>> probably just getting some config wrong.
>>
>> Regards
>> Magnus Andersson
>>
>>
>> --
> >> 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] Retry only has meaning for restart in SuperVisorStragety?

2016-07-27 Thread Akka Team
Hi Yan,

If you choose resume, you think that the actor state is ok, but the message
bad, so you don't want to retry the message. If you choose restart then it
may have been the actor state that was bad, that will be fixed by the
restart and then it may be reasonable to retry the message, if you stopped
the actor it definitely does not make sense to retry the message as the
actor will be no more.

--
Johan

On Thu, Jul 21, 2016 at 10:05 PM, Yan Pei  wrote:

> Hello,
>
>From the doc and my testing, looks like "retry only is meaningful if I
> want to restart the Actor? For resume() it will not apply the retry? Do I
> understand it correctly?
>
> Thanks,
> Yan
>
> --
> >> 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] Cleanup after HttpResponse

2016-07-27 Thread Akka Team
When you do not control the materialization you can attach callbacks to the
future when materializing using something like this:
.mapMaterializedValue(future
=> future.alsoTo(someLogicOnCompletion))

--
Johan

On Tue, Jul 26, 2016 at 2:47 PM, daleksan 
wrote:

> Hello,
>
> I was wondering what is the best way to clean up resources after an
> HttpResponse was sent over the network.
>
> I need to use a legacy file-backed implementation of a buffer to get the
> data for HTTP responses. The API gives an InputStream to the data and
> eventually I need to call the cleanup methods (so the underlying file is
> deleted etc.). I can construct a source from the InputStream
> with StreamConverters.fromInputStream, so far so good. The source then is
> passed to the response entity: HttpEntity.Default(contentType,
> contentLength, respSource). The tricky bit is when to invoke the cleanup.
> It cannot be done as part of the flow which constructs the HttpResponse,
> because at this point the response entity hasn't read the data. The source
> passed to the entity is not yet materialised as I understand, so I don't
> have the Future[IOResult] instance, which I could wait for to execute the
> cleanup.
>
> I found something here, but is doesn't seem to give my the answer:
> https://github.com/akka/akka/issues/18571
>
> Thank you
>
>  David
>
> --
> >> 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] Issue with Akka Camel Producer: component is receiving BoxedUnit

2016-07-27 Thread Akka Team
Hi Héctor,

You are transforming the message from a CamelMessage to a Unit in your
method:

override def transformOutgoingMessage(msg: Any) = {
  println(s"${msg.getClass}")
}

println returns Unit, when interacting with Java the Unit object becomes
BoxedUnit as Unit does not exist in Java-land.

Make sure to either remove that transform method or return the message from
it and it will work.

--
Johan


On Mon, Jul 25, 2016 at 8:28 PM, Héctor Veiga  wrote:

> object CamelMessageProducer {
>   def props(uri: String) = Props(new CamelMessageProducer(uri))
> }
>
> class CamelMessageProducer(uri: String) extends Producer {
>   def endpointUri = uri
>
>   override def transformOutgoingMessage(msg: Any) = {
> println(s"${msg.getClass}")
>   }
> }
>

-- 
>>  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] Question about Akka Scaling: Memory

2016-08-09 Thread Akka Team
Additionally you have the Akka cluster tools, such as sharding, which will
let you scale out to more than one machine when the domain model you want
to keep in memory no longer fit in the memory of one node.

Akka will also work, out of the box, with three times the number of cores
threads (capped to min 8 and max 64), while for example tomcat 7 has a
default thread pool size of 200 - each of those threads taking a default
0.5mb of stack memory outside of the JVM. So on a 8 core server, with
default config, that's 12mb with akka and 100mb for tomcat 7.

It does not do two phase commits though, because that does not scale well,
so that is a difference from JMS. There are other patterns around this but
it will take a while to get your head around. It will also require some
effort learning about async and how to deal with potentially blocking
libraries etc.

I'm partial but I'd say it's definitely worth learning ;)
--
Johan
Akka Team

On Tue, Aug 9, 2016 at 6:43 PM, Rob Crawford <rob5...@gmail.com> wrote:

>
>
> On Tuesday, August 9, 2016 at 11:14:57 AM UTC-4, drewhk wrote:
>>
>>
>>
>> On Tue, Aug 9, 2016 at 5:07 PM, Rob Crawford <rob...@gmail.com> wrote:
>>
>>> The project home page says "~2.5 million actors per GB of heap" --
>>>
>>
>> That is sadly outdated, actors now take up more memory. Still, not a
>> drastic difference, the million in magnitude likely holds.
>>
>>
>>> that works out to just about 430 bytes per actor. I'm assuming these
>>> actors have little or no state of their own, and the figure includes the
>>> Akka kernel itself.
>>>
>>
>> Akka "kernel" is a constant in this picture. What is measured here is the
>> size of a minimal actor, which is yes, a few hundred bytes. Of course as
>> soon as an actor has a message in its mailbox, then that will consume
>> memory.
>>
>
> Yes -- and I'm purposefully over-estimating the memory the actors will
> take up.
>
>
>> More efficient than what? There is nothing surprising that an actor
>> itself is a few hundred bytes (and the additional state you put in there of
>> course). It just keeps a queue, some fields for various internal state
>> (like references to child actors, list of watchers, etc). These are all
>> small, albeit they can grow depending on the pattern the actors are used.
>>
>
> More memory efficient than a Spring-based JMS system.
>
> I'm used to systems with anemic object models -- just value-carriers that
> sit between the database and servlets or JMS queues -- that still consume
> multiple GB of memory. The possibility of an active, meaningful object
> model that takes up less memory is... breath taking.
>
> Sorry if I'm wasting everyone's time.
>
> --
> >>>>>>>>>> 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] how to do a rolling cluster upgrade with marathon?

2016-08-10 Thread Akka Team
Hi Bert,

No, you are correct.

You may have a race there that could lead to split brain though, depending
on how the service registry integration works, if one node asks the
registry for cluster nodes but get no buddies, before it has completed
joining itself another node asks and does the same. This race is
essentially what the consistent list of seed nodes initially protects
against.

--
Johan
Akka Team

On Tue, Aug 9, 2016 at 12:18 PM, Bert Robben <bert.rob...@gmail.com> wrote:

> Hi guys,
>
> I don't have any seed nodes statically configured. When the cluster
> starts, it consults the marathon service registry to see if it can find any
> buddies. The node then connects to the oldest one of these by
> programmatically setting the seed nodes property to the address of that
> node. If the node see that he himself is the oldest, he does a self-join.
>
> I thought that seed-nodes are only used when the node joins, so once
> that's phase is over it's no longer used. As such I didn't see the reason
> why I would add more seed nodes.
>
> Am I wrong here?
>
> Bert
>
> On Tue, Aug 9, 2016 at 10:42 AM, Guido Medina <oxyg...@gmail.com> wrote:
>
>> Hi Bert,
>>
>> What Martynas mentioned is the key to have a successful rolling restart,
>> for production you need more than one seed node, I would even start my
>> rolling restart with the seed nodes,
>> it shouldn't make a difference but it will help the new started nodes not
>> to rejoin seed nodes.
>>
>> There is no recommended number AFAIK on how many seed nodes you should
>> have other than more than 1,
>> these are usually set to cover possible hardware failure:
>> For example, if you have 5 servers, 2 seed nodes on two different
>> hardware cover the case of 1 server crash, etc.
>>
>> HTH,
>>
>> Guido.
>>
>> On Tuesday, August 9, 2016 at 8:59:30 AM UTC+1, Martynas Mickevičius
>> wrote:
>>>
>>> Hi Bert,
>>>
>>> do you have more than one node in the seed-node list? If there is only
>>> one node in that list, then when that node is restarted, it will not be
>>> able to join the already existing cluster, but will form a cluster on its
>>> own.
>>>
>>> On Mon, Aug 8, 2016 at 6:19 PM, Bert Robben <bert@gmail.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> I'm deploying my akka cluster with mesos and would like to do rolling
>>>> upgrades with marathon. My app has a few cluster singletons and also using
>>>> cluster sharding (with ddata). The cluster is small for now (between 2 and
>>>> 4 nodes).
>>>>
>>>> So the scenario is the following
>>>> (1) I have a happy cluster
>>>> (2) I signal marathon to do the rolling upgrade
>>>> (3) marathon starts a new node running my app
>>>> (4) the new node joins the cluster
>>>> (5) when the newly started node is healthy, marathon kills one of the
>>>> (older) existing nodes
>>>> (6) marathon repeats 3-5 until all nodes are replaced
>>>>
>>>> The problem I have is that I don't know when I can consider the new
>>>> node to be "healthy". I now say that the node is healthy when it has
>>>> successfully joined the cluster (that means when it sees himself as joined
>>>> with member state = up). But that doesn't seem to work as I seem to get
>>>> into situations where different nodes see different cluster members and
>>>> this never gets resolved. I assume this happens when the "cluster master"
>>>> is killed at a time that the cluster information is not yet properly
>>>> distributed to everyone.
>>>>
>>>> Yes, I'm still using auto-down-unreachable-after. I know that this is a
>>>> no-go because of split-brain and I'm planning to tackle that later. But as
>>>> I understand it (could be wrong here), using auto-down should not hurt 
>>>> here?
>>>>
>>>> Anyone an idea how I should tackle this?
>>>>
>>>> thanks,
>>>>
>>>> Bert
>>>>
>>>> --
>>>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>>>> >>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/c
>>>> urrent/additional/faq.html
>>>> >>>>>>>>>> Search the archives: https://groups.google.com/grou
>>>> p/akka-user
>>>> ---
>>>> You received this message because you are subscribed to the G

Re: [akka-user] Errors using Partition for custom FanOutShape

2016-08-11 Thread Akka Team
The sample code does not contain a Broadcast, but your error message does,
so I can't see how the source you showed would give that error.

This little sample works nicely as expected:

Source<Integer, NotUsed> source = Source.from(Arrays.asList(0, 1, 2,
3, 4, 5, 6, 7, 8, 9, 10));

final Flow<Integer, Integer, NotUsed> flow =
Flow.fromGraph(GraphDSL.create(builder -> {

  final UniformFanOutShape<Integer, Integer> partition =
builder.add(Partition.create(2, x -> x % 2));
  final UniformFanInShape<Integer, Integer> merge =
builder.add(Merge.create(2));

  final FlowShape<Integer, Integer> add = builder.add(Flow.<Integer,
Integer>fromFunction(x -> x + 1));
  final FlowShape<Integer, Integer> subtract =
builder.add(Flow.<Integer, Integer>fromFunction(x -> x - 1));

  builder.from(partition).via(add).toFanIn(merge);
  builder.from(partition).via(subtract).toFanIn(merge);

  return new FlowShape<>(partition.in(), merge.out());
}));

source.via(flow).runForeach(System.out::println, materializer);


-- 
Johan
Akka Team

-- 
>>>>>>>>>>  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 create two Tcp Connections with the same port

2016-07-12 Thread Akka Team
That will only be possible if the hosts resolve to different IP-addresses
on the machine they are run on. For example you could create a virtual
interface with a separate IP address for one of the hostnames.

--
Johan

On Mon, Jul 11, 2016 at 9:12 PM, Chris Stewart 
wrote:

> Hi, as the title says i'm trying to create 2 tcp connections from the same
> port
>
> Here is the stackoverflow question:
> https://stackoverflow.com/questions/38314437/akka-create-two-tcp-connections-with-the-same-port
>
> I'm trying to create two tcp connections that are bound to the same port.
> I'm getting an error saying that the `java.net.BindException: Address
> already in use`. This makes sense since they are both using `18333` as a
> port, but there must be some way to have two connections on a port that
> have unique hosts. I'm following along with the [guide in the akka tcp
> manual][1]. How can I make this work? The protocol says that connections
> need to be created on `18333`, however if I can only have one peer at a
> time it makes the p2p portion of the protocol useless.
>
> Here is the code:
>
> val probe1 = TestProbe()
> val probe2 = TestProbe()
> val client1 = system.actorOf(Client.props(TestNet3, probe1.ref))
> val client2 = system.actorOf(Client.props(TestNet3, probe2.ref))
>
> val local = new InetSocketAddress(18333)
>
> val remote1 = new InetSocketAddress("
> testnet-seed.bitcoin.petertodd.org", 18333)
>
> client1 ! Tcp.Connect(remote1,Some(local))
> probe1.expectMsgType[Tcp.Connected]
>
> val remote2 = new InetSocketAddress("testnet-seed.bluematt.me", 18333)
> client2 ! Tcp.Connect(remote2,Some(local))
> probe2.expectMsgType[Tcp.Connected]
>
>
> client1 ! Tcp.Abort
> client2 ! Tcp.Abort
>
>
>   [1]: http://doc.akka.io/docs/akka/2.3.15/scala/io-tcp.html#Connecting
>
> --
> >> 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] Akk Cluster Singletion - Oldest node down message

2016-07-13 Thread Akka Team
Hi,

In Akka Cluster unreachable and downed are two different things, a node can
become unreachable when there is network problems, its JVM is having a long
GC pause etc. it may come back from unreachable. Down on the other hand is
when a decision has been made about that specific node, that it will never
come back and should be removed from the cluster. Cluster singleton will
only move the actual singleton when the old node has been downed, as if it
reacted on unreachable, the node may still be running and there would be
two singleton instances in the cluster.

A node can be marked down manually, using auto-down (which is dangerous
because it can lead to "split brain") or using the split brain resolver
which is a part of the commercial offerings from Lightbend. You can read
more about the options here:

*
http://doc.akka.io/docs/akka/2.4.8/scala/cluster-usage.html#Automatic_vs__Manual_Downing
*
https://www.lightbend.com/blog/how-to-handle-network-partitions-decisively-with-akka-split-brain-resolver

--
Johan

On Sat, Jul 2, 2016 at 1:30 PM, Madabhattula Rajesh Kumar <
mrajaf...@gmail.com> wrote:

> Hi,
>
> In Akka Cluster Singleton how worker(younger) node receive a message when
> Cluster Singleton node(Oldest) was down ?
>
> In Akka *younger* node I am seeing below WARN message
>
> *[WARN] [07/02/2016 00:32:55.720]
> [ClusterSystem-akka.actor.default-dispatcher-2]
> [akka.tcp://ClusterSystem@hostname1:2551/system/cluster/core/daemon]
> Cluster Node [akka.tcp://ClusterSystem@hostname1:2551] - Marking node(s) as
> UNREACHABLE [Member(address = akka.tcp://ClusterSystem@hostname2:2552,
> status = Up)]. Node roles []*
>
> How to receive this event from younger node.
>
>
> Regards,
> Rajesh
>
> --
> >> 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] Re: How to wait for akka http request

2016-07-13 Thread Akka Team
Hi,

You are saying "there would be errors", is this something you have seen or
are you speculating about the behavior under load? And if it is something
seen, what are those errors?

--
Johan

On Sun, Jul 10, 2016 at 7:25 PM, Sang Dang  wrote:

> I think you could limit your thread pool of request handler.
>
>
> On Tuesday, June 28, 2016 at 5:08:24 PM UTC+7, Jingxiao Gu wrote:
>>
>> Hi, everyone
>> I came into a problem. For example, My server can maintain 100-150 http
>> connections at the same time. If I send 1000 http requests
>> asynchronously(using dispatch) at the same time, there would be errors
>> because the server can't handle that much at a time. So, is there a way
>> such that when the amount of http connection is over 100, we can block/wait
>> until some connections are released?
>>
>> 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.
>

-- 
>>  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] Access to LoggingAdapter

2016-07-14 Thread Akka Team
If you are writing a custom graph stage, you can access it inside the
GraphStageLogic from the ActorSystem like this:

materializer match {
  case mat: ActorMaterializer => mat.logger
  case _ => throw new RuntimeException("this stage only works with an
actor materializer")
}

Note that this may make the stage impossible to use with any future
alternative materializers.

--
Johan

On Wed, Jul 13, 2016 at 9:54 PM, Richard Rodseth  wrote:

> Is there a way to get hold of the LoggingAdapter used by Akka streams?
>
> I'm making use of Viktor's Future retry
>
> https://gist.github.com/viktorklang/9414163
>
> and someone would like me to log something in the retry case. So I thought
> I would add an implicit LoggingAdapter parameter and supply it at the call
> site (which is a mapAsync call).
>
> 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.
>

-- 
>>  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] Question about akka-http ssl loose config

2016-07-13 Thread Akka Team
I think that should work (although, in general you should *always* prefer
real certificates or at least go with an internal ca and sign local certs
using that, accepting any will allow for man in the middle attacks,
spoofing server etc).

Did you try and have any problems with it?

--
Johan

On Wed, Jul 6, 2016 at 4:52 AM, zhonglin wu  wrote:

> Hi:
>I'm using singleRequest with custom HttpsContext
>Does the withAcceptAnyCertificate param of sslConfig.loose work for
> AKKA-http client??
>
> Thanks and regards,
> wuzhonglin
>
> --
> >> 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] Run a Flow with an ActorPublisher as a Source

2016-07-15 Thread Akka Team
Hi Oliver,

I find it a bit hard to follow your code snippets and what the types are
and where the error actually happens. I'd recommend you to add type
ascriptions until you see where the inferred type does not match what you
thought it would be.

So for example:
val runnableGraph: Flow[Something, SomethingElse, MatType] =
Flow.fromGraph(...

--
Johan

On Thu, Jul 14, 2016 at 6:11 PM, Olivier  wrote:

> When I upgrade my code from akka-stream-experimental 2.0.3 to akka-stream
> 2.4.4,
> I'm a little lost with the mean to run a Flow with an ActorPublisher as a
> source...
>
> Previously the following code was working :
> val (ref, scriptPlan) = runnableGraph.runWith(source,
> sinkScriptPlanExecution)
>
> With a declared source :
>   lazy val source: Source[Script, ActorRef] = {
> Source.actorPublisher[Script](Props[ScriptAdmissionFlowActor])
>   }
>
> Then I can do ref !  ...
>
> Now I have the following error in IDE :
> type mismatch; found :
>  
> akka.stream.scaladsl.Source[xxx.flows.scriptedflows.parts.StreamData.Script,akka.actor.ActorRef]
> required:
>
>  
> akka.stream.Graph[akka.stream.SourceShape[xxx.flows.scriptedflows.parts.StreamData.UnifiedScriptReceived],?]
>
> I don't understand why it requires a Graph now ... and how can I do to run
> the Flow with the ActorPublisher as a source parameter
> Any idea ?
>
> thanks !
> Olivier
>
> 
> My flow is defined as this :
>
>   lazy val runnableGraph = Flow.fromGraph(GraphDSL.create() {
> implicit builder =>
>   import GraphDSL.Implicits._
>
>
>   FlowShape(dispatchScriptSource.in, zippedExecutionReport.out)
> })
> 
>
>
> --
> >> 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] KillSwitch not having an effect

2016-07-15 Thread Akka Team
Hi Robin,

The problem is related to your custom stage, I'd guess the sleep in there,
you should never block inside of a stage as it will stop any processing in
the entire steam (which by default runs in the same actor).

This is based on your sample and works as expected:

ActorSystem system = ActorSystem.create();
Materializer mat = ActorMaterializer.create(system);

Source<Integer, NotUsed> source = Source.from(Arrays.asList(0, 1, 2,
3, 4, 5, 6, 7, 8, 9, 10));

final Pair<UniqueKillSwitch, CompletionStage> stream = source
  .throttle(1, FiniteDuration.create(1, TimeUnit.SECONDS), 1,
ThrottleMode.shaping())
  .viaMat(KillSwitches.single(), Keep.right())
  .toMat(Sink.foreach((n) -> System.out.println(n)), Keep.both())
  .run(mat);

final UniqueKillSwitch killSwitch = stream.first();
final CompletionStage completionStage = stream.second();

Thread.sleep(2000);
System.out.println("Calling shutdown");
killSwitch.shutdown();


completionStage.toCompletableFuture().get(10, TimeUnit.SECONDS);

system.terminate();




--
Johan

On Thu, Jul 14, 2016 at 2:25 PM, <robinm...@e2eservices.co.uk> wrote:

>  public class StubFlow extends GraphStage<FlowShape<I, I>> {
>
> public final Outlet out = Outlet.create("StubFlow.out");
>
> public final Inlet in = Inlet.create("StubFlow.in");
>
> private final FlowShape<I, I> shape = FlowShape.of(in, out);
>
> private final String name;
>
> public StubFlow(String name) {
> this.name = name;
> }
>
> @Override
> public FlowShape<I, I> shape() {
> return shape;
> }
>
> @Override
> public GraphStageLogic createLogic(Attributes arg0) {
> return new GraphStageLogic(shape) {
> {
> setHandler(in, new AbstractInHandler() {
>
> @Override
> public void onUpstreamFailure(Throwable ex) throws
> Exception {
> ex.printStackTrace();
> }
>
> @Override
> public void onUpstreamFinish() throws Exception {
> System.out.println(name + " - upstream
> finished");
> completeStage();
> }
>
> @Override
> public void onPush() throws Exception {
> I input = grab(in);
> System.out.println(input);
> push(out, input);
> Thread.sleep(1000);
>
> }
> });
> setHandler(out, new AbstractOutHandler() {
>
> @Override
> public void onPull() throws Exception {
> pull(in);
>
> }
> });
> }
> };
> }
>
> }





-- 
Akka Team
Lightbend <http://www.lightbend.com/> - Reactive apps on the JVM
Twitter: @akkateam

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


Re: [akka-user] akka cluster

2016-07-15 Thread Akka Team
Hi Maatary,

Take a look at the Cluster Metrics, sounds like that could a piece of the
puzzle at least: http://doc.akka.io/docs/akka/2.4/scala/cluster-metrics.html

--
Johan

On Fri, Jul 15, 2016 at 9:20 AM, Maatary Okouya 
wrote:

> Hi,
>
> I wonder what is the proper way using akka, to spur new actor on more
> machines for more processing capability when the load on a service is two
> high. In other words, I have a router and multiple workers on one machine,
> when i reach  certain point, i want to be able to create more worker on a
> second node then on a third node. Is there a way to do that with akka ? I
> understand that some part of it will be vendor specific, like AWS. However
> is there a way to customize your akka cluster for that, is a way to
> extend/customize your deployment so as to use AWS API to launch new machine
> on the fly and create new workers? What should i look into for that ?
>
> --
> >> 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] ShardCoordinator and persistence journal

2016-07-12 Thread Akka Team
Hi,

Cluster Sharding uses persistence to ensure that if the shard coordinator
crashes, the current sharding state can be replayed on a new shard
coordinator node (Described in this section of the docs:
http://doc.akka.io/docs/akka/2.4/scala/cluster-sharding.html#How_it_works)

You can configure sharding to use a separate journal by setting akka.cluster
.sharding.journal-plugin-id and akka.cluster.sharding.snapshot-plugin-id.

That configuration entry with a json serializer for PeristentRepr looks
strange, that is an internal plugin API, here's a section in the docs about
providing a human readable format for the journal (I'm guessing that is
what you are after):
http://doc.akka.io/docs/akka/2.4/scala/persistence-schema-evolution.html#Store_events_as_human-readable_data_model

-- 
Akka Team
Lightbend <http://www.lightbend.com/> - Reactive apps on the JVM
Twitter: @akkateam

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


Re: [akka-user] Akka create two Tcp Connections with the same port

2016-07-15 Thread Akka Team
No, that is not correct.

You can only listen to an IP address that is bound to an interface of your
own server. The addresses that you bind to your server interfaces can be
public ("out on the web") or private (not accessible from outside of your
local network or in the case of 127.0.0.1 not even from any other machine).

I'd recommend you to read up a bit on TCP/IP basics to get an understanding
on how it works. A google search should give you plenty of resources.

--
Johan

On Thu, Jul 14, 2016 at 8:04 PM, Chris Stewart <stewart.chris1...@gmail.com>
wrote:

> So you can't have unique ip addresses that are out on the web? Only ones
> that are local to my machine? That seems rather limiting.
>
> On Thursday, July 14, 2016 at 10:58:08 AM UTC-5, Akka Team wrote:
>>
>> Akka will work out of the box if the host names resolve to separate ip
>> addresses and those addresses belong to the system you run the akka
>> application on.
>>
>> --
>> Johan
>>
>> On Thu, Jul 14, 2016 at 3:08 PM, Chris Stewart <stewart@gmail.com>
>> wrote:
>>
>>> So just to make sure I understand you, I NEED to create this virtual
>>> interface if the hosts resolve to different ip addresses, or akka should
>>> work out of the box if the hosts resolve to different ip addresses.
>>>
>>> On Tuesday, July 12, 2016 at 8:32:08 AM UTC-5, Akka Team wrote:
>>>>
>>>> That will only be possible if the hosts resolve to different
>>>> IP-addresses on the machine they are run on. For example you could create a
>>>> virtual interface with a separate IP address for one of the hostnames.
>>>>
>>>> --
>>>> Johan
>>>>
>>>> On Mon, Jul 11, 2016 at 9:12 PM, Chris Stewart <stewart@gmail.com>
>>>> wrote:
>>>>
>>>>> Hi, as the title says i'm trying to create 2 tcp connections from the
>>>>> same port
>>>>>
>>>>> Here is the stackoverflow question:
>>>>> https://stackoverflow.com/questions/38314437/akka-create-two-tcp-connections-with-the-same-port
>>>>>
>>>>> I'm trying to create two tcp connections that are bound to the same
>>>>> port. I'm getting an error saying that the `java.net.BindException: 
>>>>> Address
>>>>> already in use`. This makes sense since they are both using `18333` as a
>>>>> port, but there must be some way to have two connections on a port that
>>>>> have unique hosts. I'm following along with the [guide in the akka tcp
>>>>> manual][1]. How can I make this work? The protocol says that connections
>>>>> need to be created on `18333`, however if I can only have one peer at a
>>>>> time it makes the p2p portion of the protocol useless.
>>>>>
>>>>> Here is the code:
>>>>>
>>>>> val probe1 = TestProbe()
>>>>> val probe2 = TestProbe()
>>>>> val client1 = system.actorOf(Client.props(TestNet3, probe1.ref))
>>>>> val client2 = system.actorOf(Client.props(TestNet3, probe2.ref))
>>>>>
>>>>> val local = new InetSocketAddress(18333)
>>>>>
>>>>> val remote1 = new InetSocketAddress("
>>>>> testnet-seed.bitcoin.petertodd.org", 18333)
>>>>>
>>>>> client1 ! Tcp.Connect(remote1,Some(local))
>>>>> probe1.expectMsgType[Tcp.Connected]
>>>>>
>>>>> val remote2 = new InetSocketAddress("testnet-seed.bluematt.me",
>>>>> 18333)
>>>>> client2 ! Tcp.Connect(remote2,Some(local))
>>>>> probe2.expectMsgType[Tcp.Connected]
>>>>>
>>>>>
>>>>> client1 ! Tcp.Abort
>>>>> client2 ! Tcp.Abort
>>>>>
>>>>>
>>>>>   [1]:
>>>>> http://doc.akka.io/docs/akka/2.3.15/scala/io-tcp.html#Connecting
>>>>>
>>>>> --
>>>>> >>>>>>>>>> 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&quo

Re: [akka-user] Bad example in documentation

2016-07-05 Thread Akka Team
Thanks for reporting, made the ticket:
https://github.com/akka/akka/issues/20885
Would be awesome if you could submit a pull request to fix this mistake,
thanks in advance!


On Tue, Jul 5, 2016 at 12:06 PM, Patrik Nordwall <patrik.nordw...@gmail.com>
wrote:

> Thanks for reporting. Could you please open a pull request with the fix?
> Regards,
> Patrik
>
> On Sat, Jul 2, 2016 at 12:31 AM, Sergey Sopin <sopin1...@gmail.com> wrote:
>
>> Hi,
>>
>> It seems that one of examples in the documentation contains bug, namely:
>> http://doc.akka.io/docs/akka/2.4.7/java/stream/stream-graphs.html
>>
>>
>>1. final Source<Integer, NotUsed> in = Source.from(Arrays.asList(1, 2,
>>3, 4, 5));
>>2. final Sink<List, CompletionStage<List>> sink = Sink
>>.head();
>>3. final Sink<List, CompletionStage<List>> sink2 =
>>Sink.head();
>>4. final Flow<Integer, Integer, NotUsed> f1 = Flow.of(Integer.class).
>>map(elem -> elem + 10);
>>5. final Flow<Integer, Integer, NotUsed> f2 = Flow.of(Integer.class).
>>map(elem -> elem + 20);
>>6. final Flow<Integer, String, NotUsed> f3 = Flow.of(Integer.class).
>>map(elem -> elem.toString());
>>7. final Flow<Integer, Integer, NotUsed> f4 = Flow.of(Integer.class).
>>map(elem -> elem + 30);
>>8.
>>9. final RunnableGraph<CompletionStage<List>> result =
>>10.  RunnableGraph.<CompletionStage<List>>fromGraph(
>>11.GraphDSL
>>12.  .create(
>>13.sink,
>>14.(builder, out) -> {
>>15.  final UniformFanOutShape<Integer, Integer> bcast =
>>builder.add(Broadcast.create(2));
>>16.  final UniformFanInShape<Integer, Integer> merge = builder
>>.add(Merge.create(2));
>>17.
>>18.   final Outlet source = builder.add(in).out();
>>19.  builder.from(source).via(builder.add(f1))
>>20..viaFanOut(bcast).via(builder.add(f2)).viaFanIn(merge)
>>21..via(builder.add(f3.grouped(1000))).to(out);
>>22.  builder.from(bcast).via(builder.add(f4)).toFanIn(merge);
>>23.  return ClosedShape.getInstance();
>>24.}));
>>
>>
>> Here we define 'sink2' variable, but never use it. We are using 'out'
>> variable instead, which is undefined.
>> Please fix this confusing thing when it will be possible.
>>
>> Thanks,
>> Sergey
>>
>> --
>> >>>>>>>>>> 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
> Akka Tech Lead
> Lightbend <http://www.lightbend.com/> -  Reactive apps on the JVM
> Twitter: @patriknw
>
> --
> >>>>>>>>>> Read the docs: http://akka.io/docs/
> >>>>>>>>>> Check the FAQ:
> http://doc.akka.io/docs/akka/current/additional/faq.html
> >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
> ---
> You received this message because you are subscribed to the Google Groups
> "Akka User List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to akka-user+unsubscr...@googlegroups.com.
> To post to this group, send email to akka-user@googlegroups.com.
> Visit this group at https://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>



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

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


Re: [akka-user] Re: How to perform dataset queries with cluster sharding in cqrs?

2016-07-11 Thread Akka Team
Take a look at this section of the docs and see if that helps:
http://doc.akka.io/docs/akka/2.4/scala/persistence-query.html#Performance_and_denormalization

--
Johan

On Tue, Jul 5, 2016 at 8:42 AM, Lap Ming Lee  wrote:

> Another solution I can think of is to forward the cassanda [user] events
> to a key-value db such as redis.  For example,  [email -> userId].   Anyone
> else come across this problem and how did they solve it?
>
>
> On Tuesday, July 5, 2016 at 2:35:36 PM UTC+8, Lap Ming Lee wrote:
>>
>> Hi,
>>
>> Suppose I have a stream of [user] events coming from cassandra and I
>> forward those events the correct [user] view actor using cluster sharding.
>> How would I perform a query for all the users in this case?  For example,
>> if I need to create a new [user], I first need to check if any of the
>> registered users already has registered with that email address.
>>
>> Because each [user] view actor is shared, the only way to query using
>> Akka would be to use the PubSub mediator, which does not scale linearly.  I
>> am thinking that Spark would be a good solution, but it seems like an
>> overkill in this case.  Would I be correct to use Spark for cross user
>> queries?
>>
>> - Lap
>>
> --
> >> 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] Re: akka-http web socket issue

2016-07-11 Thread Akka Team
I have created a ticket for updating the docs about the client example
mentioned:
https://github.com/akka/akka/issues/20938

As always, contributions are welcome!

--
Johan

On Thu, Jul 7, 2016 at 7:42 PM, Eric Swenson  wrote:

> Thanks, Giovanni. That was precisely the problem and while I didn't see
> the article you quoted, I "fixed" the problem on my end by having my client
> use a Source.fromFuture of a promise which I didn't complete.  I'll switch
> to using the approach in the article you referenced.  Still, I think there
> will be lots of people who may use the web socket client in the
> documentation as a starting point. They will expect that the client will
> continue to display messages received from the service while the client is
> running.  I think the example should either a) document that the client
> closes after processing a single message and how to make it maintain the
> web socket connection open, or better, in my opinion, b) use Source.maybe
> to ensure the connection doesn't close.
>
> On a related note, if the web socket server side is implemented using
> akka-http, the example still closes the connection after 1 minute due to
> the server side's not having gotten any TCP packets over the connection.
> The documentation should either a) include a description of how to change
> this timeout or b) have the client include heartbeat logic to keep the
> connection alive.
>
> -- Eric
>
> On Thursday, July 7, 2016 at 3:10:54 AM UTC-7, Giovanni Alberto
> Caporaletti wrote:
>>
>> Are you keeping the outbound client flow open?
>>
>>
>> http://doc.akka.io/docs/akka/2.4.7/scala/http/client-side/websocket-support.html#Half-Closed_WebSockets
>>
>>
>>> --
> >> 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] Patterns.Ask replacement

2016-07-11 Thread Akka Team
Hi Sergey,

What are you trying to achieve?
In general Streams are geared more for processing pipelines than "get one
element"-request-response type of interaction.

--
Johan

On Tue, Jul 5, 2016 at 9:22 PM, Sergey Sopin  wrote:

> Hi,
>
> Is there any possibility to replace akka.patterns.ask / pipe communication
> with akks-streams? I was looking for at least small example, but could not
> find it.
> I suppose that it can be done with BidiFlow, but I am not sure if I know
> how. I would be very grateful for such example.
>
> Thank you in advance!
>
> Regards,
> Sergey
>
> --
> >> 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] How to add connection.remoteAddress to Http request handler - additional input parameter to Flow

2016-08-08 Thread Akka Team
You could return your request handler from a method, and pass the remote IP
to that method when you create it (will require a new function each time
though).
You could also make your request handler take both a request and the remote
address every time it is called or you could update the request with the
remote address before you pass it to your handler.

--
Johan
Akka Team

On Mon, Aug 1, 2016 at 5:54 PM, Zlatko Roncevic <zlatko.ronce...@gmail.com>
wrote:

> Hi,
>
> I need origin IP address in my request handler, but I don't know how to
> add this parameter ...
>
> Code is here
>
>   Source<IncomingConnection, CompletionStage> serverSource
> =
> Http.get(system).bind(ConnectHttp.toHost(host, port), materializer);
>
> binding =  serverSource.to(Sink.foreach(connection -> {
>  logger.info("Accepted new connection from {} " +
> connection.remoteAddress());
>
>
>  connection.handleWith(Flow.create().mapAsync(1,
> requestHandler), materializer);
>
> }
>  )).run(materializer);
>
> binding.handle((ok, ex) -> {
>if (ok != null) {
> logger.info("Server listening on {}:{}",host, port);
>return ok;
>} else {
>logger.error("Problem during start: {}", ex);
>return -1;
>}
> });
>
>
> //Request handler
>
> final Function<HttpRequest, CompletionStage> requestHandler
> = new Function<HttpRequest, CompletionStage>(){
> @Override
> public CompletionStage apply(HttpRequest request) throws
> Exception {
> logger.trace("Request from : {} {} {}", request.method(),
> request.getUri(), request.getHeaders());
> //I would like to have  connection.remoteAddress() value here
> ...
>
>
> I'm missing something, what is right approach to put initial parameters to
> flow?
>
> Thanks !
>
> Regards
>
> Zlatko
>
>
>
>
>
> --
> >>>>>>>>>> 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] Re: No configuration setting found for key 'akka.version' when running jar-with-dependencies

2016-08-08 Thread Akka Team
Seems like that. PRs are welcome.

For other people interested there is a ticket here:
https://github.com/akka/akka/issues/21120

--
Johan
Akka Team

On Mon, Aug 8, 2016 at 4:58 PM, Dean Schulze <dean.w.schu...@gmail.com>
wrote:

> I did a copy and paste from the documentation page for the
> maven-shade-plugin.  Is the documentation page wrong?
>
> This is a show stopper for me with akka.
>
>
> On Monday, August 8, 2016 at 3:09:19 AM UTC-6, Akka Team wrote:
>>
>> No, there has not been any change to how Akka deals with the reference
>> configuration for a long long while so that would not help.
>>
>> I'd guess your configuration of the shade plugin is missing something.
>> 'akka.version' is defined in the file 'version.conf' which you should be
>> able to confirm is not in your shade output jar.
>>
>> --
>> Johan
>> Akka Team
>>
>> On Sat, Aug 6, 2016 at 9:36 PM, Dean Schulze <dean.w@gmail.com>
>> wrote:
>>
>>> I did exactlyl that, and also tried with a newer version of the plugin
>>> but I still get the exception.
>>>
>>> Do I have to roll back to an older version of akka in order to make this
>>> work?  The maven-shade-plugin isn't working with the current version of
>>> akka.
>>>
>>>
>>> On Thursday, August 4, 2016 at 6:03:29 AM UTC-6, Johan Andrén wrote:
>>>>
>>>> Hi Dean,
>>>>
>>>> You must make sure all the reference.conf files are concatenated into
>>>> one file if you want to put all the akka modules inside one jar like that.
>>>>
>>>> This is described in the docs you linked to: http://doc.akka.io/docs/ak
>>>> ka/current/general/configuration.html#When_using_JarJar__
>>>> OneJar__Assembly_or_any_jar-bundler
>>>>
>>>> --
>>>> Johan
>>>> Akka Team
>>>>
>>> --
>>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>>> >>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/c
>>> urrent/additional/faq.html
>>> >>>>>>>>>> Search the archives: https://groups.google.com/grou
>>> p/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.


Re: [akka-user] Re: No configuration setting found for key 'akka.version' when running jar-with-dependencies

2016-08-08 Thread Akka Team
No, there has not been any change to how Akka deals with the reference
configuration for a long long while so that would not help.

I'd guess your configuration of the shade plugin is missing something.
'akka.version' is defined in the file 'version.conf' which you should be
able to confirm is not in your shade output jar.

--
Johan
Akka Team

On Sat, Aug 6, 2016 at 9:36 PM, Dean Schulze <dean.w.schu...@gmail.com>
wrote:

> I did exactlyl that, and also tried with a newer version of the plugin but
> I still get the exception.
>
> Do I have to roll back to an older version of akka in order to make this
> work?  The maven-shade-plugin isn't working with the current version of
> akka.
>
>
> On Thursday, August 4, 2016 at 6:03:29 AM UTC-6, Johan Andrén wrote:
>>
>> Hi Dean,
>>
>> You must make sure all the reference.conf files are concatenated into one
>> file if you want to put all the akka modules inside one jar like that.
>>
>> This is described in the docs you linked to: http://doc.akka.io/docs/ak
>> ka/current/general/configuration.html#When_using_JarJar__
>> OneJar__Assembly_or_any_jar-bundler
>>
>> --
>> Johan
>> Akka Team
>>
> --
> >>>>>>>>>> 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] Questions on Activator Template: Akka Sample Twitter Streaming

2016-07-22 Thread Akka Team
Hi,

There are lot of questions there, but I try to answer a few.

(disclaimer, this is not our template so I have not checked the code in
detail)

> - I don't see any Actors, Flows, Materializers, Sources, Sinks being used
explicitly in this code; so OK to assume this gets handled by implicit vals
within Akka Http Stream?

It does not use streaming everywhere, but only on the entity bytes:
https://github.com/vrcod/akka-sample-twitter-streaming/blob/master/src/main/scala/TwitterStreamer.scala#L79

Materializers are used, see here (and note that it is implicit, so it is
not passed explicitly as a parameter):
https://github.com/vrcod/akka-sample-twitter-streaming/blob/master/src/main/scala/TwitterStreamer.scala#L32

> i.e. I don't see any loops; but clearly people tweet about London or
Clinton 24/7; and my debugger breakpoint jumps back to checking the
response code, then disappears!

This is multithreaded code where the chain is not necessarily executing on
the same thread. See my blog post here for details on this:
http://blog.akka.io/streams/2016/07/06/threading-and-concurrency-in-akka-streams-explained

Ordinary step debugging simply does not work for asynchronous systems as
control crosses thread boundaries which the debugger is not aware of.

> I do see how Tweets are parsed from JSON; but then how does the
underlying Akka implementation know the clean Byte boundary to pull data
into?

I don't understand this question. Can you elaborate?

> How would this client typically force a CLOSE for the socket connection?

You can use a KillSwitch:
http://doc.akka.io/docs/akka/2.4/scala/stream/stream-dynamic.html#Controlling_graph_completion_with_KillSwitch

> Or, is the assumption that implicit Actors run as daemons monitoring
stream Source input?

I am not sure what do you mean by Actors running as daemons. There are
actors yes, they run the stream. And there is a parent actor which is owned
by the Materializer. If that actor stops (due to system shutdown or its
parent stops) then all the stream code materialized by that materializer
also stop. You can also explicitly shutdown a Materializer. KillSwitch is
recommended though.

> Does Akka Http Stream open some kind of Async Http socket connection with
push notifications; and where can I read a clear and reliable explanation
of the essentials for how that works from the NIO layer, through to TCP,
through Reactive Stream, Akka Stream, then Akka Http layers?

I cannot answer this as this seems to be Twitter specific and I don't know
the details there. From the code it seems like that it just returns a long
HTTP response, i.e. the connection is kept open and new data arrives over
time. This is the code that gets the HTTP response body as a stream:
response.entity.dataBytes

> Is the exception handling in this example rigorous; i.e. my Debugger
stops hitting breakpoints, while the process is still running. Where else
needs a Try block?

I am not sure, it is not our code and I am too lazy to review it :)

> Why does the response.status != 200 return a Future; but the other block
of code, not have to create a Future to return? Certainly streamed data is
async; and needs some kind of Future created -- is this somehow embedded in
the Akka Http Stream API?

the request.flatMap { response => } block ensures that you already have the
response headers. It is async (flatMap on a Future), and the result of that
is two things:
 - response metadata/headers available immediately in "response"
 - response.entityBytes representing an async stream of potentially
arriving body bytes (well, in fact in some cases this might be available
already if the request is small enough so that we get the whole thing from
TCP in one go)

-Endre


On Sat, Jul 16, 2016 at 1:03 AM, Dagny T <daphnepk...@gmail.com> wrote:

> Hi there! Akka newbie. Trying to learn the latest Akka Http Streams API
> from this:
> http://www.lightbend.com/activator/template/akka-sample-twitter-streaming ;
> I'm running into bizarre behavior with that; and posted my list of
> questions and what I've tried in the Disqus comments just under that
> Template. Hoping someone with reliable current experience with the Akka
> Http Streams API could please help with suggestions for where to find
> answers to my questions, please. 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-u

Re: [akka-user] How would you "connect" many independent graphs maintaining backpressure between them?

2016-07-22 Thread Akka Team
> case _ => futureDeque.remove(future)
>>>>   }
>>>>   future
>>>> }
>>>>
>>>> offerFuture.flatMap {
>>>>   case QueueOfferResult.Enqueued =>
>>>> addToQueue(p.future)
>>>> }.recoverWith {
>>>>   case ex =>
>>>> val first = futureDeque.pollFirst()
>>>> if (first != null)
>>>>   addToQueue(first.flatMap(_ => sendRequest(value)))
>>>> else
>>>>   sendRequest(value)
>>>> }
>>>>   }
>>>>
>>>>   def main(args: Array[String]) {
>>>>
>>>> val allFutures = for (v <- 0 until 15)
>>>>   yield {
>>>> val res = sendRequest(s"Text $v")
>>>> res.onSuccess {
>>>>   case text =>
>>>> println("> " + text)
>>>> }
>>>> res
>>>>   }
>>>>
>>>> Future.sequence(allFutures).onComplete {
>>>>   case Success(text) =>
>>>> println(s">>> TOTAL: ${text.length} [in queue: 
>>>> ${futureDeque.size()}]")
>>>> system.terminate()
>>>>   case Failure(ex) =>
>>>> ex.printStackTrace()
>>>> system.terminate()
>>>> }
>>>>
>>>> Await.result(system.whenTerminated, Duration.Inf)
>>>>   }}
>>>>
>>>> Disadvantage of this solution is that I have locking on
>>>> ConcurrentLinkedDeque which is probably not that bad for rate of 1
>>>> request per second but still.
>>>>
>>>> How would you solve this task?
>>>>
>>>> --
>>>> >>>>>>>>>> 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.
>>>>
>>>
>>>
>>>
>>> --
>>> Cheers,
>>> √
>>>
>> --
>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>> >>>>>>>>>> Check the FAQ:
>> http://doc.akka.io/docs/akka/current/additional/faq.html
>> >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "Akka User List" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to akka-user+unsubscr...@googlegroups.com.
>> To post to this group, send email to akka-user@googlegroups.com.
>> Visit this group at https://groups.google.com/group/akka-user.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> Cheers,
> √
>
> --
> >>>>>>>>>> Read the docs: http://akka.io/docs/
> >>>>>>>>>> Check the FAQ:
> http://doc.akka.io/docs/akka/current/additional/faq.html
> >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
> ---
> You received this message because you are subscribed to the Google Groups
> "Akka User List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to akka-user+unsubscr...@googlegroups.com.
> To post to this group, send email to akka-user@googlegroups.com.
> Visit this group at https://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Akka Team
Lightbend <http://www.lightbend.com/> - Reactive apps on the JVM
Twitter: @akkateam

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


Re: [akka-user] Microservices Architecture with AKKA Cluster

2016-07-22 Thread Akka Team
Hi Maatary,

I think if you want to go with a pure Akka solution then akka-http is the
way to go. Otherwise, there is nothing really specific to Akka based
microservices, so all the generic advice for services apply here without
modification.

Probably akka-cluster and persistence needs a mention. Clusters should not
span across microservices if possible, instead they should be contacted via
controlled APIs (e.g. REST). The client should not be aware that there is a
cluster underneath the API. As for persistence, the usual rule applies
here, don't share databases between microservices, only expose data through
controlled APIs. Streaming HTTP is a great help here as you can stream out
large datasets relatively painlessly.

-Endre

On Fri, Jul 15, 2016 at 6:03 PM, Maatary Okouya <maatarioko...@gmail.com>
wrote:

> Hi,
>
> given that Longom is not working to Scala anytime soon. I wonder if
> someone could share with some good content on how build a good microservice
> architecture with AKKA including Recommendation, best practices, things to
> avoid and so on.
>
>
> Or if someone as experiences and want to share it here that would be
> grate.
>
>
> For instance what are the layer involves from database up to the REST
> Layer and so on.
>
>
> --
> >>>>>>>>>> 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 Team
Lightbend <http://www.lightbend.com/> - Reactive apps on the JVM
Twitter: @akkateam

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


Re: [akka-user] Re: SBT dependencies for Akka Sample Twitter Streaming Activator Template

2016-07-22 Thread Akka Team
.

>
> 4) When I went to this site to lookup published artifacts, I don't see any
> versioned for 2.12, only 2.11.  However, I may not be understanding the
> version naming conventions correctly:
> http://mvnrepository.com/search?q=akka-http-experimental
>

2.12 builds are experimental builds as Scala 2.12 is not yet stable. We
don't yet build for 2.12, it is on our radar though.


>
> Incidentally, where is the most reliable place to lookup published
> artifacts for Typesafe libraries; along with links to any release notes for
> major features/bugfixes included?
>

Maven Central contains our official artifacts, there is where we upload
Akka releases. For release notes, see the Akka site: http://akka.io/news/

-Endre


>  Sounds like the site I was looking at above is not a reliable source of
> information!
>
> Thanks again!
>
>
> On Sunday, July 17, 2016 at 3:58:53 AM UTC-7, Dagny T wrote:
>>
>>
>> SBT dependencies look like they need to be updated for this Activator
>> Template:
>> http://www.lightbend.com/activator/template/akka-sample-twitter-streaming
>>
>> 1) akka-http-experimental needs to be updated to later version containing
>> this bugfix:
>>
>> https://github.com/akka/akka/issues/20236
>>
>> 2) The other project libraries need to be available at global Maven repo
>> which are compiled with Scala v2.12.x to include this bugfix:
>>
>> https://github.com/akka/akka/issues/19418
>>
>>
>> - akka-stream-experimental
>>
>> - akka-http-experimental
>>
>> - koauth
>>
>> - json4s-native
>>
>>
>> However, it looks like library dependencies currently available on Global
>> Maven Repo are only for Scala v2.11.x:
>>
>> http://mvnrepository.com/search?q=akka-http-experimental
>>
>>
>> 3) I've posted my troubleshooting process to reach that theory in the
>> comments section here for more details:
>>
>> http://www.lightbend.com/activator/template/akka-sample-twitter-streaming
>>
>>
>> Hopefully someone maintaining this template can comment on how to cleanup
>> the build.sbt?
>>
> --
> >>>>>>>>>> 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 Team
Lightbend <http://www.lightbend.com/> - Reactive apps on the JVM
Twitter: @akkateam

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


Re: [akka-user] akka-cluster split brain when enable auto-down and set a node random package loss rate 50%

2016-07-22 Thread Akka Team
Hi Yutao,

Please refer to the documentation page Patrik has linked. It explains the
problem in detail and various approaches to handle it. SBR is available for
Lightbend customers and provides ready-made solutions (the linked pages),
but if you want to go with the open source version, you can implement
similar strategies yourself.

-Endre

On Fri, Jul 22, 2016 at 11:18 AM, Yutao Shuai <szqs...@gmail.com> wrote:

> The result we expected is divide into two cluster, one of the cluster has
> three or four nodes and work normally.
>
> 在 2016年7月22日星期五 UTC+8下午3:41:32,√写道:
>>
>> What behavior are you looking to achieve?
>>
>> --
>> Cheers,
>> √
>>
>> On Jul 22, 2016 5:11 AM, "Yutao Shuai" <szq...@gmail.com> wrote:
>>
>>>   In a 5-node cluster, hypothesis the nodes is A,B,C,D,E. All nodes
>>> monitor each other, enable auto-down,  and we  set the node-A random
>>> package loss rate 50%,  after a period of time, the cluster
>>>   will divide into two or more clusters. How can I fix this problem?
>>>
>>> --
>>> >>>>>>>>>> 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 Team
Lightbend <http://www.lightbend.com/> - Reactive apps on the JVM
Twitter: @akkateam

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


Re: [akka-user] distributed in-memory lru cache using akka cluster

2016-07-22 Thread Akka Team
Hi Ben,

I think you can use JMX for this. If you need more detailed information you
might want to look into SIGAR: https://github.com/hyperic/sigar

-Endre

On Tue, Jul 19, 2016 at 12:11 AM, Ben Fonarov <ben.fona...@gmail.com> wrote:

> Hi all, a question... I'm trying to implement a distributed in-memory lru
> cache using consistent hashing router and actor level lru logic. I want to
> dynamically scale out to new members in the cluster (adding a server) when
> i reach 80% of the memory capacity on a given server... is there a way to
> monitor memory from inside an actor? Thank you
>
> --
> >>>>>>>>>> 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 Team
Lightbend <http://www.lightbend.com/> - Reactive apps on the JVM
Twitter: @akkateam

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


Re: [akka-user] What is ProtocolStateActor.invoke and why is it so time consuming?

2016-07-22 Thread Akka Team
Hi,

This skirts support, but the answer is that it is an actor used by
remoting. It does not have an "invoke" method though, so I am not sure what
NewRelic reports here.

We have been doing load tests on our development environment to isolate out
> slow operations in our system. One of the endpoints that NewRelic reported
> taking lots of time is ProtocolStateActor.invoke. The output is provided in
> the attached, redacted for NDA reasons, screenshot. Can anyone tell me what
> this is and why it appears to be consuming so much time?
>

I think it is weird that it shows up that much since it does very little
once remoting finished its handshake. I never seen this actor show up. I
would suspect that NewRelic misreports something here (especially since
there is no invoke method)?

-Endre



> I am wondering if I am doing something wrong or if I just have everything
> so heavily optimized that this thing is showing up.
>
>
> <https://lh3.googleusercontent.com/-A2jqquG_UUU/V5D1qjBJTUI/AEw/-gg9v2k-_hUADu0XLgCtzIP_jiDkdWO3gCLcB/s1600/ProtocolStateActor.png>
>
> --
> >>>>>>>>>> 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 Team
Lightbend <http://www.lightbend.com/> - Reactive apps on the JVM
Twitter: @akkateam

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


Re: [akka-user] Configurable parallelism/elastic groupBy

2016-07-22 Thread Akka Team
On Fri, Jul 22, 2016 at 2:14 AM, Richard Rodseth <rrods...@gmail.com> wrote:

> Or perhaps you are talking about something like
>
>
> http://doc.akka.io/docs/akka/2.4.8/scala/stream/stream-cookbook.html#Balancing_jobs_to_a_fixed_pool_of_workers
>

Yes


>
> but using the Partition stage instead of Balance
>

>
> http://doc.akka.io/api/akka/2.4.7/?_ga=1.10841340.933910455.1454640777#akka.stream.scaladsl.Partition
>

Exactly!


>
> which does not appear to be documented here
>
>
> http://doc.akka.io/docs/akka/2.4.8/scala/stream/stages-overview.html#Fan-out_stages
>


Meh, that is true. Please file a ticket (or even better, send a PR towards
us :) ).

-Endre


>
>
> On Thu, Jul 21, 2016 at 10:00 AM, Richard Rodseth <rrods...@gmail.com>
> wrote:
>
>> Thanks. That gives me some terms to Google, but any further pointers
>> welcome. I see references to FlexiRoute being replaced by GraphStage.
>> Presumably that's what I need to study next?
>>
>> On Thu, Jul 21, 2016 at 12:59 AM, Viktor Klang <viktor.kl...@gmail.com>
>> wrote:
>>
>>> A routing stage with consistent hashing and then a N-Way merge to insert
>>> into db?
>>>
>>> --
>>> Cheers,
>>> √
>>>
>>> On Jul 20, 2016 9:09 PM, "Richard Rodseth" <rrods...@gmail.com> wrote:
>>>
>>>> I'm sure I've asked this before in numerous ways, but it's still an
>>>> issue for me.
>>>>
>>>> I have an ETL stream that reads per-channel data and writes it to a
>>>> destination without backpressure. Within a channel, order of writes must be
>>>> preserved. So I want parallelism between channels, but not within.
>>>>
>>>> If I groupBy by channel, I can't control the degree of parallelism  and
>>>> the destination is overwhelmed.
>>>> Should I make an ActorSubscriber for the write, that backpressures
>>>> (based on an integer value) and use alsoTo on the SubFlow?
>>>>
>>>> Any way to achieve this with standard components?
>>>>
>>>> --
>>>> >>>>>>>>>> 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 Team
Lightbend <http://www.lightbend.com/> - Reactive apps on the JVM
Twitter: @akkateam

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


Re: [akka-user] SBT Dependencies need to be updated for Akka Sample Twitter Streaming template on Activator

2016-07-22 Thread Akka Team
Hi Dagny,

On Mon, Jul 18, 2016 at 11:16 PM, Dagny T <daphnepk...@gmail.com> wrote:

>
> 1) On first running this code through an Intellij debugger; I ran into the
> following Akka Http bug, which indicated a version upgrade was required:
> https://github.com/akka/akka/issues/20236
>
> 2) After choosing the latest Akka library versions available for Scala
> 2.11.7; I ran into the following Scalac bug, which indicated a version
> upgrade was required for Scala itself:
> https://github.com/akka/akka/issues/19418
>
>
> =
>
> I then got help from Akka User @ktoso to connect me with the Activator
> Template contributor through GitHub, or @vrcod here:
> https://github.com/vrcod/akka-sample-twitter-streaming/issues
>
> Both of them recommended not using a Milestone build for Scala; and to
> instead lookup the library version numbers correlated with the latest
> comprehensive release of Scala on this site here:
>
> http://search.maven.org/#search%7Cga%7C1%7Cakka-http-experimental
>
>
> And, @vrcod noted I should be specifying the update library versions
> correctly; but my latest attempt at that is still  doesn't work because:
>
>
> *** Unresolved Dependencies on:
>
> org.json4s#json4s-native_2.11;2.4.8: not found
>
> Don't know WTF IDEA15 is looking for v2.4.8 of anything(!)
>
>
> Since I did:
>
>
> -  Quit IDEA15; then in my project directory:
>
> rm -rf .idea/libraries
>
> - Build/Rebuild project in IDEA15.0.3 IDE with the following in build.sbt:
>
> scalaVersion := "2.11.8"
>
> libraryDependencies ++= Seq(
> "com.typesafe.akka" %% "akka-stream-experimental" % "2.0.4",
> "com.typesafe.akka" %% "akka-http-experimental" % "2.0.4",
> "com.hunorkovacs" %% "koauth" % "1.1.0",
> "org.json4s" %% "json4s-native" % "3.4.0"
> )
>
Above is wrong, please use 2.4.8 for every Akka artifact. Also streams are
no longer experimental.

Just look at the list here: http://akka.io/docs/

-Endre



> In my sbt.last.log in ~/Library/Logs/IntellijIdea15; I see:
> *** Unresolved Dependencies
> org.json4s#json4s-native_2.11;2.4.8: not found
>
> Minor improvement is that all other dependencies were resolved.
>
>
>
> --
> >>>>>>>>>> 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 Team
Lightbend <http://www.lightbend.com/> - Reactive apps on the JVM
Twitter: @akkateam

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


Re: [akka-user] Is Akka the right choice for my simple distributed system?

2016-07-22 Thread Akka Team
Hi Richard,

On Wed, Jul 20, 2016 at 10:52 AM, Richard Whitehead <
rich...@rstj-systems.co.uk> wrote:

> I wonder if the community can help me get started.
>
> I’m trying to design the architecture of a project and I think that using
> Akka may make sense, but I am completely new to distributed systems and to
> Akka (I am a very experienced developer, but my expertise is image
> processing on Windows!).
>
> The task is very simple: call 3 or 4 executables in sequence to process
> some image data.  The data is just a simple image and the processing takes
> tens of minutes.  Each processing step takes an image file in and produces
> an image file out.
>
> We are considering a distributed architecture to increase throughput
> (latency does not matter).  So we need a way to queue work on remote
> computers, potentially running more than one pipeline at once, and a way to
> move the data around.  The architecture will have to work on a single
> server, or on a couple of servers in a rack, or in the cloud; 2 or 3
> computers maximum.
>
> Being new to all this I would prefer something simple rather than
> something super-powerful.  Certainly I don't want something that will take
> over the project, I want something that does what we tell it rather than
> the other way round.
>
> If I'm understanding it, Akka should help with launching the processing
> steps and with getting the data to and from the remote machines /
> containers, is that right?  Would it also help with keeping track of the
> processing pipelines?
>

Yes, it can be used in that fashion. I am not sure though that in your case
Akka is the best choice. There are two reasons for this:
 - your problem needs a simple worker pool. This in itself is a good fit
for Akka, but
 - your actual task is executed outside the JVM

Maybe for this problem a simple message queue and workers polling for the
queue is more than enough.

Akka helps when you suddenly need more coordination than this because then
it provides a good amount of tools to customize how things happen.

You can look at the distributed-workers Activator template here to get a
feel of it:
https://github.com/typesafehub/activator-akka-distributed-workers#master

-Endre


>
> Huge thanks in advance.
>
> Richard
>
> --
> >>>>>>>>>> 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 Team
Lightbend <http://www.lightbend.com/> - Reactive apps on the JVM
Twitter: @akkateam

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


Re: [akka-user] Weakly up feature not working

2016-08-09 Thread Akka Team
Hi Tom,

There might be something not working around new incarnations of the same
node (same host and port) rejoining and weakly up, not quite sure if it is
supposed to work. I can confirm that downing two nodes of a three node
cluster, and have a new incarnation of one of them rejoining the cluster
does not seem to work. I'll look into this and see if it might be a bug.

However, here is a sample that shows weakly up working as expected, downing
a node so it becomes unreachable, and then joining a new node:
https://gist.github.com/johanandren/04c4720c917bad167169f73abe68da03
-- 
Johan
Akka Team

-- 
>>>>>>>>>>  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] Logging outside Actors, namely within your scalaTest

2016-08-09 Thread Akka Team
Did you look at the scaladoc of LogSource like the exception told you to?

It contains an explanation of to provide a log source for any kind of type.

system.log will work fine as well though, as long as you don't want a
specific log source in your log entries logged from the test.
--
Johan
Akka Team

On Mon, Aug 8, 2016 at 12:00 AM, Maatary Okouya <maatarioko...@gmail.com>
wrote:

> Hi,
>
>
> I have been trying to Log things within my scalaTest as such:
>
> class ChangeSetActorTest extends 
> PersistenceSpec(ActorSystem("Persistent-test-System")) with 
> PersistenceCleanup {
>
>
>   val log = Logging(system, this)
>
>
>
> Basically let's just say that ChansetActorTest inherit from TestKit(system)
>
>
> Unfortunately Logging(system, this) does not work with the* this*
>
> I get the following error:
>
> [error] /Users/maatary/Dev/IdeaProjects/PoolpartyConnector/src/test/
> scala/org/iadb/poolpartyconnector/changepropagation/ChangeSetActorTest.scala:22:
> Cannot find LogSource for org.iadb.poolpartyconnector.ch
> angepropagation.ChangeSetActorTest please see ScalaDoc for LogSource for
> how to obtain or construct one.
> [error]   val log = Logging(system, this)
>
>
> I beleive in the Akka Logging Doc this is the following point:
>
>- and in all other cases a compile error occurs unless and implicit
>LogSource[T] is in scope for the type in question.
>
>
> In other words there is no LogSource[TestKit]
>
>
>
> I would like the simplest solution to deal with that issue, with minimal
> additional configuration. So far what i did is the following and everything
> works as expected:
>
> class ChangeSetActorTest extends 
> PersistenceSpec(ActorSystem("Persistent-test-System")) with 
> PersistenceCleanup {
>
>
>   val log = system.log
>
>
>
> From there I just go and do things like
>
> val received = chgtFetcher.receiveWhile((requestInterval + 
> ProcessingLag).*(3)) {
>   case msg:FetchNewChangeSet => log.info(s"received: ${msg}" ) ; 
> chgtFetcher.reply(NoAvailableChangeSet); msg
> }
>
>
>
> My question, is this recommended appraoch. So far the order of the message
> coming from my actor and the one from the test are well ordered.
>
>
> Please cloud you let me know the recommended appraoch to log in a unified
> appraoch:
>
> 1 - From the Test class (e.g. above) and the Actor at the same time ?
>
> 2 - If one uses a system where external class needs to log as well and we
> need one unified logging (asynchronous) going on.
>
>
> Many thanks
>
> -M-
>
>
>
>
> --
> >>>>>>>>>> Read the docs: http://akka.io/docs/
> >>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/c
> urrent/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] Database query does not cancel when streaming rows using a DatabasePublisher

2017-02-01 Thread Akka Team
>From the slick docs:

Execution of the DBIOAction does not start until a Subscriber is attached
to the stream. Only a singleSubscriber is supported, and any further
attempts to subscribe again will fail ...


I'm guessing what you actually want is not to create your publisher once
upon application start and subscribe to that multiple time like you do now
but rather once for every request that comes in to webservice/csv (so
inside the block of the get directive.

-- 
Johan
Akka Team

On Wed, Feb 1, 2017 at 3:27 PM, Mark Goldenstein <bigande...@gmail.com>
wrote:

> Hi guys!
>
> (Cross-posting this since I did not get a response in the Slick group.)
>
> I use akka-http together with Slick to stream rows from a mysql database
> as csv via http.
>
> Streaming works as expected unless I disconnect the http connection
> prematurely. In this case I would expect that the sql query should stop
> executing since there is no downstream demand anymore. However, I can see
> in the mysql processes that the query is still running and it only stops
> when I shut down the webserver (or when the query finishes fetching all the
> rows).
>
> If I turn on debug logs I see repeatedly, while streaming:
>
> 22:05:17.738 [db-8] DEBUG slick.basic.BasicBackend.stream - Suspending
> streaming action with continuation (more data available)
> 22:05:17.743 [default-akka.actor.default-dispatcher-8] DEBUG
> slick.basic.BasicBackend.stream - Scheduling stream continuation after
> transition from demand = 0
> 22:05:17.743 [db-9] DEBUG slick.basic.BasicBackend.stream - Restarting
>  streaming action, realDemand = 8
>
> Then, once I disconnect the connection, and there is no downstream demand
> anymore, I see:
>
> 22:05:17.744 [db-9] DEBUG slick.basic.BasicBackend.stream - Suspending
> streaming action with continuation (more data available)
> 22:05:17.749 [default-akka.actor.default-dispatcher-7] DEBUG
> akka.io.TcpIncomingConnection - Closing connection due to IO error
> java.io.IOException: Broken pipe
> 22:05:17.774 [default-akka.actor.default-dispatcher-16] DEBUG
> slick.basic.BasicBackend.stream - Scheduling stream continuation after
> transition from demand = 0
> 22:05:17.774 [db-10] DEBUG slick.basic.BasicBackend.stream - Restarting
>  streaming action, realDemand = oo
>
> What is going on here? Why is realDemand oo?
>
> My code looks something like this:
>
> object Main extends App {
>   implicit val system = ActorSystem()
>   implicit val executor = system.dispatcher
>   implicit val materializer = ActorMaterializer()
>
>   implicit val csvMarshaller =
> Marshaller.withFixedContentType[CSVLine,
> ByteString](ContentTypes.`text/csv(UTF-8)`) {
>   case CSVLine(line) => ByteString(line)
> }
>
>   implicit val csvStreamingSupport = EntityStreamingSupport.csv()
> .withParallelMarshalling(parallelism = 8, unordered = false)
>
>   val query = ??? // a Slick query
>
>   val publisher: DatabasePublisher[Tick] = DB.get.stream(
> query.result.withStatementParameters(statementInit = DB.enableStream))
>
>   val routes = {
> logRequestResult("webservice") {
>   encodeResponse {
> pathPrefix("csv") {
>   pathSingleSlash {
> get {
>   complete {
> Source.fromPublisher(publisher).map(t =>
> CSVLine(t.toCSV()))
>   }
> }
>   }
> }
>   }
> }
>   }
>
>   Http().bindAndHandle(routes, "127.0.0.1", 9000)
> }
>
> object DB {
>   private val db = Database.forConfig("db")
>
>   def get = db
>
>   def enableStream(statement: java.sql.Statement): Unit = {
> statement match {
>   case s if s.isWrapperFor(classOf[com.mysql.jdbc.StatementImpl]) =>
> s.unwrap(classOf[com.mysql.jdbc.StatementImpl]).enableStream
> ingResults()
>   case _ => // do nothing
> }
>   }
> }
>
> Any thoughts on this?
>
> Mark
>
> --
> >>>>>>>>>> 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://g

Re: [akka-user] Balancing TCP requests

2017-02-01 Thread Akka Team
It looks correct to me, what is it that makes you think it is not the
server closing the connection as the exception says?


-- 
Johan
Akka Team

On Thu, Jan 26, 2017 at 3:20 PM, Maksym Besida <maks.bes...@gmail.com>
wrote:

> Based on this paragraph
> <http://doc.akka.io/docs/akka/2.4.16/scala/stream/stream-cookbook.html#Balancing_jobs_to_a_fixed_pool_of_workers>
>  I've
> implemented a balancer for tcp outgoing requests.
>
> def outGoing(host: String, port: Int) = 
> Tcp().outgoingConnection(InetSocketAddress.createUnresolved(host, port), 
> halfClose = true)
>
>
> def balancer(endpoints: Seq[(String, Int)]): Flow[ByteString, ByteString, 
> NotUsed] = {
>   Flow.fromGraph(GraphDSL.create(){ implicit b =>
> import GraphDSL.Implicits._
> val balancer = b.add(Balance[ByteString](endpoints.length, 
> waitForAllDownstreams = true))
> val merge = b.add(Merge[ByteString](endpoints.length))
>
> endpoints.foreach { case(host, port) =>
>   balancer ~> outGoing(host, port).async ~> merge
> }
>
> FlowShape(balancer.in, merge.out)
>   })
> }
>
>
> I use it as follows
>
> source.via(balancer(Seq(("localhost", 22002), ("localhost", 
> 22002.runWith(Sink.ignore)
>
>
> I'm not interseted in result so I run it with Sink.ignore. I open 2 tcp
> connections to the same destination host for the test purpose(in reality it
> will go to different hosts)
>
> When I produce a lot of elments in my source I eventually(not after first
> message) get next error and stream fails
> akka.stream.StreamTcpException: The connection closed with error: An
> existing connection was forcibly closed by the remote host
>
> Can anybody suggest what is wrong with the example?
>
> --
> >>>>>>>>>> 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] Chunked Response handling with Akka Http?

2017-02-01 Thread Akka Team
This is definitely possible, just use Chunk for each element instead, that
way you can create them from a stream of strings using .map()

For the "an async request and it responds one or more times" there are a
few possible tools in Akka streams that may solve this. Take a look at
Source.unfoldAsync, Source.unfoldResourceAsync and Source.queue and see if
either of those fit your use case.

-- 
Johan
Akka Team

On Mon, Jan 16, 2017 at 8:03 AM, <subo...@gmail.com> wrote:

> I'd like to be able to use akka-http with chunked responses. I'd like to know 
> if I can do the same thing in akka-http as with the playframework. The 
> following is from playframework documentation.
>
> def index = Action {
>   val source = Source.apply(List("kiki", "foo", "bar"))
>   Ok.chunked(source)
> }
>
> We can inspect the HTTP response sent by the server:
>
> HTTP/1.1 200 OK
> Content-Type: text/plain; charset=utf-8
> Transfer-Encoding: chunked
>
> 4
> kiki
> 3
> foo
> 3
> bar
> 0
>
> With akka-http I was able to get close with
>
>  val hi = Chunk("Hi" + "\n")
>
>  val there = Chunk("there" + "\n")
>
>  val last = LastChunk("boom" + "\n")
>
>  val source: Source[ChunkStreamPart, NotUsed] = 
> Source(scala.collection.immutable.Iterable(hi, there, last))
>
>  val rootPath: Route =
>
>path("") {
>
>  get {
>
>for (i <- 1 to 100) {
>
>  ref ! hi
>
>}
>
>complete(Chunked(ContentTypes.`text/plain(UTF-8)`, source))
>
>  }
>
>}
>
>  def routes: Route = rootPath
>
> }
>
> curl returns
>
> < HTTP/1.1 200 OK
>
> < Server: akka
>
> < Date: Mon, 16 Jan 2017 14:03:10 GMT
>
> < Transfer-Encoding: chunked
>
> < Content-Type: text/plain; charset=UTF-8
>
> <
>
> Hi
>
> there
>
>
>
> Two perhaps minor issues: it does not report the last element, and it doesn't 
> include the chunk size as the playframework example did.
>
> What I’d like to know is how can I do this in a dynamic way? I'm interacting 
> with a embedded device (via serial) where I make an async request and it 
> responds one or more times up to about 20 seconds. I'd like each response to 
> be emitted as a chunk. Is this possible?
>
> Thanks,
> Andrew
>
> --
> >>>>>>>>>> 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] Class cast exceptions in actors that return Future[Unit]

2017-01-31 Thread Akka Team
You have a Future[Something], and a Something is an Any (everything is) but
it is not Unit (only Unit is), so you can not just cast it, you must
replace it with an actual Unit, which is what .map(_ => ()) does.

-- 
Johan
Akka Team

On Tue, Jan 31, 2017 at 11:35 AM, Alan Burlison <alan.burli...@gmail.com>
wrote:

> I'm writing an Akka persistence journal that saves data in JSON format.
> I've done that as normal, by subclassing AsyncWriteJournal and implementing
> the necessary methods.
>
> The actual file IO is done by sub-Actors, one per output file where each
> persistent actor has its own JSON file. The read/write methods on the IO
> Actor which return a value via 'ask' return a Future[Any] as per normal.
> However the asyncXXX methods in AsyncWriteJournal return Future[Unit], so
> the Future[Any] returned from the IO Actor needs to be converted to a
> Future[Unit].
>
> I've tried a couple of ways of doing that:
>
> 1) Casting the return value with ".asInstanceOf[Future[Unit]]". This
> generates a ClassCast exception:
>
> 2) Applying ".mapTo[Unit]" to the return value. This generates a ClassCast
> exception:
>
> 3) Applying ".map(_ => ())" to the return value. This works, but sort of
> smells a bit.
>
> Is there a cleaner way of doing this?
>
> --
> Alan Burlison
> --
>
> --
>
>>  Read the docs: http://akka.io/docs/
>>>>>>>>>>>  Check the FAQ: http://doc.akka.io/docs/akka/c
>>>>>>>>>>> urrent/additional/faq.html
>>>>>>>>>>>  Search the archives: https://groups.google.com/grou
>>>>>>>>>>> p/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] Class cast exceptions in actors that return Future[Unit]

2017-01-31 Thread Akka Team
If it in fact was a Unit you got back from the actor then neither of the
things you tried should throw a class cast exception though. If the actor
for example sends a Future[Unit] back, then you will have a
Future[Future[Unit]] returned from ask.

-- 
Johan
Akka Team

On Tue, Jan 31, 2017 at 2:41 PM, Alan Burlison <alan.burli...@gmail.com>
wrote:

> On 31/01/2017 21:36, Viktor Klang wrote:
>
> What'd be the alternative?
>>
>
> Not sure really, don't know if there's any way of preserving a
> Future[Unit] rather than converting it to a Future[Any]. As I said, it just
> seemed a bit clunky, and not obvious immediately obvious as to how to solve
> the issue. Perhaps just a note in the docs about how to handle Future[Unit]?
>
>
> --
> Alan Burlison
> --
>
> --
>
>>  Read the docs: http://akka.io/docs/
>>>>>>>>>>>  Check the FAQ: http://doc.akka.io/docs/akka/c
>>>>>>>>>>> urrent/additional/faq.html
>>>>>>>>>>>  Search the archives: https://groups.google.com/grou
>>>>>>>>>>> p/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 Team
Lightbend <http://www.lightbend.com/> - Reactive apps on the JVM
Twitter: @akkateam

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


Re: [akka-user] streams: why pulls the concat combinator both sides eagerly and the merge combinator not

2017-01-30 Thread Akka Team
I agree that it would be good if it was documented, please open a ticket
(and even better a ticket AND a PR adding docs)


-- 
Johan
Akka Team

On Thu, Jan 19, 2017 at 3:01 AM, EXTERNAL Wachter Stefan (Keybird IT
Consulting und Vetriebs GmbH, INST-ICM/BSV-BS) <
external.stefan.wach...@bosch-si.com> wrote:

> Hi,
>
>
>
> I stumbled accross the surprising behaviour that the concat combinator
> uses so called „detached“ inputs that pull eagerly (without signalled
> demand; effectively being a buffer of size 1). The comment indicates that
> this is a means to avoid deadlocks in graphs with cycles. Yet, when
> implementing graphs with cycles I usually use the merge combinator that
> does not exhibit that behaviour.
>
>
>
> Additional proposal: Maybe the „eager pulling“ behaviour should be
> documented in the API because it may be a surprising behaviour. (E.g.
> expensive operations might happend without need)
>
>
>
> Mit freundlichen Grüßen / Best regards
>
>
>
> *Dr. Stefan Wachter*
>
>
>
> Bosch Software Innovations GmbH
>
> Communications (INST-ICM/BSV-BS)
>
> Stuttgarterstr. 130
>
> 71332 Waiblingen
>
> GERMANY
>
> www.bosch-si.de
>
> www.blog.bosch-si.com
>
>
>
> Tel. +49 711 811 58 477
>
> Fax +49 711 811 58 100
>
> external.stefan.wach...@bosch-si.com <daniel.mau...@bosch-si.com>
>
>
>
> --
> >>>>>>>>>> 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 and custom code deployment (transfer the classes to the nodes to start new actors at runtime)

2017-01-30 Thread Akka Team
Hi,

Nothing like that in Akka. Remote class loading has been done in the JVM
before, but since it can easily allow a remote attacker full freedom to run
any code they want on a server node it's not very common any more.

-- 
Johan
Akka Team

On Fri, Jan 27, 2017 at 9:17 PM, Eugene Dzhurinsky <jdeve...@gmail.com>
wrote:

> Hi!
>
> Is there any way to deploy the code (jar files) along with starting the
> new actors in the Akka cluster without the cluster restart? For example - I
> have some "base" actors tier that provides the core logic for the data
> flow.
>
> Now I want to create a solution, that will use these actors (using some
> service discovery API) to perform certain tasks, and I will need to deploy
> the new code to the nodes with certain roles, so it will be initialized -
> and appropriate actors started and joined the cluster.
>
> I guess I can achieve something like that using some helper makeshift
> shell-scripts that will download some JARs and spawn an additional JVMs,
> however may be there's something I could borrow from Akka?
>
> 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.
>

-- 
>>>>>>>>>>  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] Declare Mailboxes Programmatically

2017-01-30 Thread Akka Team
The only way currently would be to programatically generate the config
entries for the mailboxes before starting the actor system.

-- 
Johan
Akka Team

On Sat, Jan 28, 2017 at 4:33 AM, Edoardo Vacchi <evac...@live.com> wrote:

> I know that a mailbox can be selected through 
> Props.withDispatch("mailbox-id").
> Unfortunately this means "mailbox-id" needs to be a known mailbox config in
> the application.conf. Is there a way (I can't think of any right now) to
> describe the mailbox programmatically ?
>
> My idea would be to configure a mailbox via code (a DSL) instead of a
> config file. The reason I ask is that the system I'm working on configures
> most of the actor routing behavior in code, and I would like to provide a
> way to describe actor message dispatching (if needed) in a similar way.
>
>
> --
> >>>>>>>>>> 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] What means of akka cluster roles leader?

2016-08-19 Thread Akka Team
HI Yutao,

On Mon, Aug 15, 2016 at 2:26 PM, Yutao Shuai <szqs...@gmail.com> wrote:

>
> <https://lh3.googleusercontent.com/-3MgMU_DY9KM/V7G02f_dlUI/AME/yM4Pje9ZAMAUpV7A0vy091WUjUS1AKOYQCLcB/s1600/TT%25E6%2588%25AA%25E5%259B%25BE%25E6%259C%25AA%25E5%2591%25BD%25E5%2590%258D22.jpg>
> Thanks for your help Konrad. So the return value of this function is the
> leader of the cluster? But I read the DiffRolesLeader function in the
> ClusterEvent.scala where call the roleLeader function. This function
> traverse all roles and call the roleLeader function, What this mean? All
> nodes with specfic roles have its own leader? What difference between this
> leader and cluster leader ?
>

The cluster leader does certain responsibilities in the cluster,
internally. If you want to also hook into this leader election, then you
can since we expose via the API the leader. In certain cases it might be
useful to be able to select a leader among a subset of cluster members
though, in that case you can use the role leader functionality. By default
the cluster does nothing with this, it is only an exposed API if someone
needs this for building new functionality on top of this leader election
protocol.

It is *NOT *recommended to use these features directly, as in 99.9% of the
cases you really want the cluster Singleton pattern instead:
http://doc.akka.io/docs/akka/2.4/scala/cluster-singleton.html
For example, the leader election protocol selects a new leader whenever a
new node *added not just when the leader is removed.* This is not an issue
for Akka itself, as the role of the leader is stateless, and this
transition is cheap. On the other hand, with most user Singletons you want
to usually have state and therefore prefer a more stable location. The
Singleton pattern solve this for you.

In general, I would avoid touching the internal leader election altogether
and use Singletons instead.

-Endre


>
>
> 在 2016年8月15日星期一 UTC+8下午5:27:22,Konrad Malawski写道:
>>
>> Hi Yutao,
>> look at the return type – Option, so it's a single element.
>> It returns the leader of a given role (role == multiple nodes, 1 of them
>> is the leader).
>> I.e. it would host the the Singleton if it were constrained to this role.
>>
>> --
>> Konrad `ktoso` Malawski
>> Akka <http://akka.io> @ Lightbend <http://lightbend.com>
>>
>> On 15 August 2016 at 04:23:26, Yutao Shuai (szq...@gmail.com) wrote:
>>
>>
>> <https://lh3.googleusercontent.com/-tZtLqoK9VUY/V7EnCA2ZVKI/AL0/Gm66R8FjZqIZOmBWrT8b29IL8PdUJboCwCLcB/s1600/TT%25E6%2588%25AA%25E5%259B%25BE%25E6%259C%25AA%25E5%2591%25BD1%25E5%2590%258D.jpg>
>>
>> What this function means? Select a nodes with specfic roles as the
>> cluster leader or every roles has its leader?
>> --
>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>> >>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/c
>> urrent/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 Team
Lightbend <http://www.lightbend.com/> - Reactive apps on the JVM
Twitter: @akkateam

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


Re: [akka-user] Re: How do I implement "Lookup or Create actor" pattern

2016-08-19 Thread Akka Team
Hi,

I think nowadays your problem is solved by cluster sharding, which, apart
from the crate-or-lookup pattern provides resilience and scaling:
http://doc.akka.io/docs/akka/2.4/scala/cluster-sharding.html

-Endre

On Fri, Aug 19, 2016 at 11:41 AM, Manh Ha VU <manhha@gmail.com> wrote:

> Hi Thibault,
>
> So finally, how did you implement this requirement of yours?
>
> I'm facing on a similar problem in which each actor is a Facebook
> Messenger user. I don't know in advance if these users exist so that I have
> to create a new actor if one does not exist.
>
> Thanks,
>
> Manh-Ha
>
>
> On Wednesday, September 4, 2013 at 5:30:58 PM UTC+2, Thibaut Robert wrote:
>>
>> Hi,
>>
>> I'd like to have some advise on how to implement this kind of pattern.
>> Some words about my context (will try to keep it short):
>>
>> The simple case first: I have a Client / Server architecture, clients
>> communicates to the servers through akka remote.
>> Let's say that client identify it self by a name. To each client, I
>> assign an actor (or graph of actors) on the server. There is a state
>> maintained by the actor for each client.
>>
>> Now I wonder if I should use actorOf (with a remote deployment config) or
>> actorSelection on the client. The client doesn't know if the actor for him
>> has already been instantiated on the server or not. I think I can manage by
>> first using actorSelection, sending a message, then remote deploy with
>> actorOf if I have no reply.
>> But maybe there is already a known good practice for this use case ?
>>
>>
>> Full case now: It's not a single server but a group of server in an akka
>> cluster. The client uses a ClusterRouter to communicate with the cluster
>> (ScatterGatherFirstCompletedRouter in my case, but I should not matter a
>> lot). To my understanding, I have two options :
>> - specify a routee path in the ClusterRouterConfig: in this case, actor
>> must already exists on my cluster nodes
>> - don't specify it: routees will be created remotely on the router
>> creation
>>
>> What I would like would be : specify a routee path, and remote deploy
>> them only if they don't already exists.
>>
>> Do you have any idea or suggestions ? Do you think this is a good pattern
>> that should be implement, or maybe this pattern is wrong ?
>>
>> Thanks,
>> Thibaut
>>
>>
>>
> --
> >>>>>>>>>> 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 Team
Lightbend <http://www.lightbend.com/> - Reactive apps on the JVM
Twitter: @akkateam

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


Re: [akka-user] Do we rename the actor instance's name.

2016-08-19 Thread Akka Team
Hi Vishal,

It is not possible to change the name of an actor as it is part of a unique
identifier during its lifetime. Why do you even need to change it?

-Endre

On Fri, Aug 12, 2016 at 12:09 AM, Justin du coeur <jduco...@gmail.com>
wrote:

> The system certainly doesn't do so normally; I don't *think* it's possible
> to, although I'm not the expert.  Why do you ask?
>
> On Thu, Aug 11, 2016 at 6:41 AM, Vishal Singh <bh.visha...@gmail.com>
> wrote:
>
>> Hi All,
>>
>> Once we have created an actor instance, do we change name of it later.
>>
>> Thanks.
>>
>> --
>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>> >>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/c
>> urrent/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 Team
Lightbend <http://www.lightbend.com/> - Reactive apps on the JVM
Twitter: @akkateam

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


Re: [akka-user] Basic Akka stream server not receiving data sent by client

2016-08-19 Thread Akka Team
On Sun, Aug 14, 2016 at 2:18 PM, murtuza chhil <chil...@gmail.com> wrote:

> Hi,
>
> I have a simple client that reads a csv file and send it across. When I
> have a netcat server I can see the data come through.
>
> However when I have a Akka stream based server I do see the connection but
> I don't see the data come through.
>
> Could someone be kind enough to let me know where I have screwed up?
>
> Server code
>
>
> ActorSystem system = ActorSystem.create("System");
> ActorMaterializer mat = ActorMaterializer.create(system);
>
> Source<IncomingConnection, CompletionStage> 
> serverSource = Tcp
> .get(system).bind("127.0.0.1", 6000);
> serverSource.runForeach(
> conn -> {
> System.out.println(conn.remoteAddress());
> Sink<ByteString, NotUsed> receiveSink = conn
> .flow()
> .via(Framing.delimiter(
> ByteString.fromString("\r\n"), 10))
> .to(Sink.foreach(str -> {
> System.out.println("< " + str);
> // Thread.sleep(10);
> }));
> Source<ByteString, NotUsed> emptySource = Source.empty();
> emptySource.to(receiveSink).run(mat);
>
> Since you run with an emptySource, the connection will be closed, because
you just completed the output side of your TCP connection (because of the
emptySource) and you have halfClose = false in your bind command (the
default).


>
>
> }, mat);
>
> ​
>
>
> Client code : Reads a file, prints it line by and sends it over the
> socket. The connecting and sending part works as I can see the data
> received at a netcat server.
>
> ActorSystem system = ActorSystem.create("client");
> ActorMaterializer mat = ActorMaterializer.create(system);
>
> Flow<ByteString, ByteString, CompletionStage> 
> serverConnection = Tcp
> .get(system).outgoingConnection("127.0.0.1", 6000);
> Path file = Paths.get("C:\\temp\\Generic.csv");
> CompletionStage cs = FileIO.fromPath(file)
>
> .via(Framing.delimiter(ByteString.fromString("\r\n"), 10))
> .map(str -> {
> System.out.println(str.utf8String());
> return str.concat(ByteString.fromString("\r\n"));
> })
>
> .via(serverConnection).to(akka.stream.javadsl.Sink.ignore())
> .run(mat);
>
> ​
> -chhil
>
> --
> >>>>>>>>>> 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 Team
Lightbend <http://www.lightbend.com/> - Reactive apps on the JVM
Twitter: @akkateam

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


Re: [akka-user] Basic Akka stream server not receiving data sent by client

2016-08-19 Thread Akka Team
Hi,

On Fri, Aug 19, 2016 at 12:41 PM, murtuza chhil <chil...@gmail.com> wrote:

> Thank you for the pointer.
>
> Changed it to the following
> ```java
>  final List options = new ArrayList()
> ;
> Source<IncomingConnection, CompletionStage>
> serverSource = Tcp
> 
> .get(system).bind("127.0.0.1",6000,100,options,true,Duration.create(5,
> TimeUnit.MINUTES));
> ```
> Now I get the data.
>
>
> I was mimicking this scala code
> <https://github.com/adamw/reactive-akka-pres/blob/master/src/main/scala/com/softwaremill/reactive/step1/ReceiverStep1.scala>
>  after
> watching Adams youtube video.
> Does the scala implementation get away by not defining the halfclose
> option or its done behind the scenes or its an older version of akka that
> allows it?
>

I have no clue why he gets away with it, it is racy.

I guess we should provide some helpers for the case when one only wants to
read from TCP and close the output when the other side closes.

-Endre


>
> -chhil
>
> On Friday, August 19, 2016 at 2:54:36 PM UTC+5:30, Akka Team wrote:
>>
>>
>>
>> On Sun, Aug 14, 2016 at 2:18 PM, murtuza chhil <chi...@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> I have a simple client that reads a csv file and send it across. When I
>>> have a netcat server I can see the data come through.
>>>
>>> However when I have a Akka stream based server I do see the connection
>>> but I don't see the data come through.
>>>
>>> Could someone be kind enough to let me know where I have screwed up?
>>>
>>> Server code
>>>
>>>
>>> ActorSystem system = ActorSystem.create("System");
>>> ActorMaterializer mat = ActorMaterializer.create(system);
>>>
>>> Source<IncomingConnection, CompletionStage> 
>>> serverSource = Tcp
>>> .get(system).bind("127.0.0.1", 6000);
>>> serverSource.runForeach(
>>> conn -> {
>>> System.out.println(conn.remoteAddress());
>>> Sink<ByteString, NotUsed> receiveSink = conn
>>> .flow()
>>> .via(Framing.delimiter(
>>> ByteString.fromString("\r\n"), 10))
>>> .to(Sink.foreach(str -> {
>>> System.out.println("< " + str);
>>> // Thread.sleep(10);
>>> }));
>>> Source<ByteString, NotUsed> emptySource = 
>>> Source.empty();
>>> emptySource.to(receiveSink).run(mat);
>>>
>>> Since you run with an emptySource, the connection will be closed,
>> because you just completed the output side of your TCP connection (because
>> of the emptySource) and you have halfClose = false in your bind command
>> (the default).
>>
>>
>>>
>>>
>>> }, mat);
>>>
>>> ​
>>>
>>>
>>> Client code : Reads a file, prints it line by and sends it over the
>>> socket. The connecting and sending part works as I can see the data
>>> received at a netcat server.
>>>
>>> ActorSystem system = ActorSystem.create("client");
>>> ActorMaterializer mat = ActorMaterializer.create(system);
>>>
>>> Flow<ByteString, ByteString, CompletionStage> 
>>> serverConnection = Tcp
>>> .get(system).outgoingConnection("127.0.0.1", 6000);
>>> Path file = Paths.get("C:\\temp\\Generic.csv");
>>> CompletionStage cs = FileIO.fromPath(file)
>>>
>>> .via(Framing.delimiter(ByteString.fromString("\r\n"), 10))
>>> .map(str -> {
>>> System.out.println(str.utf8String());
>>> return str.concat(ByteString.fromString("\r\n"));
>>>     })
>>>
>>> .via(serverConnection).to(akka.stream.javadsl.Sink.ignore())
>>> .run(mat);
>>>
>>> ​
>>> -chhil
>>>
>>> --
>>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>>> >>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/c
>>> urrent/addit

Re: [akka-user] What happened if leader become unreachable in the cluster

2016-08-19 Thread Akka Team
Hi Yutao,

The leader is not a user concern, why do you ask? In general, the leader is
"elected" once the cluster state is convergent. This "election" is more or
less implicit and it is a pure function of the membership ring. It has
nothing to do with DOWN-ing, only in the sense that DOWN-ing changes the
membership ring, and on the next convergence the leader will change if it
was the DOWN-ed one.

-Endre

On Sat, Aug 13, 2016 at 5:28 PM, Patrik Nordwall <patrik.nordw...@gmail.com>
wrote:

> What are you trying to solve?
>
> /Patrik
>
> tors 11 aug. 2016 kl. 13:46 skrev Yutao Shuai <szqs...@gmail.com>:
>
>> Does the leader will down himself or another node will become leader?
>> Where is  the code about this in the source files. Thanks much for your
>> help!
>>
>> --
>> >>>>>>>>>> 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 Team
Lightbend <http://www.lightbend.com/> - Reactive apps on the JVM
Twitter: @akkateam

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


Re: [akka-user] Router path in Akka config

2016-08-19 Thread Akka Team
le.com/d/optout.
>>>>
>>>>
>>>> --
>>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>>> >>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/c
>>> urrent/additional/faq.html
>>> >>>>>>>>>> Search the archives: https://groups.google.com/grou
>>> p/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 Team
Lightbend <http://www.lightbend.com/> - Reactive apps on the JVM
Twitter: @akkateam

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


Re: [akka-user] [akka-streams] Wrapping one flow with another while keeping the inner's materialized value

2016-08-19 Thread Akka Team
Hi Itamar,

First of all, I think there is already a timing stage somewhere in
akka-stream-contrib (https://github.com/akka/akka-stream-contrib), but I
might be wrong.

As for using flatMapConcat, apart from the issue that it does not give you
the materialized value, it is also slower than a normal inline stage.

The usual way to handle these is a custom BidiFlow, backed by a GraphStage.
Then you can safely share state between the inputs and outputs. Basically,
instead of "wrapping" a Flow, you add a BidiStage on top of it, resulting
in another flow.

See the Flow.join(BidiFlow) method:
http://doc.akka.io/api/akka/2.4/index.html#akka.stream.scaladsl.Flow@join[I2,O2,Mat2](bidi:akka.stream.Graph[akka.stream.BidiShape[Out,O2,I2,In],Mat2]):akka.stream.scaladsl.Flow[I2,O2,Mat]

(click to expand to see the ASCII-art diagram of how it works).

-Endre

On Fri, Aug 19, 2016 at 6:09 PM, Itamar Ravid <ira...@iravid.com> wrote:

> Hi everyone,
>
>
> I'm trying to write a function that wraps an arbitrary flow with another
> flow that performs a side-effect: measures the execution time of the inner
> flow. I'm also trying to avoid writing a custom GraphStage to do this.
>
>
> So far, I've come up with this:
>
>
> def measuredFlow[In, Out](timer: Timer)(flow: Flow[In, Out, NotUsed] = {
>   Flow[In].flatMapConcat { el =>
> val timerContext = timer.timerContext()
> Source.single(el).via(flow).map(e => timerContext.close(); e)
>   }
>
>
> This is great and very composable, but has one restriction: it can only
> handle flows that I don't care about their materialized values. The reason
> is that there is no way to propagate the materialized value from within
> flatMapConcat, AFAICT.
>
>
> I've been looking for different approaches to this, but couldn't find any
> that don't involve using flatMapConcat, as that is the only built-in stage
> that can wrap another stage.
>
>
> The other solution is to write a custom GraphStage and imitate
> FlattenMerge's usage of SubSinkInlet, but I'm wary of this as SubSinkInlet
> is marked as private API and there's no documentation for custom stages
> that wrap other stages.
>
>
> Has anyone tried tackling this problem? Would love to hear any ideas.
>
>
>
>
>
>
>
> --
> >>>>>>>>>> Read the docs: http://akka.io/docs/
> >>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/c
> urrent/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 Team
Lightbend <http://www.lightbend.com/> - Reactive apps on the JVM
Twitter: @akkateam

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


Re: [akka-user] Custom GraphStage with async operation

2016-08-20 Thread Akka Team
Hi Matt,

Although not mapAsync but an asynchronous Fold, you can look at this PR for
inspiration:
https://github.com/akka/akka/pull/20888/files#diff-3203199ba389ee802eef94486f26dc88R428

If you take away the supervision part from that stage it is rather simple.
The main reason btw mapAsync is complicated is because it acts like a
buffer and allows the up and downstream to progress independently. We call
these kind of stages "detached" and they are usually pain to deal with. Use
the pattern I linked above that will work nicely.

-Endre

On Wed, Aug 17, 2016 at 1:44 AM, <m...@fullstackanalytics.io> wrote:

> Hey all,
>
> Thanks in advance for your help. I posted a question on stack overflow
> here
> <http://stackoverflow.com/questions/38964399/custom-akka-streams-graphstage-with-futures-like-mapasync>
>  ,
> but figured I'd follow up here before taking a stab.
>
> Basically I was wondering if there are any subclasses for GraphStage to
> emit a future on push/pull, or if anyone had boilerplate for emulating
> mapAsync(1) that is less complicated than an implementation
> <https://github.com/akka/akka/blob/acc5223d387ff9acdef8b520fe91105e8e2b64b1/akka-stream/src/main/scala/akka/stream/impl/fusing/Ops.scala#L941>.
> I simply need to update state after a future call is emitted at each stage.
> For now, I Await the result and use a pinned dispatcher to set a boundary
> for my stage.
>
> Matt
>
> --
> >>>>>>>>>> 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 Team
Lightbend <http://www.lightbend.com/> - Reactive apps on the JVM
Twitter: @akkateam

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


Re: [akka-user] How do we handel OversizedPayloadException in Akka

2016-08-22 Thread Akka Team
t;>>>>>>> But we wanted to handel this OversizedPayloadException and send
>>>>>>>>> the message to the client.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Regards,
>>>>>>>>>
>>>>>>>>> Prakash
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>> >>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/c
>>>>>>>>> urrent/additional/faq.html
>>>>>>>>> >>>>>>>>>> Search the archives: https://groups.google.com/grou
>>>>>>>>> p/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.
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> Cheers,
>>>>>>>> √
>>>>>>>>
>>>>>>>> --
>>>>>>>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>> >>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/c
>>>>>>>> urrent/additional/faq.html
>>>>>>>> >>>>>>>>>> Search the archives: https://groups.google.com/grou
>>>>>>>> p/akka-user
>>>>>>>> ---
>>>>>>>> You received this message because you are subscribed to a topic in
>>>>>>>> the Google Groups "Akka User List" group.
>>>>>>>> To unsubscribe from this topic, visit
>>>>>>>> https://groups.google.com/d/topic/akka-user/oj4YsZpGYGs/unsubscribe
>>>>>>>> .
>>>>>>>> To unsubscribe from this group and all its topics, 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/c
>>>>>>> urrent/additional/faq.html
>>>>>>> >>>>>>>>>> Search the archives: https://groups.google.com/grou
>>>>>>> p/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.
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Cheers,
>>>>>> √
>>>>>>
>>>>>> --
>>>>>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>> >>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/c
>>>>>> urrent/additional/faq.

Re: [akka-user] How do we handel OversizedPayloadException in Akka

2016-08-22 Thread Akka Team
Hi Anup,

The one execption that is thrown is handled by the supervisor of that
actor, which in turn restarts that actor. That means a reconnect in this
case. We don't throw the OverSizedPayloadException because we don't want a
reconnect in that case.

There is no way to get this exception on your callstack no matter how you
try (because it is on an unrelated thread of an unrelated non-parent
actor). The operation "!" (or tell()) simply never throws. This is by
design.

-Endre

On Mon, Aug 22, 2016 at 6:40 PM, Anup M <anup...@gmail.com> wrote:

> But a few lines down the code, I see a bunch of throw clauses.   My point
> is that if such an exception occurs, currently it is just logged, there is
> no failure or error anywhere, just a message in the log.  Now that becomes
> a hard to track issue
>
>
> On Monday, August 22, 2016 at 10:00:12 PM UTC+5:30, Akka Team wrote:
>
>>
>>
>> Basically the exception is logged and then it is business as usual.  I am 
>> wondering why the exception is not re-thrown.  This can cause some kind of 
>> silent failures in production applications
>>>
>>>
>> Because it is not on your call-stack but on another thread. There is
>> nowhere to throw. This is multi-threaded software, simply throwing stuff
>> around does not work. This is one of the primary reasons why supervision
>> exists for actors.
>>
>> -Endre
>>
>>
>>>
>>>
>>>
>>> On Wednesday, August 17, 2016 at 3:23:21 PM UTC+5:30, √ wrote:
>>>>
>>>> No, that's not what I mean to say. I mean to say that relying on that
>>>> specific exception and doing stuff in response to it is out of reach since
>>>> it is raised by the remoting subsystem outside of your call stack.
>>>>
>>>> On Wed, Aug 17, 2016 at 11:42 AM, prakash chinnaswamy <
>>>> prakash.chi...@gmail.com> wrote:
>>>>
>>>>> So you mean to say we cannot handle any run time exception?
>>>>>
>>>>> On Wed, Aug 17, 2016 at 12:43 PM, Viktor Klang <viktor...@gmail.com>
>>>>> wrote:
>>>>>
>>>>>> Then you need to prevalidate the message. Don't rely on serialization
>>>>>> size since that is a function of the serializer used.
>>>>>>
>>>>>> --
>>>>>> Cheers,
>>>>>> √
>>>>>>
>>>>>> On Aug 17, 2016 7:53 AM, "prakash chinnaswamy" <
>>>>>> prakash.chi...@gmail.com> wrote:
>>>>>>
>>>>>>> Viktor. Tuning is not a possible solution in our case . we need to
>>>>>>> inform the clint that the size is large and try with pagination. So we 
>>>>>>> need
>>>>>>> to handel this exception.
>>>>>>>
>>>>>>>
>>>>>>> On Tuesday 16 August 2016, Viktor Klang <viktor...@gmail.com> wrote:
>>>>>>>
>>>>>>>> Prakash,
>>>>>>>>
>>>>>>>> I think a possible solution is two-fold: start using a more
>>>>>>>> efficient means of serialization (which reduces payload sizes), and 
>>>>>>>> don't
>>>>>>>> rely on exception throwing to track lost messages (Akka is at-most-once
>>>>>>>> delivery).
>>>>>>>>
>>>>>>>> On Tue, Aug 16, 2016 at 1:40 PM, prakash chinnaswamy <
>>>>>>>> prakash.chinnaswamy...@gmail.com> wrote:
>>>>>>>>
>>>>>>>>> Viktor
>>>>>>>>>
>>>>>>>>> Could on get in what contest you are asking. Just add more
>>>>>>>>> information we use Scala and it is a rest application where this
>>>>>>>>> application will talk to a play server (having a remote actor). When 
>>>>>>>>> trying
>>>>>>>>> to send a large record we get this error. We would like to handle this
>>>>>>>>> error and send a warning message to the client.
>>>>>>>>>
>>>>>>>>> On Tue, Aug 16, 2016 at 5:00 PM, Viktor Klang <
>>>>>>>>> viktor.kl...@gmail.com> wrote:
>>>>>>>>>
>>>>>>>>>> Hi Prakash,
>>>>>>>>>>
>>>>>>>>>> Do you use Java Serialization?
&

Re: [akka-user] akka connection refused with a shared actorRef

2016-09-06 Thread Akka Team
Hi Loïc,

Akka Remoting is a peer-to-peer protocol for building distributed systems
on trusted networks, it's therefore not very suitable to build a
client-server-over-internet app, so I would start with recommending you to
reconsider how to communicate between your clients and your server. As the
protocol is p2p both sides of a connection must be able to connect to the
other, something that is usually not possible with NAT unless you
specificly configure the router to forward the specific port to a computer
inside of the NAT.

--
Johan
Akka Team

On Sat, Aug 27, 2016 at 10:58 AM, Loïc Girault <loic.gira...@gmail.com>
wrote:

> I'm not sure if my problem relies on akka or on network setup.
>
>
> I'm writting a program that uses a server to connect different clients
> together. The server and the clients are actor system.
>
> The problem is that in some contexts, when the clients receives the
> actorRef of the other clients send by the server and try to use it, I have
> a connection refused error.
>
>
> I've done different test using a server and two clients to diagnose the
> problem :
>
>
> 1) If I run the three process on the same computer with
> akka.remote.netty.tcp.hostname=127.0.0.1 everything works perfectly the
> clients can communicate together
>
>
> 2) Now my computer is behind a physical router. I configured some port to
> be redirected toward some port of my computer.
>
>
> If I run the server on a distant machine (not on the local network), I
> configure the clients as follow
>
>
> akka.remote.netty.tcp {
>   hostname = "my public ip"
>   bind-hostname = "my local ip"
>   port = "manually configured port to be redirected"
>   bind-port = "manually configured port to be redirected"
> }
>
> then everything still works perfectly, the clients can communicate
> together.
>
>
> 3) Now the software is a game so I don't expect users to know how to
> correctly configure their network, hence I use the following lines to
> programatically generate a configuration :
>
> object ConnectionHelper {
>
>   def findIP4(addresses : util.Enumeration[InetAddress]) : Option[String] =
> if(!addresses.hasMoreElements) None
> else {
>   val address = addresses.nextElement()
>   if(address.isInstanceOf[Inet4Address]) Some(address.getHostAddress)
>   else findIP4(addresses)
> }
>
>   def findLocalIP : Option[String] = {
> def aux(interfaces : util.Enumeration[NetworkInterface]) : Option[String] 
> =
>   if(!interfaces.hasMoreElements) None
>   else {
> val interface : NetworkInterface = interfaces.nextElement()
> if(interface.isLoopback) aux(interfaces)
> else findIP4(interface.getInetAddresses) match {
>   case None => aux(interfaces)
>   case sa => sa
> }
>   }
> aux(NetworkInterface.getNetworkInterfaces)
>   }
>
>   def findPort() : Int = {
> val s = new ServerSocket(0)
> val p = s.getLocalPort
> s.close()
> p
>   }
>
>   def publicIp = {
> val whatismyip = new URL("http://checkip.amazonaws.com;)
> val in = new BufferedReader(new 
> InputStreamReader(whatismyip.openStream()))
> val ip = in.readLine() //you get the IP as a String
> in.close()
> ip
>   }
>
>   def myConfig(hostname : String, port : Int,
>bindHostname : String, bindPort : Int) =
> ConfigFactory.parseString("akka.remote.netty.tcp {\n" +
>   s"hostname=$hostname\n"  +
>   s"bind-hostname=$bindHostname\n" +
>   s"port=$port\n" +
>   s"bind-port=$bindPort\n" +
>   "}"
> )
>
>
>   def conf(confFileName : String) : Config = {
>
> val port = findPort()
>
> val regularConfig = ConfigFactory.load(confFileName)
> val pIp = publicIp
> val lIp = findLocalIP getOrElse error("cannot find local ip")
> val combined = myConfig(pIp, port, lIp, port).withFallback(regularConfig)
>
> ConfigFactory.load(combined)
>   }
> }
>
> And then the problem described above appears. What I really don't
> understand is that to begin with, the client successfully communicate with
> the server, they exchange message, hence it doesn't look like there is a
> firewall or a port redirection problem ... But then I got this connection
> refused error when clients are trying to communicate together using the
> same actorRef that was used to exchange message with the server.
>
> --
> >>>>>>>>>> Read the docs: http://akka.io/docs/
> >&g

Re: [akka-user] Re: Akka and Streams Concurrency Fundamentals

2016-09-07 Thread Akka Team
Hi Dagny,

The Akka Streams tests for the built in stages could perhaps be useful to
see various strategies for testing. You can find those sources here:
https://github.com/akka/akka/tree/master/akka-stream-tests/src/test/scala/akka/stream/scaladsl

--
Johan
Akka Team

On Fri, Sep 2, 2016 at 8:08 PM, Dagny T <dagnytagg2...@gmail.com> wrote:

>
> Yes, well; that link is rather generic, no?  ;0)
>
> What I (and likely the 19 other Viewers of this post) are looking for is
> baseline-thorough coverage of test-cases to be aware of when testing Akka
> Actor and Streams operations.
> I'm a newbie, and I learn best through running idiomatic code examples
> with test cases; hence my interest.
>
> I didn't find that in the docs; nor am I finding it in any of the Blogs
> that I've been Googling around for.
> That's why I'm asking for help with finding a current and reliable
> information source.
>
> I found these specific docs do provide a scratch-the-surface start:
> http://doc.akka.io/docs/akka/2.4.9/scala/stream/stream-testkit.html
>
> However, I'm looking for Tutorial-level code covering things like:
> - testing backpressure operation with Bounded memory settings when
> operating simple Graphs of Flows
> - testing for connection drops, resend of duplicate message,  and Client
> retries and wait-timeouts
> - testing for system exception-handling occurring in a mid-Flow Stage.
>
> Would be darn grateful if you had any specific insights on where to find
> such learning resources; and were willing to share them with this Forum!
>
> Thanks in advance for continuing to support a welcoming community for Akka
> Newbs!  You'll make the World a Better Place with Akka Everywhere!  ;0)
> Dagny T
>
>
> On Thursday, September 1, 2016 at 2:43:46 PM UTC-7, Dagny T wrote:
>>
>>
>> I'd like to find reliable and current information for learning this using
>> v2.4.9.
>>
>> I've posted a reply to someone else's related message; but wanted to call
>> Forum attention to please help refer us to a useful Blog or GitHub repo on
>> this topic; AND
>> using the latest and greatest TestKit tools!
>>
>> It's been rather hit-or-miss with Googling samples lately; as the APIs
>> have been moving rapidly, and I'm still too new to pick out what's
>> essentially most important!
>>
>> THANK you so much in advance for any Best-Practice info on these
>> fundamentals!
>>
>> Here was my reply to that earlier related post:
>> https://groups.google.com/forum/#!topic/akka-user/4k4nXVn-wWw
>>
>> THANKS in advance to hAKKArs!
>>
> --
> >>>>>>>>>> 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 Team
Lightbend <http://www.lightbend.com/> - Reactive apps on the JVM
Twitter: @akkateam

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


Re: [akka-user] Catch dropped elements in a stream

2016-09-07 Thread Akka Team
Hi Victor,

As far as I can see there is no way to guarantee that you will know if a
message was discarded in the process step in any other way than writing
your own custom stage.

You could for example create a stage that will record incoming messages
before sending to process, and then also plug that in on the outgoing side
of process (it would perhaps be a bidi-stage). This way you could keep
track of elements sent into process but not coming out on the other side.

If the messages have a sequence id that is only growing and doesn't have
holes in it, detecting a missing message could be done with a custom stage
that looks at the previous id and the current.

Depending on use case there might be more strategies that could achieve
what you want.

--
Johan
Akka Team

On Wed, Aug 31, 2016 at 1:16 PM, Victor <victor.pi...@iadvize.com> wrote:

> Hi,
>
> I've designed an AMQP graph where I need to ack or nack a message
> depending on the processing result of the message:
>
> *AmqpSource* (consume) -> *Process* -> *Recover* -> *AmqpSink* (publish)
>
> All stages are under my control except the *Process* stage which is a
> *Flow* and is implemented by a different user and is a black box from my
> point of view.
>
> The *Recover* stage will emit an *ErrorMessage* or a *Message* depending
> on the *Process* stage result, because I have to deal with *Process*
> stage failures as I don't know what happen in this stage.
>
> The *AmqpSink* will publish the received message to an exchange and then
> ack or nack the message depending if it's an *ErrorMessage* or a *Message*
> .
>
> The problem I have is that in the *Process* stage the user may filter
> incoming elements, so these elements will never arrive in the *AmqpSink*
> and will never be acked.
>
> So to make it simple, if I have N elements out from the source, I MUST
> have N elements in in the sink, whereas it's an *ErrorMessage* or a
> *Message*, and all of that whatever happens in the *Process* stage.
> Is there a way to catch dropped elements in a stream? How could I resolve
> my problem?
>
> Thanks in advance,
> Victor
>
> --
> >>>>>>>>>> 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 Team
Lightbend <http://www.lightbend.com/> - Reactive apps on the JVM
Twitter: @akkateam

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


Re: [akka-user] [akka-http] what is actually happening on request timeout?

2016-09-08 Thread Akka Team
Hi Kyrlyo,

The flow will be cancelled as the downstream is already completed.

I find this little stage may be useful to help you reason about what is
going on, you should be able to verify that it prints "onDownstreamFinish"
when the route times out:

case class SnitchingStage[A](name: String) extends GraphStage[FlowShape[A, A]] {
  val in = Inlet[A]("in")
  val out = Outlet[A]("out")
  override val shape: FlowShape[A, A] = FlowShape(in, out)
  override def createLogic(inheritedAttributes: Attributes):
GraphStageLogic = new GraphStageLogic(shape) {
setHandler(in, new InHandler {
  override def onPush(): Unit = {
println(s"$name: onPush")
push(out, grab(in))
  }
  override def onUpstreamFinish(): Unit = {
println(s"$name: onUpstreamFinish")
super.onUpstreamFinish()
  }
  override def onUpstreamFailure(ex: Throwable): Unit = {
println(s"$name: onUpstreamFailure: ${ex.getMessage}")
super.onUpstreamFailure(ex)
  }
})
setHandler(out, new OutHandler {
  override def onPull(): Unit = {
println(s"$name: onPull")
pull(in)
  }
  override def onDownstreamFinish(): Unit = {
println(s"$name: onDownstreamFinish")
super.onDownstreamFinish()
  }
})
  }
}


--
Johan
Akka Team

On Sat, Aug 27, 2016 at 10:25 PM, Kyrylo Stokoz <k.sto...@gmail.com> wrote:

> HI All,
>
> I came across a strange issue happening with akka http on request timeout
> which i cannot understand, can some body help me with it?
>
> Consider following code in akka 2.4.9:
>
>
> import akka.NotUsed
> import akka.actor.ActorSystem
> import akka.http.scaladsl.Http
> import akka.http.scaladsl.model.{HttpRequest, HttpResponse}
> import akka.http.scaladsl.server.Directives._
> import akka.stream.{ActorMaterializer, FlowShape}
> import akka.stream.scaladsl.GraphDSL.Implicits._
> import akka.stream.scaladsl.{Broadcast, Flow, GraphDSL, Zip}
>
> import scala.concurrent.Future
>
> object Test extends App {
>   implicit val actorSystem = ActorSystem()
>   implicit val ec = actorSystem.dispatcher
>   implicit val materializer = ActorMaterializer()
>
>   def routes =
> (path("test1") & get) {
>   complete("result1")
> } ~
> (path("test2") & get) {
>   complete {
> Future {
>   Thread.sleep(3)
>   "result2"
> }
>   }
> }
>
>   def processRequest(route: Flow[HttpRequest, HttpResponse, NotUsed]): 
> Flow[HttpRequest, HttpResponse, NotUsed] =
> new ExtendedFlow(route).extend()
>
>   val serverSource = Http().bindAndHandle(processRequest(routes), "0.0.0.0", 
> port = 11011)
> }
>
> final class ExtendedFlow[A, B](originalFlow: Flow[A, B, NotUsed]) {
>
>   def extend(): Flow[A, B, NotUsed] =
> Flow.fromGraph {
>   GraphDSL.create() { implicit builder =>
>
> val in = builder.add(Flow[A].map { e => println("in " + e); e })
>
> val broadcast = builder.add(Broadcast[A](2))
> val zip   = builder.add(Zip[A, B]())
>
> val out = builder.add(Flow[(A, B)].map { o => println("out " + o); 
> o._2 })
>
> in ~> broadcast; broadcast.out(0) ~> zip.in0
>  broadcast.out(1) ~> originalFlow ~> zip.in1; zip.out 
> ~> out
>
> FlowShape(in.in, out.out)
>   }
> }
> }
>
>
> Now if i execute `curl -v "http://localhost:11011/test1"` i correctly see 
> 'in' and 'out' print statements in console and "result1" sent to user.
>
>
> My actual confusion is when i execute `curl -v 
> "http://localhost:11011/test2"`.
>
> In this case after 20s (default request timeout in akka http) 
> HttpServerBluePrint sends 503 back to user with a message that server was not 
> able to produce response in time.
>
> Later, in 30s, future completes as well, result of it i guess is ignored as 
> response from client was already handled.
>
> Question here is what actually happening to the extended flow in this 
> situation?
>
>
> I don`t see any output from sent from zip.out, though i see 'in' statement 
> printed for test2. Seeing this i would assume either:
>
> 1. Flow would stuck eventually or
>
> 2. Flow would produce wrong pairs in zip commit from next request elements.
>
>
> From my observations flow keeps working without any problems/exceptions and 
> produce correct pair in zip?
>
>
> Anyone can shed some light what is actually going on here?
>
>
> Regards,
>
> Kyrylo
>
>
>

Re: [akka-user] Cannot configure mailbox for Routees in RoundRobinPool

2016-09-08 Thread Akka Team
Hi Mehmet,

Easiest would be to select the mailbox with props:

system.actorOf(Props[TestActor]
  .withMailbox("bounded-mailbox") // here
  .withRouter(FromConfig),
  "groupedtestactor")

But you could also do it purely from config with a deployment section like
this:

"/groupedtestactor/*" {
  mailbox = bounded-mailbox
}

Since the pool will create the routees as children this configures all
direct children of the router to use the bounded-mailbox

--
Johan
Akka Team


On Fri, Aug 26, 2016 at 2:53 PM, Mehmet Cem Güntürkün <
mehmetcemguntur...@gmail.com> wrote:

>
> Hello everyone,
>
> When I try to set a bounded mailbox to routees of RoundRobinPool, Akka,
> kind of ignores the configuration parameter.
>
>
> Here is the sample for configuration:
>
>
> bounded-mailbox {
>   mailbox-type = "akka.dispatch.BoundedMailbox"
>   mailbox-capacity = 1
>   mailbox-push-timeout-time = 1s
> }
>
> akka.actor.deployment {
>   /singletestactor {
> mailbox = bounded-mailbox
>   }
>
>   /groupedtestactor {
> mailbox = bounded-mailbox
>
> router = round-robin-pool
> nr-of-instances = 5
>   }
> }
>
>
> and Here is the test code:
>
>
> object MailboxTest {
>   def main(args: Array[String]): Unit = {
> val actorSystem = ActorSystem()
> val singleTestActor = actorSystem.actorOf(Props[TestActor],
> "singletestactor")
> for (i <- 1 to 10) {
>   singleTestActor ! Hello(i)
> }
>
>
> val groupedTestActor = actorSystem.actorOf(Props[
> TestActor].withRouter(FromConfig, "groupedtestactor")
> for (i <- 1 to 1000) {
>   groupedTestActor ! Hello(i)
> }
>   }
> }
>
> class TestActor extends Actor {
>   def receive = {
> case Hello(i) => {
>   println(s"Hello($i) - begin!")
>   Thread.sleep(1)
>   println(s"Hello($i) - end!")
> }
>   }
> }
>
> case class Hello(i: Int)
>
>
>
> Am I doing something wrong or there is no way to do that?
> Mehmet -
>
> --
> >>>>>>>>>> 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 Team
Lightbend <http://www.lightbend.com/> - Reactive apps on the JVM
Twitter: @akkateam

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


Re: [akka-user] Exception during creation of ActorReceiver in Spark CDH 5.5.2

2016-09-08 Thread Akka Team
Hi Rick,

The error message hints about providing an incorrect list of
parameters: constructor
public akka.actor.CreatorFunctionConsumer(scala.Function0) is incompatible
with arguments [class java.lang.Class, class org.apache.spark.examples.
streaming.ActorWordCount$$anonfun$2]

Note the second parameter being a specific lambda expression, so something
about serializing lambdas.

The chances of getting a good answer may be better in a more Spark focused
forum (see here: https://spark.apache.org/community.html)

--
Johan
Akka Team

On Wed, Aug 31, 2016 at 12:56 AM, Ricky <ricky.pritch...@gmail.com> wrote:

> I'm running Spark on CDH 5.5.2 which has a dependency on Akka 2.2.3.
>
> I'm attempting to create an actorStream in Spark, but during the creation
> of the actor I get the following exception.
>
> Caused by: java.lang.IllegalArgumentException: constructor public 
> akka.actor.CreatorFunctionConsumer(scala.Function0) is incompatible with 
> arguments [class java.lang.Class, class 
> org.apache.spark.examples.streaming.ActorWordCount$$anonfun$2] at 
> akka.util.Reflect$.instantiate(Reflect.scala:69)
>
> Which traces back to 
> https://github.com/akka/akka/blob/v2.2.3/akka-actor/src/main/scala/akka/actor/Props.scala#L337.
>
> Below is a code snippet of my code.
>
> class SampleActorReceiver(url: String) extends Actor with ActorHelper {
>
>   lazy private val remotePublisher = context.actorSelection(url)
>
>   override def preStart() {
> remotePublisher ! SubscribeReceiver(context.self)
>   }
>
>   def receive = {
>  case msg => store(msg.asInstanceOf[String])
>}
> }
>
>
> object ActorStreaming extends App {
>
> val system = ActorSystem("ActorStreaming")
> val feederRef = system.actorOf(Props[FeederActor], "FeederActor")
>
> val sparkConf = new SparkConf().setAppName("Actor Streaming")
> val ssc = new StreamingContext(sparkConf, Seconds(2))
>
> val url = feederRef.path.toStringWithAddress(Address("akka.tcp",
> system.name, InetAddress.getLocalHost.getHostAddress, 2552))
>
> val props = Props.create(classOf[SampleActorReceiver], url)
>
> val lines = ssc.actorStream[String](props, "SampleReceiver")
>
> lines.flatMap(_.split("\\s+")).map(x => (x,1)).reduceByKey( _ +
> _).print()
>
> ssc.start()
> ssc.awaitTermination()
>
> system.awaitTermination()
>
> }
>
> There appears to be an issue with the Creator function being improperly
> serialized when spark sends the function from the driver to the receiver.
> Are there any workarounds, or is there something wrong with my code. Btw it
> works if I run it locally using spark submit, but fails if I submit it on
> the CDH cluster.
>
> 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.
>



-- 
Akka Team
Lightbend <http://www.lightbend.com/> - Reactive apps on the JVM
Twitter: @akkateam

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


Re: [akka-user] akka-http how to allow idle connections while limiting the total number of responses being rendered

2016-09-08 Thread Akka Team
Hi Raghav,

You cannot achieve this with the built in tools, but a simple custom
directive will do the trick. Something like this:

def createConcurrentLimiter(maxConcurrent: Int): Directive0 = {
  // thread safe counter for connections
  val concurrent = new AtomicInteger(0)

  pass.tflatMap[Unit] { _ =>
if (concurrent.get() >= maxConcurrent) {
  complete(StatusCodes.ServiceUnavailable)
} else {
  concurrent.incrementAndGet()
  mapResponse { response =>
concurrent.getAndDecrement()
response
  }
}
  }
}

// important to create once and reuse, so that the same atomic int is used
val maxOneConcurrent = createConcurrentLimiter(1)

val route = get {
  extractRequest { req =>
maxOneConcurrent {
  // never more than one in here
  complete("ok")
    }
  }
}


--
Johan
Akka Team

On Mon, Sep 5, 2016 at 3:56 PM, 'Raghav Narula' via Akka User List <
akka-user@googlegroups.com> wrote:

> I'm using akka-http to build one of my services which returns a chunked
> response that could be 10s of MBs big depending on the client's query. I've
> noticed that the memory required is proportional to the number of
> concurrent streams rather than the number of connections from clients, as
> idle connections seem to use hardly any resources at all.
>
> Is there any way to limit the number of responses being rendered? I can
> only see the akka.http.server.max-connections config variable which seems
> to limit the total number of connections, rather than in flight responses.
> With a low max-connections value clients could be denied service because of
> idle clients holding connections. With a high max-connections I get out of
> memory errors as there is potential for all the connections to make large
> requests.
>
> Ideally I'd like to be able to keep connections open so that clients can
> avoid the overhead of making new connections, but still limit the number of
> in flight responses to protect memory usage. Then if the client tries to
> make a request which can't be served, the connection is dropped with a 409
> maybe?
>
> Or is the common way to deal with this to just have a fast timeout so
> clients can't hold open connections for too long, and make them re-open
> connections frequently?
>
> --
> >>>>>>>>>> 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 Team
Lightbend <http://www.lightbend.com/> - Reactive apps on the JVM
Twitter: @akkateam

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


Re: [akka-user] Example of stateful BidiFlow

2016-09-08 Thread Akka Team
Hi Yaroslav,

You mean a stateful GraphStage with BidiShape?
I don't think we have any in the docs, but there are at least one in the
HTTP sources to look at, this one:
https://github.com/akka/akka/blob/fbfc8b4c58ecc8820e06d68114e7d41f82c3de32/akka-http-core/src/main/scala/akka/http/impl/util/One2OneBidiFlow.scala

--
Johan
Akka Team

On Wed, Sep 7, 2016 at 2:26 PM, Yaroslav Klymko <t3h...@gmail.com> wrote:

> Hi Guys,
> Is there somewhere an example of stateful BidiFlow ?
>
> --
> >>>>>>>>>> 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 Team
Lightbend <http://www.lightbend.com/> - Reactive apps on the JVM
Twitter: @akkateam

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


Re: [akka-user] Re: How to Test WebSocket Streams

2016-09-08 Thread Akka Team
Hi Dagny,

The dependency you need is akka-http-testkit, so in sbt an entry like
this: "com.typesafe.akka"
%% "akka-http-testkit" % akkaV % "test"
It also depends on scalatest, we use version 2.2.1 and I see you have put a
dependency on a snapshot of Scalatest 3, this may cause some problems, you
should notice those as it probably wont compile if there is an
incompability.

The complete example file used in the docs can be found here, and should
help you see what imports are needed:
https://github.com/akka/akka/blob/4acc1cca6a27be0ff80f801de3640f91343dce94/akka-docs/rst/scala/code/docs/http/scaladsl/server/directives/WebSocketDirectivesExamplesSpec.scala

--
Johan
Akka Team

On Wed, Aug 31, 2016 at 10:32 PM, Dagny T <dagnytagg2...@gmail.com> wrote:

>
> TYPO!  My latest WebSocketServer experiment is ACTUALLY in:
> - streamsWebSocket.scala
>
>
> On Wednesday, August 31, 2016 at 1:23:36 PM UTC-7, Dagny T wrote:
>>
>> Newbie Testing WebSocket on Stream.
>>
>> Needed to verify I'm following best-practices on the basics for this!
>>
>> Please refer to my Repo:
>> https://github.com/DagnyTagg2013/ScalaReactive/tree/master/newbie
>>
>> 1) Tried initiating Web Socket Connection JS Client: basicWebSockets.js
>> then handling it on an Akka Streams Server with an Http Request Handler:
>> firstWebSocketServer.scala
>>
>> 2) Tried to test Server with Akka TestKit; but missing build.sbt
>> dependencies for WS(...) and RoutingSpec(...)
>> - Test code here: testWebSocketServer2.scala
>> - Dependencies here:  build.sbt
>>
>> If someone could please comment on how to:
>> - successfully get a WebSocket connection from (1) -- am I setting up the
>> JS and Scala connection correctly?
>> - successfully get the test dependencies to build from (2) -- am I using
>> the correct version of Akka Test libraries to work the the code in
>> testWebSocketServer2?
>>
>> THANKS a lot!
>> D
>>
>> --
> >>>>>>>>>> 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 Team
Lightbend <http://www.lightbend.com/> - Reactive apps on the JVM
Twitter: @akkateam

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


Re: [akka-user] GPU computing with akka

2016-09-08 Thread Akka Team
Hi Zhaoije,

No we are not working on anything like that, and the project mentioned does
not seem to have been touched in the last 5 years.

If there are JVM libraries that can do GPU processing there is nothing
stopping you from using it from actors/Akka though.

--
Johan
Akka Team

On Thu, Sep 8, 2016 at 8:23 AM, Zhaojie Niu <nzjem...@gmail.com> wrote:

> Hi Guys:
>
> Are you still working on the GPU support for Akka?
>
> I think it will be very useful if Akka can support GPU computing now. We
> can see how hot the deep learning is recently and it also shows that GPU
> indeed outperforms CPU in terms of these kind of simple but massive
> computing for the SGD-like algorithms which are widely used.
>
> I am very interested in this project. Do you have any updates on this kind
> of project (e.g., https://github.com/buka/kula)?
> I plan to explore this direction and try to develop a prototype based on
> this project even it seems that nobody maintain it for a long time -_-.
>
> 在 2011年8月24日星期三 UTC+8下午4:37:51,Jonas Bonér写道:
>>
>>  That sounds very cool. I'm really interested to see what comes out of
>> this. I hope you get the time to complete it
>>
>> On Aug 24, 2011, at 7:11 AM, Garrick Evans wrote:
>>
>> A long time ago we had this discussion and it was rattling around in my
>> head on and off ever since.  I was able to scratch together a few nights
>> and mornings recently and start something.  Anyway, I have no idea if I'll
>> be able to give this dedicated attention but figured I'd share it in the
>> event there was interest... It definitely falls in the quick and dirty
>> category - browse and your own risk.
>>
>> https://github.com/buka/kula
>>
>> g
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Akka User List" group.
>> To view this discussion on the web visit https://groups.google.com/d/ms
>> g/akka-user/-/oymjbjtDS6kJ.
>> To post to this group, send email to akka...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> akka-user+...@googlegroups.com.
>> For more options, visit this group at http://groups.google.com/group
>> /akka-user?hl=en.
>>
>>
>> 
>> Jonas Bonér
>> CTO
>> Typesafe - Enterprise-Grade Scala from the Experts
>> Phone: +46 733 777 123
>> Twitter: @jboner
>>
>> --
> >>>>>>>>>> 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 Team
Lightbend <http://www.lightbend.com/> - Reactive apps on the JVM
Twitter: @akkateam

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


Re: [akka-user] Re: Kryo serialization not working?

2016-09-09 Thread Akka Team
Good that you figured it out, and thanks for sharing what was wrong rather
than leaving the question open!

--
Johan
Akka Team

On Fri, Sep 9, 2016 at 2:28 AM, Federico Nusymowicz <feden...@gmail.com>
wrote:

> DERP. I was supposed to nest serializers and serialization-bindings under
> akka.actor ^_^;
>
>
> On Thursday, September 8, 2016 at 3:24:56 PM UTC-7, Federico Nusymowicz
> wrote:
>>
>> I've been trying to set up kryo serialization, without success. Here's my
>> first attempt:
>>
>> akka {
>>>   ...
>>>
>>>   extensions = [
>>> "akka.cluster.pubsub.DistributedPubSub",
>>> "com.romix.akka.serialization.kryo.KryoSerializationExtension$"
>>>   ]
>>>
>>>   actor {
>>> ...
>>>
>>> kryo {
>>>   type = "graph"
>>>   idstrategy = "automatic"
>>>   buffer-size = 4096
>>>   max-buffer-size = -1
>>>   use-manifests = false
>>>   post-serialization-transformations = "lz4"
>>>   kryo-trace = false
>>>   implicit-registration-logging = true
>>>
>>>   mappings {
>>> "life.vw.client.ConciergeTracker$StatusUpdate" = 30,
>>> "life.vw.client.Connection$Write" = 31
>>>   }
>>> }
>>>   }
>>>
>>>   serializers {
>>> kryo = "com.romix.akka.serialization.kryo.KryoSerializer"
>>>   }
>>>
>>>   serialization-bindings {
>>> "life.vw.client.ConciergeTracker$StatusUpdate" = kryo
>>> "life.vw.client.Connection$Write" = kryo
>>>   }
>>>
>>>   ...
>>> }
>>>
>>>
>>  When I ran the cluster, I kept seeing serialization warnings:
>>
>> WARN  17:42:27.913UTC akka.serialization.Serialization(akka://vw) - Using 
>> the default Java serializer for class 
>> [life.vw.client.ConciergeTracker$StatusUpdate] which is not recommended 
>> because of performance implications. Use another serializer or disable this 
>> warning using the setting 'akka.actor.warn-about-java-serializer-usage'
>>
>>
>> I've tried a few other variations, including different values for
>> "idstrategy", class names that only use "." (in place of "$"), and
>> subclassing my messages under a shared trait. None of the attempts worked.
>>
>> I even tried replacing akka-kryo-serialization with Twitter's chill. Even
>> though I followed setup instructions in detail, I kept seeing serialization
>> warnings.
>>
>> Am I missing something obvious? Is there additional setup required when
>> using serialization together with DistributedPubSub?
>>
>> Thanks in advance for your help!
>>
>> Federico
>>
> --
> >>>>>>>>>> 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 Team
Lightbend <http://www.lightbend.com/> - Reactive apps on the JVM
Twitter: @akkateam

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


Re: [akka-user] GPU computing with akka

2016-09-09 Thread Akka Team
No, no plans currently

--
Johan
Akka Team

On Fri, Sep 9, 2016 at 4:02 AM, Zhaojie Niu <nzjem...@gmail.com> wrote:

> Dear Johan:
>
> Thanks for your reply.
>
> Does Akka team have any plans to support GPU?
>
> 在 2016年9月8日星期四 UTC+8下午10:08:32,Akka Team写道:
>>
>> Hi Zhaoije,
>>
>> No we are not working on anything like that, and the project mentioned
>> does not seem to have been touched in the last 5 years.
>>
>> If there are JVM libraries that can do GPU processing there is nothing
>> stopping you from using it from actors/Akka though.
>>
>> --
>> Johan
>> Akka Team
>>
>> On Thu, Sep 8, 2016 at 8:23 AM, Zhaojie Niu <nzje...@gmail.com> wrote:
>>
>>> Hi Guys:
>>>
>>> Are you still working on the GPU support for Akka?
>>>
>>> I think it will be very useful if Akka can support GPU computing now. We
>>> can see how hot the deep learning is recently and it also shows that GPU
>>> indeed outperforms CPU in terms of these kind of simple but massive
>>> computing for the SGD-like algorithms which are widely used.
>>>
>>> I am very interested in this project. Do you have any updates on this
>>> kind of project (e.g., https://github.com/buka/kula)?
>>> I plan to explore this direction and try to develop a prototype based on
>>> this project even it seems that nobody maintain it for a long time -_-.
>>>
>>> 在 2011年8月24日星期三 UTC+8下午4:37:51,Jonas Bonér写道:
>>>>
>>>>  That sounds very cool. I'm really interested to see what comes out of
>>>> this. I hope you get the time to complete it
>>>>
>>>> On Aug 24, 2011, at 7:11 AM, Garrick Evans wrote:
>>>>
>>>> A long time ago we had this discussion and it was rattling around in my
>>>> head on and off ever since.  I was able to scratch together a few nights
>>>> and mornings recently and start something.  Anyway, I have no idea if I'll
>>>> be able to give this dedicated attention but figured I'd share it in the
>>>> event there was interest... It definitely falls in the quick and dirty
>>>> category - browse and your own risk.
>>>>
>>>> https://github.com/buka/kula
>>>>
>>>> g
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Akka User List" group.
>>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>>> g/akka-user/-/oymjbjtDS6kJ.
>>>> To post to this group, send email to akka...@googlegroups.com.
>>>> To unsubscribe from this group, send email to
>>>> akka-user+...@googlegroups.com.
>>>> For more options, visit this group at http://groups.google.com/group
>>>> /akka-user?hl=en.
>>>>
>>>>
>>>> 
>>>> Jonas Bonér
>>>> CTO
>>>> Typesafe - Enterprise-Grade Scala from the Experts
>>>> Phone: +46 733 777 123
>>>> Twitter: @jboner
>>>>
>>>> --
>>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>>> >>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/c
>>> urrent/additional/faq.html
>>> >>>>>>>>>> Search the archives: https://groups.google.com/grou
>>> p/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.
>>>
>>
>>
>>
>> --
>> Akka Team
>> Lightbend <http://www.lightbend.com/> - Reactive apps on the JVM
>> Twitter: @akkateam
>>
> --
> >>>>>>>>>> Read the docs: http://akka.io/docs/
> >>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/
> current/additional/faq.html
> >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
> ---
> You received this message because you are subscribed to the Google Groups
> "Akka User List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to akka-user+unsubscr...@googlegroups.com.
> To post to this group, send email to akka-user@googlegroups.com.
> Visit this group at https://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Akka Team
Lightbend <http://www.lightbend.com/> - Reactive apps on the JVM
Twitter: @akkateam

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


Re: [akka-user] Re: Testing routes and marshalling

2016-09-09 Thread Akka Team
Hi Richard,

The HTTP Testkit expects to have gotten the reply already when check
executes, so that is why it does not work.

You can use the autopilot feature of the TestProbe or a custom test actor
responding the way you want in the test, it could also keep incoming
requests for later assertions.

--
Johan
Akka Team

On Wed, Sep 7, 2016 at 1:47 AM, Richard Rodseth <rrods...@gmail.com> wrote:

> Oy. I'm getting tied up in knots. I guess the requestHandlerProbe.reply
> won't work without a proper sender. I usually put my route definition in an
> actor, but moved it to a trait so that it could be used by the test kit.
> But I did it like this
>
> def route(requestHandler: ActorRef) = ...
>
> Can anyone point me at a sample which uses the ask pattern in routes, and
> also tests the routes with the ScalatestRouteTest?
>
> On Tue, Sep 6, 2016 at 12:56 PM, Richard Rodseth <rrods...@gmail.com>
> wrote:
>
>> So the example here is not very realistic because the route does not
>> depend on any actors:
>>
>> http://doc.akka.io/docs/akka/2.4.9/scala/http/routing-dsl/te
>> stkit.html#Usage
>>
>> I have a status api that returns Either[APIError, StatusDTO].
>>
>> val statusRoute = path("status") {
>>
>>   get {
>>
>> handleErrors {
>>
>>   onSuccess(requestHandler ? RequestHandler.AskForStatus) {
>>
>>   complete(result)
>>
>>   }
>>
>> }
>>
>>   }
>>
>> }
>>  Pondering whether to make a mock actor for requestHandler, or use a
>> probe.
>>
>> This works:
>>
>>   Get("/status") ~> myRoute ~> check {
>>
>> requestHandlerProbe.expectMsgClass(100 millis,
>> RequestHandler.AskForStatus.getClass)
>>
>>   }
>>
>> This times out
>>
>>   Get("/status") ~> myRoute ~> check {
>>
>> requestHandlerProbe.expectMsgClass(100 millis,
>> RequestHandler.AskForStatus.getClass)
>>
>>  val result: Either[APIError, StatusDTO] = Right(StatusDTO("message"
>> ))
>>
>> requestHandlerProbe.reply(result)
>>
>> println(this.responseEntity)
>>
>>   }
>>
>> Any errors in my use of probe.reply ? Would it be better to test response
>> marshalling on its own and limit routing tests to expectMsg?
>>
>>
>>
> --
> >>>>>>>>>> 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 Team
Lightbend <http://www.lightbend.com/> - Reactive apps on the JVM
Twitter: @akkateam

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


Re: [akka-user] Akka HTTP complete Future obtained from ask, with custom marshalling

2016-10-07 Thread Akka Team
You can still pattern match on the type, like so:

   case result: SomeType => complete(result)

--
Johan
Akka Team

On Fri, Oct 7, 2016 at 4:30 PM, Richard Rodseth <rrods...@gmail.com> wrote:

> You're right the types are different, and PimpedResult is not a case class
> so pattern matching doesn't work out. I think I must abandon this approach
> and mimic Heiko's.
> Was hoping to ease the port from Spray but
> this BinTray contribution is too complex.
>
> Sent from my phone - will be brief
>
> On Oct 7, 2016, at 1:38 PM, Akka Team <akka.offic...@gmail.com> wrote:
>
> To be fair you are doing something pretty complex with them, but I agree,
> the magnet pattern definitely can be humbling.
>
> Did the code that worked just fine earlier really deal with the exact same
> type (tuple with statuscode and APIError)?
>
> --
> Johan
> Akka Team
>
> On Fri, Oct 7, 2016 at 1:30 PM, Richard Rodseth <rrods...@gmail.com>
> wrote:
>
>> Heiko has a different approach here
>> https://github.com/hseeberger/reactive-flows/blob/master/src
>> /main/scala/de/heikoseeberger/reactiveflows/Api.scala
>>
>> onSuccess(flowFacade ? addFlow) {
>> case bc: BadCommand => complete(BadRequest -> bc)
>> case fe: FlowExists => complete(Conflict -> fe)
>> case fa: FlowAdded => completeCreated(fa.desc.name, fa)
>> }
>>
>> If I recall correctly, the right arrow is creating a tuple. This seems
>> like a nice approach, though I suppose it also relies on the untyped nature
>> of Ask
>> In my case, if I try something like
>>
>> onSuccess(requestHandler ? NotificationsRequestHandler.AskForStatus) {
>>
>> case apiError: APIError => complete(StatusCodes.BadRequest
>> -> apiError)
>>
>> ...
>>
>>   }
>>
>> my implicit conversions to ToResponseMarshallable aren't found, even
>> though calling Marshall(reply).to[HttpResponse] a few lines earlier is
>> just fine.
>>
>> Implicit conversions sure are humbling.
>>
>> On Fri, Oct 7, 2016 at 11:59 AM, Viktor Klang <viktor.kl...@gmail.com>
>> wrote:
>>
>>> WARNING: I may very well be incorrect here
>>>
>>> Options:
>>> A: switch to the onComplete directive
>>> B: map to an Either[Result, PimpedResult]?
>>>
>>> On Fri, Oct 7, 2016 at 6:38 PM, Richard Rodseth <rrods...@gmail.com>
>>> wrote:
>>>
>>>> That's the trouble. Depending on whether the actor calls
>>>> withStatusCode, it could be a Result or a PimpedResult. Both can be
>>>> marshalled.
>>>>
>>>> In the Spray application we completed the request inside a per-request
>>>> actor. That is no longer possible, hence using Ask.
>>>>
>>>> On Fri, Oct 7, 2016 at 11:18 AM, Akka Team <akka.offic...@gmail.com>
>>>> wrote:
>>>>
>>>>> Hi Richard,
>>>>>
>>>>> You can combine ask with mapTo to cast it to the right type (or fail
>>>>> the future if it does not have that type), see the docs here:
>>>>> http://doc.akka.io/docs/akka/2.4/scala/futures.html#use-with-actors
>>>>>
>>>>> --
>>>>> Johan
>>>>> Akka Team
>>>>>
>>>>> On Fri, Oct 7, 2016 at 10:55 AM, Richard Rodseth <rrods...@gmail.com>
>>>>> wrote:
>>>>>
>>>>>> Continuing my struggles to port something we did with Spray, using
>>>>>>
>>>>>> // See https://bitbucket.org/binarycamp/spray-contrib/src
>>>>>>
>>>>>> I have resolved my implicit conversion errors to the point where I
>>>>>> can execute the following (Result[T] is an alias for Either[APIError, 
>>>>>> T]):
>>>>>>
>>>>>>   val successResult: Result[NotificationsStatusDTO] =
>>>>>> Right(NotificationsStatusDTO("foo"))
>>>>>>
>>>>>>   val successResponseFuture: Future[HttpResponse] = Marshal(
>>>>>> successResult).to[HttpResponse]
>>>>>>
>>>>>>   val successResponse = Await.result(successResponseFuture, 1.second)
>>>>>> // don't block in non-test code!
>>>>>>
>>>>>>   println(s"Success response $successResponse")
>>>>>>
>>>>>>   val successResult2: Result[NotificationsStatusDTO] =
>>>>>> Right(NotificationsStatusDTO(&quo

Re: [akka-user] Akka HTTP complete Future obtained from ask, with custom marshalling

2016-10-07 Thread Akka Team
Hi Richard,

You can combine ask with mapTo to cast it to the right type (or fail the
future if it does not have that type), see the docs here:
http://doc.akka.io/docs/akka/2.4/scala/futures.html#use-with-actors

--
Johan
Akka Team

On Fri, Oct 7, 2016 at 10:55 AM, Richard Rodseth <rrods...@gmail.com> wrote:

> Continuing my struggles to port something we did with Spray, using
>
> // See https://bitbucket.org/binarycamp/spray-contrib/src
>
> I have resolved my implicit conversion errors to the point where I can
> execute the following (Result[T] is an alias for Either[APIError, T]):
>
>   val successResult: Result[NotificationsStatusDTO] =
> Right(NotificationsStatusDTO("foo"))
>
>   val successResponseFuture: Future[HttpResponse] = Marshal(successResult
> ).to[HttpResponse]
>
>   val successResponse = Await.result(successResponseFuture, 1.second) //
> don't block in non-test code!
>
>   println(s"Success response $successResponse")
>
>   val successResult2: Result[NotificationsStatusDTO] =
> Right(NotificationsStatusDTO("foo"))
>
>   val resultWithStatusCode: PimpedResult[(StatusCode,
> NotificationsStatusDTO)] = successResult2.withStatusCode(
> StatusCodes.Accepted)
>
>   val successResponseWithStatusCodeFuture: Future[HttpResponse] = Marshal(
> resultWithStatusCode).to[HttpResponse]
>
>   val successResponseWithStatusCode = Await.result(successResponseWi
> thStatusCodeFuture, 1.second) // don't block in non-test code!
>
>   println(s"Success with status code $successResponseWithStatusCode")
>
> But I have not been able to figure out how to use the onSuccess directive
> (or another if more appropriate) if the response (either a Result or a
> PimpedResult as above) is coming from an Ask.
>
> This obviously doesn't work:
>
>   onSuccess(requestHandler ? NotificationsRequestHandler.AskForStatus)
> {
>
> case _ => complete(x)
>
>   }
>
> Any pointers?
>
> --
> >>>>>>>>>> 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] Re: Organizing Route Directives

2016-10-07 Thread Akka Team
In general, don't try to mimic the way it is done in Akka HTTP itself
unless you actually have the same requirements.  (To support both mixin and
static imports, dealing with both a Scala and Java API etc)

Modularising the routes is not different from modularising other kinds of
codebases, you have options ranging from classes and objects to functions,
each having their own pros and cons. If they have dependencies you have to
provide that in some way, which you can either do directly "hardcoded" or
by some form of injection (note that I'm using inject in the wider sense of
"someone else providing a thing I need" rather than "use a DI-framework"
here) depending on your needs.

Think about how you would usually separate concerns (usually composition
over inheritance is a good idea here) and provide their respective
dependencies to them. Also, if you already do separate concerns in your
codebase, think about using the same way for routes rather than introducing
an entirely different way to do that.

--
Johan
Akka Team

On Fri, Oct 7, 2016 at 11:09 AM, <jpsteinm...@skydance.com> wrote:

> Yes I understand that much and I have broken up my implementation into
> various Route producing functions as you've suggested. The problem I have
> is that it appears for all of this to work I must have all of these
> functions described in a singular class namespace. This appears to be due
> to some inherent state being maintained that can't be easily passed from
> one class to another.
>
> Either you define all of the Route functions in a single class file or you
> end up with this massive chain of dependent classes which gets ugly really
> fast. For instance if I've broken up my routing functions based on
> subsystems I may have one or more classes per subsystem. In order to bring
> it all together at the route level I then need each of those classes to be
> included from one class I can extend. So I ended up with a class hierarchy
> like this...
>
> AllMyDirectives extends SubsystemAandBandCandDDirectives extends
> SubsystemAandBandCDirectives extends SubsystemAandBDirectives extends
> SubsystemADirectives ...
>
> This is a nightmare to maintain as any new subsystem that gets added
> requires modification to the chain and that has rippling effects. It also
> requires that each route function have a unique name in the entirety of the
> global set of directives. You can see this same behavior if you open
> AllDirectives and follow it's dependencies all the way down the chain.
> There must be a better way to organize these directives into classes that I
> can later aggregate in a more meaningful way that allows better separation
> of concerns. Something like...
>
> @Include(SubsystemADirectives, SubsystemBDirectives, SubsystemCDirectives,
> SubsystemDDirectives,...)
> AllMyDirectives extends AllDirectives {
> ...
> }
>
> This still wouldn't solve the namespace problem but it's at least a whole
> heck of a lot easier to maintain and glue together. But maybe there is
> something I am just missing from the documentation that does work more like
> this?
>
> On Friday, October 7, 2016 at 8:28:57 AM UTC-7, Rafał Krzewski wrote:
>>
>> I'm not familiar with Java API but my impression is that AllDirectives is
>> a device for bringing all pre-defined directives in scope of your Route
>> producing functions.
>> Routes themselves are values and you can combine them to produce more
>> complex routes. For example you could have several classes extending
>> AllDirectives containing methods that produce Route values.
>> Such methods could take other Routes as parameters, to support nesting
>> and references to "services" needed to implement route's functionality
>> (ActorRefs and so on).
>> Then you could have a function that constructs all the partial routes and
>> wires them together to produce the root route of your application.
>>
>> Hope that helps,
>> Rafał
>>
>> W dniu środa, 5 października 2016 18:11:17 UTC+2 użytkownik
>> jpste...@skydance.com napisał:
>>>
>>> Now that i'm finally getting the hang of creating routes for akka http
>>> i'm discovering that I need a good way to organize everything. What is the
>>> recommended way to organize custom directives for routes into different
>>> files (specifically in Java)?
>>>
>>> Ideally i'd like to be able to define custom directives that handle
>>> processing of my REST API in an increasingly more complex fashion. So the
>>> primary route will capture large buckets of url's based on a sub-system and
>>> then hand off the additional work to other directives defined in other
>>> classes for further processing

Re: [akka-user] Akka streams in web application

2016-10-07 Thread Akka Team
As you have a finite stream of customer ids the stream will complete after
all elements has been processed. If your actual business problem does in
fact look like this though, it may make sense to not involve Akka Streams
at all and just use the regular Scala collection API to achieve the same.

Also, note that you should probably not create a new Materializer for every
request but instead create a single instance and reuse that across
requests, as the materializer does have a lifecycle and needs to be stopped
if it should have a shorter lifecycle than the ActorSystem it was created
with.

--
Johan
Akka Team

On Thu, Sep 29, 2016 at 6:29 AM, Madabhattula Rajesh Kumar <
mrajaf...@gmail.com> wrote:

> Hi,
>
> I am planning to use Akka Streams in web application. Below is my use case.
>
> Whenever the request come to web server, I will do some operations like
> stg01, stg02 ...
>
> *I have a below questions :- *
>
>- Do we need to close the streams after each request processed ?
>- If N multiple requests come, below invoke method will execute in N
>times with parallel. In this case, how the actors will create and close ?
>
>
> Below is the example code snippet :-
>
>   implicit val actorSystem = ActorSystem("Example")
>   implicit val materializer = ActorMaterializer()
>   implicit val executor = actorSystem.dispatcher
>   val ll = scala.collection.mutable.ListBuffer[String]()
>   ll += "123"; ll += "456"; ll += "789"
>   invoke(ll.toList)
>
>   def invoke(customerId: List[String]) {
> val source = Source(customerId)
> val sink = Sink.foreach[String] { x => display(x) }
> val stg01 = Flow[String].map { x => getStg01(x) }
> val stg02 = Flow[Int].map { x => getStg02(x) }
>
> *val runnable = source via stg01 via stg02 to sink*
>
>   *  runnable.run*
>
>   }
>   def getStg01(request: String) = request.toInt
>   def getStg02(request: Int) = request.toString
>   def display(request: String) = println(" EVENT ===> " + request)
> }
>
> --
> >>>>>>>>>> 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] XMPP API development in Scala

2016-10-07 Thread Akka Team
A quick google search doesn't turn up any Scala specific libraries so you
are probably best off using one of the Java libraries listed on the XMPP
homepage (http://xmpp.org/software/libraries.html) to interact with XMPP
from the JVM.

If you decide to use Akka Streams as the abstraction (which spontaneously
seems to make sense), make sure to check out the blog post series about
writing connectors on the Akka team blog:

http://blog.akka.io/integrations/2016/08/23/intro-alpakka
http://blog.akka.io/integrations/2016/08/29/connecting-existing-apis
http://blog.akka.io/integrations/2016/09/05/flow-control-at-the-akka-stream-boundary

--
Johan
Akka Team


On Mon, Sep 26, 2016 at 2:19 AM, Taran saini <taransain...@gmail.com> wrote:

> where to begin with and any powerful libraries for the same?
> Which concepts do we need to master for the same apart from the actor
> system.
> In short, the best approach to build xmpp apis.
>
> 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.
>

-- 
>>>>>>>>>>  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] Re: Organizing Route Directives

2016-10-07 Thread Akka Team
There are no requirements from Akka HTTPs side limiting how you create your
Route instances at all (Please let us know if the documentation says so
anywhere).

Additionally all built in directives are available statically.

So for extra clarity, you can (and likely should) do:

import static akka.http.javadsl.server.Directives.*;
...
  Route route = route(subrouteA, subrouteB, etc)

I notice the docs do inherit AllDirectives rather than importing statically
like this, and I have opened a ticket for further discussion about changing
that (ticket: https://github.com/akka/akka-http/issues/376)

The testkit only needs the Route instance, so again, no requirement to be
in a trait or any other construction setup there.

--
Johan
Akka Team


On Fri, Oct 7, 2016 at 12:15 PM, Richard Rodseth <rrods...@gmail.com> wrote:

> Isn't it true that your routes need to be in a trait t be able to make use
> of the Routing Testkit?
>
> On Fri, Oct 7, 2016 at 12:08 PM, <jpsteinm...@skydance.com> wrote:
>
>> Thank you for the response Johan but I'm not sure that really answers my
>> question but perhaps I can ask some other questions that may help to get
>> what I need.
>>
>> So far I have been operating on the assumption that I can have only one
>> route function at the top most level to define all of the routing
>> information for my server. This is due to the Http object taking in a
>> single route object during a bindAndHandle like so:
>>
>> ActorMaterializer materializer = ActorMaterializer.create(actorSystem);
>> final Flow<HttpRequest, HttpResponse, NotUsed> routeFlow = new 
>> RestApiDirectives().createRoute().flow(actorSystem, materializer);
>>
>> CompletionStage httpBinding = http.bindAndHandle(routeFlow, 
>> ConnectHttp.toHost(httpHost, httpPort), materializer);
>>
>>
>> This leads me to having a class that extends some directives class with a
>> single createRoute() function that contains all of the routing logic for
>> the entire server. Example:
>>
>> public class RestApiDirectives extends AllDirectives {
>> public Route createRoute() {
>> return ...;
>> }
>> }
>>
>>
>> So if I want to break out my route implementation into further classes
>> then how do I bring those new route functions into the main createRoute? So
>> far I've done it by a crazy chain of inheritance similar to how Akka does
>> it. However, just now I did try out simply calling *new *on the owning
>> class and making the function call instead. Example...
>>
>> public Route create() {
>> return route(
>> new SubsystemA().createRoute(),
>> new SubsystemB().createRoute(),
>> new SubsystemC().createRoute(),
>> new SubsystemD().createRoute()
>> );
>> }
>>
>>
>> This actually seems to work but feels as equally terrible as the crazy
>> chain of inheritance. Why? This is because any time I have an instance of a
>> class I assume there is some state information being maintained that
>> matters. If I need to instantiate an initial object to create a route it
>> stands to reason that any further work done inside that route needs to pass
>> along it's state to the next object instance to function correctly. The
>> fact that I can arbitrarily instantiate new objects with route functions
>> and call them means that there is no state being maintained across
>> instances that are unique to the original routing object. So then why are
>> the directives not simply static functions? It would be a whole lot simpler
>> to understand, organizationally, that I can create as many classes with
>> static routing functions as I want and simply chain them together. The
>> current approach just causes lots of confusion and considerable wasted
>> time, especially when there is no documentation or example code anywhere
>> that clearly states that you can link routing functions in this way.
>>
>> So I guess I've found my own answer here but please consider fixing the
>> documentation to make this information very clear and add some real world
>> examples in how a complicated routing structure can be achieved that goes
>> beyond a single class with one createRoute() function.
>>
>> Thanks for your time!
>>
>> On Friday, October 7, 2016 at 9:38:45 AM UTC-7, Akka Team wrote:
>>>
>>> In general, don't try to mimic the way it is done in Akka HTTP itself
>>> unless you actually have the same requirements.  (To support both mixin and
>>> static imports, dealing with both a Scala and Java API etc)
>>>
>>> Modularising the rou

Re: [akka-user] Re: [akka-stream] How to implement Spark's cogroup/join operation

2016-10-07 Thread Akka Team
If you groupBy with an upper bound of substreams at Int.MaxValue you can at
some point have more than 256 substreams, which is what you limit
mergeSubstreamsWithParallelism with, this means that it will backpressure
indefinitely (as none of the substreams will complete until upstream
completes and that is now being back pressured).

5 million tiny subflows with minimal processing each will be a lot of
overhead for materializing those substreams and will take a lot of memory
in addition to the large amount of memory you will need for actually
collect your values per key in memory.

GroupBy is likely not a good option for you to achieve this, I'd say a
custom graph stage would be the way to go if you need to do it with
streams, or just folding over some suitable datastructure where you can
collect elements per key.

--
Johan
Akka Team

On Thu, Sep 29, 2016 at 11:03 AM, Jakub Liska <liska.ja...@gmail.com> wrote:

> I'm trying to figure out why this is hanging/idling indefinitely :
>
> Source.fromIterator(() => Iterator.from(0).take(500).map(_ -> 1))
>   .groupBy(Int.MaxValue, _._1)
>   .mergeSubstreamsWithParallelism(256)
>   .runWith(Sink.seq)
>
> This is the only way how to avoid instantiating ridiculous amounts of sub
> streams.
>
> --
> >>>>>>>>>> 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 HTTP complete Future obtained from ask, with custom marshalling

2016-10-07 Thread Akka Team
To be fair you are doing something pretty complex with them, but I agree,
the magnet pattern definitely can be humbling.

Did the code that worked just fine earlier really deal with the exact same
type (tuple with statuscode and APIError)?

--
Johan
Akka Team

On Fri, Oct 7, 2016 at 1:30 PM, Richard Rodseth <rrods...@gmail.com> wrote:

> Heiko has a different approach here
> https://github.com/hseeberger/reactive-flows/blob/master/
> src/main/scala/de/heikoseeberger/reactiveflows/Api.scala
>
> onSuccess(flowFacade ? addFlow) {
> case bc: BadCommand => complete(BadRequest -> bc)
> case fe: FlowExists => complete(Conflict -> fe)
> case fa: FlowAdded => completeCreated(fa.desc.name, fa)
> }
>
> If I recall correctly, the right arrow is creating a tuple. This seems
> like a nice approach, though I suppose it also relies on the untyped nature
> of Ask
> In my case, if I try something like
>
> onSuccess(requestHandler ? NotificationsRequestHandler.AskForStatus) {
>
> case apiError: APIError => complete(StatusCodes.BadRequest ->
> apiError)
>
> ...
>
>   }
>
> my implicit conversions to ToResponseMarshallable aren't found, even
> though calling Marshall(reply).to[HttpResponse] a few lines earlier is
> just fine.
>
> Implicit conversions sure are humbling.
>
> On Fri, Oct 7, 2016 at 11:59 AM, Viktor Klang <viktor.kl...@gmail.com>
> wrote:
>
>> WARNING: I may very well be incorrect here
>>
>> Options:
>> A: switch to the onComplete directive
>> B: map to an Either[Result, PimpedResult]?
>>
>> On Fri, Oct 7, 2016 at 6:38 PM, Richard Rodseth <rrods...@gmail.com>
>> wrote:
>>
>>> That's the trouble. Depending on whether the actor calls withStatusCode,
>>> it could be a Result or a PimpedResult. Both can be marshalled.
>>>
>>> In the Spray application we completed the request inside a per-request
>>> actor. That is no longer possible, hence using Ask.
>>>
>>> On Fri, Oct 7, 2016 at 11:18 AM, Akka Team <akka.offic...@gmail.com>
>>> wrote:
>>>
>>>> Hi Richard,
>>>>
>>>> You can combine ask with mapTo to cast it to the right type (or fail
>>>> the future if it does not have that type), see the docs here:
>>>> http://doc.akka.io/docs/akka/2.4/scala/futures.html#use-with-actors
>>>>
>>>> --
>>>> Johan
>>>> Akka Team
>>>>
>>>> On Fri, Oct 7, 2016 at 10:55 AM, Richard Rodseth <rrods...@gmail.com>
>>>> wrote:
>>>>
>>>>> Continuing my struggles to port something we did with Spray, using
>>>>>
>>>>> // See https://bitbucket.org/binarycamp/spray-contrib/src
>>>>>
>>>>> I have resolved my implicit conversion errors to the point where I can
>>>>> execute the following (Result[T] is an alias for Either[APIError, T]):
>>>>>
>>>>>   val successResult: Result[NotificationsStatusDTO] =
>>>>> Right(NotificationsStatusDTO("foo"))
>>>>>
>>>>>   val successResponseFuture: Future[HttpResponse] = Marshal(
>>>>> successResult).to[HttpResponse]
>>>>>
>>>>>   val successResponse = Await.result(successResponseFuture, 1.second) //
>>>>> don't block in non-test code!
>>>>>
>>>>>   println(s"Success response $successResponse")
>>>>>
>>>>>   val successResult2: Result[NotificationsStatusDTO] =
>>>>> Right(NotificationsStatusDTO("foo"))
>>>>>
>>>>>   val resultWithStatusCode: PimpedResult[(StatusCode,
>>>>> NotificationsStatusDTO)] = successResult2.withStatusCode(
>>>>> StatusCodes.Accepted)
>>>>>
>>>>>   val successResponseWithStatusCodeFuture: Future[HttpResponse] =
>>>>> Marshal(resultWithStatusCode).to[HttpResponse]
>>>>>
>>>>>   val successResponseWithStatusCode = Await.result(successResponseWi
>>>>> thStatusCodeFuture, 1.second) // don't block in non-test code!
>>>>>
>>>>>   println(s"Success with status code $successResponseWithStatusCode")
>>>>>
>>>>> But I have not been able to figure out how to use the onSuccess
>>>>> directive (or another if more appropriate) if the response (either a 
>>>>> Result
>>>>> or a PimpedResult as above) is coming from an Ask.
>>>>>
>>>>&

Re: [akka-user] Re: WebSocket closed immediately after upgrade

2016-10-04 Thread Akka Team
Did you try running your source, sink and actor without Akka HTTP in a unit
test or such and verify that they work as you expect?

--
Johan
Akka Team

On Sat, Sep 24, 2016 at 3:25 AM, Dan Ellis <d...@danellis.me> wrote:

> Originally on 2.4.7, but I just checked with 2.4.10 and I get the same
> result.
>
> --
> >>>>>>>>>> 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] missing type akka.stream.impl.VirtualProcessor$WrappedSubscription$$SubscriptionState

2016-10-04 Thread Akka Team
Sounds like you may be mixing different versions of Akka modules, make sure
to use a single Akka version across the board.

--
Johan
Akka Team

On Mon, Sep 26, 2016 at 11:20 AM, <external.stefan.wach...@bosch-si.com>
wrote:

> Hi all,
>
>
>
> starting an application I see the following log output:
>
>
>
> [AppClassLoader@1f17ae12] error can't determine implemented interfaces of
> missing type akka.stream.impl.VirtualProcessor$WrappedSubscription$$
> SubscriptionState
>
> when processing declare parents akka.stream.impl.VirtualProcessor$
> WrappedSubscription$Buffering
>
> when processing type mungers
>
> when weaving
>
>
>
> What does this mean. Is this severe? What can be done about this?
>
>
>
> --Stefan
>
>
>
> --
> >>>>>>>>>> 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] some particular dead letters not being sent to eventstream.

2016-10-04 Thread Akka Team
Hi Sudeep,

That should not happen in any circumstance as far as I can see.

Are you sure your configuration to use the bounded mailbox is correct and
actually applies to the actor you are testing?

--
Johan
Akka Team


On Sun, Sep 11, 2016 at 7:24 AM, Sudeep Khemka <sudeep.ju...@gmail.com>
wrote:

> Hi
>
> I have an Actor 'A' with bounded mailbox  -
>
> *mailbox-type = "akka.dispatch.BoundedMailbox"*
>
> *mailbox-capacity = 5 *
>
> *mailbox-push-timeout-time = 0s*
>
>
> This Actor A on receiving messages sleeps for 5 seconds.
>
>
> Another actor B continuously sends messages to actor A, which should
> create deadletters.
>
> Sent messages are getting lost as expected however dead letter messages
> are not being logged.
>
>
> To be sure i have set *log-dead-letters = on*
>
>
> Also I created another eventStream listener  Actor - DeadLetterListener -
>  to listen for deadletters.
>
> But its not receiving any corresponding dead letters .
>
>
> So from this i am concluding these dead letters are not being sent to
> eventstream.
>
>
> In what scenarios this can happen?
>
>
> Thanks in advance
>
>
> -Sudeep
>
> --
> >>>>>>>>>> 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 scheduler

2016-10-03 Thread Akka Team
Hi Jose,

There are to few details in the provided code sample to say for sure, it
depends on what your Routing actor does when handleMessage returns and also
how your SpringExtension integration works.

--
Johan
Akka Team

On Tue, Sep 13, 2016 at 4:58 PM, José Diaz <jose.d...@joedayz.pe> wrote:

> Hi guys
>
> I am a newbie in akka.
>
> I am using scheduler for starts my supervisor.
>
> system.scheduler().schedule(Duration.Zero(),
> Duration.create(collectorInterval,---> 1 Minute
> TimeUnit.MINUTES), supervisor,
> Supervisor
> .START_COLLECTING,
> system.dispatcher(), null);
>
> The code of my Supervisor.java is here
> <https://gist.github.com/joedayz/d5dce6b5e578efb3b435dfa69da828d3>.
>
>
> My question is My actor with your child actors can finished in two or 10
> minutes by example.
>
> What happen when the new interval is reached?
> a) A new Supervisor is created?
>
> @Component
> @Scope("prototype")  --> I am using spring and set scope prototype for
> help with it.
> public class Supervisor
>
>
> b) None. Because the first Supervisor not finished.
>
> Thanks yours responses.
>
>
> Jose
>
>
> --
> >>>>>>>>>> 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] How to Increase (AKKA-HTTP Client) singleRequest response chuck size

2016-10-03 Thread Akka Team
Hi Tal,

The settings you reference are only about the maximum sizes before the
client fails rather than returning the response, it cannot affect how large
chunks the server returns. Additionally the the OS on the sending side,
network devices between the client and server and the receiving client can
make the chunks smaller.

Can you tell us a bit more about why you want larger chunks and maybe it
will be easier to give you some ideas about how you can achieve that?

--
Johan
Akka Team


On Wed, Sep 7, 2016 at 11:27 PM, Tal Beno <tal.b...@gmail.com> wrote:

> I am reading an HTTP Response stream from a URL. The response runForeach
> returns a stream of small chunks. I want to increase the chunk size.
>
>
> I have an application.conf file where I experimented with the following
> (increasing default values), but nothing changed. Wasn't sure which config
> param is the one I need. I must be doing something wrong.
>
>
> application.conf:
>
>
> akka.http.host-connection-pool.client.parsing.max-chunk-size=50m
> akka.http.host-connection-pool.client.parsing.max-chunk-ext-length=50m
> akka.http.host-connection-pool.client.parsing.max-content-length=50m
>
>
> my code:
>
>
> var config: Config = ConfigFactory.load()
> implicit val system = ActorSystem("test", config)import 
> system.dispatcherimplicit val materializer = ActorMaterializer()
> val responseFuture: Future[HttpResponse] = 
> Http().singleRequest(HttpRequest(uri = source))
>
> responseFuture.flatMap { response =>
>val responseData = response.entity.dataBytes
>responseData.runForeach(chunk => {
>  println(s"CHUNK:${chunk}")
>})}
>
>
> Thank you.
>
> --
> >>>>>>>>>> Read the docs: http://akka.io/docs/
> >>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/c
> urrent/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] the meaning of Actor.receive and context.become

2016-10-03 Thread Akka Team
Hi Bert,

There is no public access to the current behaviour of the actor in the API
so this you would have to implement yourself.

--
Johan
Akka Team

On Fri, Sep 30, 2016 at 3:07 AM, Bert Robben <bert.rob...@gmail.com> wrote:

>
> I'm puzzled by the meaning of Actor.receive() and context.become(..). I
> was under the impression that Actor.receive() gives you the partial
> function that determines how incoming messages are handled at this moment.
> context().become(...) allows you to replace that behavior by another one.
>
> But when I try to use this, it turns out that my assumption is incorrect.
> Apparently it seems that receive() returns the initial behavior of your
> actor, that is the partial function that you put in when you call
> receive(...). Calling context().become(...) doesn't change this receive(..)
> at all, it only changes the way your actor reacts to incoming messages. I
> then carefully reread the docs, and this is also what is explained there.
>
>
> But then again, I find this behavior confusing. For me, an actor only has
> one behavior. I provide the initial one with receive(..) and then change it
> using become(...). But I would like to have a way to get the current
> behavior such that I can easily extend it (using context.become(...)). Is
> there something like this in the current API? I know I can implement
> something myself for this, but this feels IMHO like something the framework
> should give me.
>
>
>
> Here's an example that shows all of this in action. When you run this, I
> was expecting to see as output: Received Hello, Received Hello again,
> Received A, Received Hello again. But you get: Received Hello, Received
> Hello again, Received A, Received Hello.
>
>
> public class BecomeActor extends AbstractActor {
>
> public BecomeActor() {
> receive(ReceiveBuilder
> .match(String.class, s -> {
> System.out.println("Received " + s);
> context().become(ReceiveBuilder.matchEquals(s, m -> {
> System.out.println("Received " + m + " again");
> }).build().orElse(receive()));
> })
> .matchAny(System.out::println)
> .build());
> }
>
> public static void main(String[] args) throws Exception {
> ActorSystem system = ActorSystem.create();
> ActorRef b = system.actorOf(Props.create(BecomeActor.class));
> b.tell("Hello", ActorRef.noSender());
> b.tell("Hello", ActorRef.noSender());
> b.tell("A", ActorRef.noSender());
> b.tell("Hello", ActorRef.noSender());
> Await.ready(system.whenTerminated(), Duration.Inf());
> }
> }
>
> thanks,
>
> Bert
>
> --
> >>>>>>>>>> Read the docs: http://akka.io/docs/
> >>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/c
> urrent/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 docker<->docker works fine with netty.tcp, but fails with artery - ideas?

2016-11-09 Thread Akka Team
Ah, sorry, didn't notice it in the command line.

Can you verify with some other tool that you can communicate using udp
between the nodes? (using netcat for example)

Set logs to debug to see if there is anything helpful in there.
Additionally artery contains a "flight recorder" which you can enable using
the setting akka.remote.artery.advanced.flight-recorder.enabled, it will
write artery related events to a binary logfile, which you can then feed to
akka.remote.artery.FlightRecorderDump in akka-remote to get human readable
output, it may also contain some hints about what/why/how it is not working.

--
Johan
Akka Team

On Wed, Nov 9, 2016 at 7:14 PM, <johan.kjolhede.bonniern...@gmail.com>
wrote:

> Yes - i Did. Please see my original post for details. You will see that I
> use the udp parameter for my docker port forwarding. Also please note that
> I've tested artery successfully in docker as long as one of the
> applications is running outside docker. However the problem occurs only
> when both producer and consumer run in containers. See the test results
> table and error log in my previous message for more details.
>
> /Johan
>
> --
> >>>>>>>>>>  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 docker<->docker works fine with netty.tcp, but fails with artery - ideas?

2016-11-09 Thread Akka Team
Hi Johan (good name!),

Artery/Aeron uses UDP, while the old remoting is TCP-based, did you
configure your docker nodes with udp port mappings?

--
Johan
Akka Team

On Wed, Nov 9, 2016 at 6:11 PM, <johan.kjolhede.bonniern...@gmail.com>
wrote:

> I'm pretty new to Akka and am currently trying out Akka's new Artery
> backend for akka-remoting (http://doc.akka.io/docs/akka/
> 2.4/scala/remoting-artery.html) while also testing the regular netty.tcp
> transport (http://doc.akka.io/docs/akka/2.4/scala/remoting.html).
>
> It looks fairly straight forward and I have two test applications running:
> * A producer application which sends a message to the consumer every 3
> seconds, and prints some stuff when the reply comes back
> * A consumer application which prints a message when it receives one, and
> then sends back a reply to sender()
>
> However I cannot get the communication to work when running both my
> applications with artery inside docker containers on the same host - it
> perfectly when I use netty.tcp though!.
> Below are the results I achieved:
>
> Results using artery
> Producer  Consumer  Result
> -
> IntelliJ  Dockerok
> DockerIntelliJ  ok
> IntelliJ  IntelliJ  ok
> DockerDockerfail (no message reaches the consumer, and the
> producer eventually prints handshake timeouts after 20 seconds/default
> timeout in akka-remote-artery - the same error message I get when not
> running any Consumer at all)
>
> Results using netty.tcp
> Producer  Consumer  Result
> -
> IntelliJ  Dockerok
> DockerIntelliJ  ok
> IntelliJ  IntelliJ  ok
> DockerDockerok
>
> As you see above, I got all combinations to work except when using artery
> to communicate between two local docker containers.
> The akka configurations for the failing artery case are as follows
>
> Consumer conf (prettified output of typesafe Config object logged):
> {
> "akka": {
> "actor": {
> "provider": "remote"
> },
> "remote": {
> "artery": {
> "bind": {
> "hostname": "0.0.0.0",
> "port": 12345
> },
> "canonical": {
> "hostname": "192.168.99.100",
> "port": 12345
> },
> "enabled": "on"
> }
> }
> }
> }
>
> Producer conf (prettified output of typesafe Config object logged):
> {
> "akka": {
> "actor": {
> "provider": "remote"
> },
> "remote": {
> "artery": {
> "bind": {
> "hostname": "0.0.0.0",
> "port": 12346
> },
> "canonical": {
> "hostname": "192.168.99.100",
> "port": 12346
> },
> "enabled": "on"
> }
> }
> }
> }
>
>
> 192.168.99.100 is the IP of my docker machine executing both containers.
> The equivalent netty.tcp config works fine (as seen in the results table
> earlier in this message)
>
> *However using artery I just get zero activity on the consumer, and
> eventually the producer starts logging errors:*
> [ERROR] [11/09/2016 16:24:17.201] 
> [producer-system-akka.remote.default-remote-dispatcher-6]
> [akka.remote.artery.Association(akka://producer-system)] Outbound message
> stream to [akka://consumer-system@192.168.99.100:12345] failed.
> Restarting it. Handshake with [akka://consumer-system@192.168.99.100:12345]
> did not complete within 2 ms 
> (akka.remote.artery.OutboundHandshake$HandshakeTimeoutException)
> after about 20 seconds, indicating what I assume is a timeout.
>
> When I use netty.tcp it works just fine between the containers.
> What is also strange is that it works with artery when I move one of the
> applications outside of a docker container. Both
>
> When running each application outside docker (e.g. from within intelliJ
> during development) they can communicate with each other fine, but as soon
> as I try to make them talk to each other with artery from docker container
> to docker container, no messages get through to the consumer
> Each application can be configured (cmd line args) to communicate with
> either netty.tcp or arter

Re: [akka-user] Website Correction / http://akka.io/docs/

2016-11-08 Thread Akka Team
For future reference the docs page on akka.io referred to (and the rest of
the akka.io site) is in the akka.github.com repo, here:
https://github.com/akka/akka.github.com/blob/master/_includes/download.html

The actual doc contents are in the akka and akka-http repos here:
https://github.com/akka/akka/tree/master/akka-docs
https://github.com/akka/akka-http/tree/master/docs

--
Johan
Akka Team

On Tue, Nov 8, 2016 at 6:35 AM, Gavin Baumanis <gavinbauma...@gmail.com>
wrote:

> I would have happily created a PR but i couldnt find the documentation in
> the github repo.
>
> If you wouldn't mind pointing me in the right direction I will gladly
> contribute to doc corrections as I find issues/ have suggestions.
>
> On 7 Nov 2016 3:56 PM, "Konrad Malawski" <konrad.malaw...@lightbend.com>
> wrote:
>
>> Thanks for the PR Ivan, it's so nice to see someone actively participate
>> in fixing things :-)
>> Yep, it's as Ivan said, small typo - now fixed.
>>
>> Cheers!
>>
>> --
>> Konrad `ktoso` Malawski
>> Akka <http://akka.io> @ Lightbend <http://lightbend.com>
>>
>> On 5 November 2016 at 11:03:36, Ivan Vyshnevskyi (sain...@gmail.com)
>> wrote:
>>
>> Hi,
>>
>> Thanks for reporting!
>>
>> I think that the issue is that `akka-http-testkit` wasn't moved to the
>> separate list with the rest of `akka-http` dependencies that are on their
>> own versioning scheme now (2.4.11 at the moment, 3.0/10.0 soon-ish).
>> I've opened a pull request [1] to fix that.
>>
>> But I suppose this won't be addressed until Monday.
>>
>> [1]: https://github.com/akka/akka.github.com/pull/348
>>
>> On 5 November 2016 at 18:32, Gavin Baumanis <gavinbauma...@gmail.com>
>> wrote:
>>
>>> Hi there everyone,
>>>
>>> Just a quick-fix for the information displayed at;
>>> http://akka.io/docs/
>>>
>>> "com.typesafe.akka" %% "akka-http-testkit" % "2.4.12"
>>> :s/2.4.12/2.4.11/g
>>> --
>>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>>> >>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/c
>>> urrent/additional/faq.html
>>> >>>>>>>>>> Search the archives: https://groups.google.com/grou
>>> p/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/c
>> urrent/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/c
>> urrent/additional/faq.html
>> >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
>> ---
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Akka User List" group.
>> To unsubscribe from this topic, visit https://groups.google.com/d/to
>> pic/akka-user/zgzi-svVY70/unsubscribe.
>> To unsubscribe from this group and all its topics, 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 can I check that MemberUp(m:Member) does not equal self actor?

2016-11-07 Thread Akka Team
Hi,

Cluster.selfAddress will give you the address of the actor system, and then
you can compare it to Member.address

--
Johan
Akka Team

On Mon, Nov 7, 2016 at 6:18 AM, Unknown Unknown <zx80l...@gmail.com> wrote:

> There is the following actor which belongs to cluster and is subscribed to
> cluster events:
>
>
> class Worker extends Actor {
>val cluster = Cluster(context.system)
>var router = Router(BroadcastRoutingLogic(), Vector.empty[
> ActorRefRoutee])
>
>override def preStart(): Unit =
>  cluster.subscribe(self, classOf[MemberEvent])
>
>override def postStop(): Unit = cluster.unsubscribe(self)
>
>
>def receive = {
>   ...
>   case MemberUp(m: Member)  =>
> val a = context.actorSelection(
>RootActorPath(m.address) / "user" / "worker")
>
> val isNotSelf:Boolean = ??? //TODO how to check m != self
> if(isNotSelf)
>router = router.removeRoutee(a).addRoutee(a)
>...
>}
> }
>
>
>
>
> In this case the Worker actor belongs to cluster, therefore it add to
> router itself.
>
> How can I check that `MemberUp(m:Member)` does not equal `self` actor (see
> TODO in above code)?
>
> I use akka 2.4.12.
>
> The same question at http://stackoverflow.com/questions/40453413
>
> --
> >>>>>>>>>> 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] StreamSupervisor name

2016-11-11 Thread Akka Team
AbruptTerminationException happens when the actor running the stream (the
"graph interpreter") is terminated without the stream first completing or
failing, for example if terminating an actor system with a running stream
in it.

The paths of the supervisors are pretty much an implementation detail, but
perhaps you can provide some addition to the string "end-of-lookup" to give
you context in the log entry?

--
Johan
Akka Team

On Wed, Nov 9, 2016 at 6:33 PM, Richard Rodseth <rrods...@gmail.com> wrote:

> I'm trying to write two ScalaTest tests to compare two approaches to
> driving a Flow that sends out emails. In one approach the flow is sourced
> using eventsByTag from akka-persistence-query. In the other, I uses
> SourceQueue.offer after receiving a message via AtLeastOnceDelivery. The
> test ends with a check of mock JavaMail mailbox size.
>
> eventually {
>
>   mailBoxSize("ema...@foo.com") should be(expectedEmails)
>
> }
>
> eventually {
>
>   mailBoxSize("ema...@foo.com") should be(expectedEmails)
>
> }
>
> The test that uses eventsByTag to drive the flow succeeds with 1
> events. The one that uses SourceQueue.offer gets stuck at 11. In the flow
> below, the println appears 12 times but the log("end-of-lookup") only
> appears 11 times.
>
>   def flowLookupEmails()(implicit lookup: EmailsByDefinition, ec:
> ExecutionContext): Flow[AlarmOccurrence, AlarmOccurrenceWithRecipients,
> NotUsed] = {
> val parallelism = 5
> val result = Flow[AlarmOccurrence].mapAsync(parallelism) { occurrence
> =>
>   val emailsF: Future[List[String]] = lookup.recipientsForDefinition(
> occurrence.definitionId)
>   val lookupResult: Future[AlarmOccurrenceWithRecipients] =
> emailsF.map { emails =>
> println(s"# Found emails $emails")
> AlarmOccurrenceWithRecipients(occurrence, emails)
>   }
>
>   lookupResult
> }
> .log("end-of-lookup").withAttributes(Attributes.logLevels(onElement =
> Logging.InfoLevel))
> .named("lookup-emails")
> result
>   }
>
> When I turn on DEBUG logging, I get a lot of noise, but do see
>
> [DEBUG] [11/09/2016 08:58:02.827] [OccurrencesIntegrationSpec-
> akka.actor.default-dispatcher-12] [akka://OccurrencesIntegrationSpec/
> user/StreamSupervisor-3/flow-25-0-unknown-operation] stopped
>
> [ERROR] [11/09/2016 08:59:02.455] [OccurrencesIntegrationSpec-
> akka.actor.default-dispatcher-21] [akka.stream.Log(akka://
> OccurrencesIntegrationSpec/user/StreamSupervisor-0)] [end-of-lookup]
> Upstream failed. (akka.stream.AbruptTerminationException)
> Any ideas? What are some good techniques to find the cause of the
> AbruptTerminationException, or name the StreamSupervisors so I know which
> stream they are associated with?
>
> 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.

-- 
>>>>>>>>>>  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] Re: Akka persistence query examples

2016-11-11 Thread Akka Team
One option would be to use a persistent actor as your read side as well,
store the last offset you have seen and stream from after that offset when
the actor has recovered completely, this way you can also provide snapshots
(and possible delete the actor to replay the entire history into a view
after adding functionality for example).

Another could be to persist the read side in some other way, a relational
database for example and do queries against that.

--
Johan
Akka Team

On Wed, Nov 9, 2016 at 5:34 PM, Juan Carlos Roig <jcr...@gmail.com> wrote:

> Hi everyone. Just waking up this thread (once again) with a related
> challenge/question
>
>
> I'm used to use PersistentView for my read model before they got
> deprecated.
>
> I have a CQRS architecture where both write and read sides are cluster
> singleton. In write side I use persistent actors to validate and store the
> events and then those events get replayed to the persistent views on the
> other sharded cluster. Those persistent views process the events and keep
> the read model in memory, so queries are sent to them and they respond
> accordingly. This is very easy to do as akka persistence takes care of
> actors initialisation both at persistent actors and views so that in case
> any actor gets restarted or rebalanced by the cluster it will be started
> and initialized recovering its previous state by using snapshots and events
> replay before processing any new incoming message.
>
> I'm trying to do the same using persistent query but I'm having some
> problems.
>
> I'm creating the persistent query inside the actor view and send the
> events to itself.
>
> Example:
>
> class DefaultAccountView extends Actor with ActorLogging {
>   implicit val mat = ActorMaterializer()(context.system)
>   implicit val ec = context.dispatcher
>
>   val aggregateId = context.self.path.name
>
>   def persistenceId: String = s"AccountAggregate$aggregateId"
>
>   // Configure Persistence Query
>   val queries = PersistenceQuery(context.system).readJournalFor[
> LeveldbReadJournal](LeveldbReadJournal.Identifier)
>
>   val events = queries.eventsByPersistenceId(persistenceId, 0L,
> Long.MaxValue)
>   .map(eventEnvelope => eventEnvelope.event)
>   .to(Sink.actorRef(self, StreamCompleted))
>   .run()
>
>
>   def handleAccountQueries: Recevice = {
> case Query1 =>
>   // Process query 1
> case Query 2 =>
>   // Process query 2
>   }
>
>
>   def handleEvents: Receive = {
> case Event1 =>
>   // process event 1 update state
>
>   case Event2 =>
> // process event 2 update state
>
>   }
>
>
>   override def receive: Receive = handleAccountQueries orElse handleEvents
> }
>
> In that case the stream will be created every time the actor gets started
> and will replay all events. The problem is that being an actor belonging to
> a sharded cluster it will be started the first time it gets a message, that
> is, a query. What happens is the first message always gets processed before
> all events are replayed and hence it fails to give correct response as the
> state is not initialised, in other words, there's no initialisation
> lyfecycle like PersistentView has. I tried to use a custom object to signal
> the end of the stream (StreamCompleted) but obviously it is never sent as
> the stream never finishes (it keeps opened sending events generated in real
> time, which is what we need to keep the view updated). On a side note, it
> will be very nice to be able to easily use snapshots here too as replay all
> events every time the view starts might take a lot of time for high load
> actors.
>
> Is there any way to do this overcoming these problems?
>
> Shall I continue using PersistentView instead although they're deprecated?
>
> How are you guys propose to implement this use case if persistent views
> are deprecated?
>
> Regards,
>
> J. Carlos
>
> --
> >>>>>>>>>> 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

Re: [akka-user] Re: Replaying journal events without actually recovering Actors?

2016-10-14 Thread Akka Team
ctor = system.actorOf(Props(new LamePersistActor))
>> lameActor ! 'whoapersist
>> Thread.sleep(1000)
>> val readJournal = 
>> PersistenceQuery(system).readJournalFor[LeveldbReadJournal](
>>   LeveldbReadJournal.Identifier)
>> implicit val mat = ActorMaterializer()(system)
>> for (i <- 1 to 3) {
>>   Thread.sleep(2000)
>>   val allPersistenceIDs = readJournal.allPersistenceIds()
>>   val dafuq = 
>> readJournal.eventsByPersistenceId(PersistCompatIT.lamePersistActorID)
>>   println("Found persistence IDs:")
>>   allPersistenceIDs.map { e =>
>> println(e)
>> e
>>   }
>>   dafuq.map { e =>
>> println(e.event)
>> e
>>   }
>> }
>>   }
>> }
>>
>>
>> --
> >>>>>>>>>> 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 Team
Lightbend <http://www.lightbend.com/> - Reactive apps on the JVM
Twitter: @akkateam

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


Re: [akka-user] Resumable Projection

2016-11-18 Thread Akka Team
Hi Richard,

This is not handled by streams itself as it is a feature that Sources must
support. I think the most common solution people use for this is Kafka.
There is a Streams connector for Kafka:
https://github.com/akka/reactive-kafka

-Endre

On Tue, Nov 15, 2016 at 3:04 AM, Richard Rodseth <rrods...@gmail.com> wrote:

> Any good examples out there of resumable projections driving non-trivial
> streams?
>
> I'm guessing I will have to keep the stream 1-1 and pass the offset all
> the way downstream so I can save it at the end?
>
>
> --
> >>>>>>>>>> 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 Team
Lightbend <http://www.lightbend.com/> - Reactive apps on the JVM
Twitter: @akkateam

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


Re: [akka-user] `ActorSystem.whenTerminated` hangs indefinitely if called from an `registerOnTermination` callback

2016-11-15 Thread Akka Team
Hi Chris,



On Tue, Nov 15, 2016 at 1:46 PM, oxbow_lakes <oxbowla...@gmail.com> wrote:

> The following code:
>
> Welcome to Scala 2.12.0 (Java HotSpot(TM) 64-Bit Server VM, Java
> 1.8.0_112).
> Type in expressions for evaluation. Or try :help.
>
>
> scala> import akka.actor._; import scala.concurrent._; import duration._
> import akka.actor._
> import scala.concurrent._
> import duration._
>
> scala> :paste
> // Entering paste mode (ctrl-D to finish)
>
> val s = ActorSystem("test")
> def onTerm = {
>   println("Waiting...")
>   Await.result(s.whenTerminated, Duration.Inf)
>   println("Fin!")
> }
> s.registerOnTermination(onTerm)
>
> // Exiting paste mode, now interpreting.
>
> s: akka.actor.ActorSystem = akka://test
> onTerm: Unit
>
> scala> s.terminate
> res1: scala.concurrent.Future[akka.actor.Terminated] = Future( completed>)
>
> scala> Waiting...
>
>
> At this point the future doesn't terminate. Looking at the documentation
> of *whenTerminated*; "Returns a Future which will be completed after the
> ActorSystem has been terminated and termination hooks have been executed".
> It's probably a good idea to indicate on the *registerOnTermination*
> method that it's dangerous to wait on the whenTerminated future from the
> callback.
>

Can you please file a ticket, or even better a PR to fix the relevant docs?

-Endre



>
>
> Chris
>
> --
> >>>>>>>>>> Read the docs: http://akka.io/docs/
> >>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/
> current/additional/faq.html
> >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
> ---
> You received this message because you are subscribed to the Google Groups
> "Akka User List" group.
> To unsubscribe from this group and stop receiving 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 Team
Lightbend <http://www.lightbend.com/> - Reactive apps on the JVM
Twitter: @akkateam

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


Re: [akka-user] Re: BidiFlow from custom GraphStage join connection pool flow

2016-10-28 Thread Akka Team
Hi,

Yes, exactly that happens, great that you figured out. I recommend looking
at our blog series about custom stages to understand better how to design
stages. While this post is about parsing XML, it actually has quite a bit
of information on how to attack custom stage design (which is independent
of XML):
http://blog.akka.io/integrations/2016/09/16/custom-flows-parsing-xml-part-1

-Endre

On Thu, Oct 27, 2016 at 11:23 PM, Vay Ngo <vay@gmail.com> wrote:

> Figured it out.  In my custom Bidi, I needed to override the default
> onUpstreamFinish() and onDownStreamFinish() methods on the in/out handlers,
> since by default they complete the entire stage (i.e. the whole Bidi).
> This meant that the completion of the requestIn port (invoked after the
> single message from the source was received), the stage was completed
> before the message could flow through the response flow.  The fixed code is
> pasted below:
>
> override def createLogic(inheritedAttributes: Attributes): GraphStageLogic = 
> new GraphStageLogic(shape) {
>   setHandler(requestIn, new InHandler {
> override def onPush(): Unit = {
>   push(requestOut, grab(requestIn))
> }
> override def onUpstreamFinish() = complete(requestOut)
>   })
>
>   setHandler(requestOut, new OutHandler {
> override def onPull(): Unit = {
>   pull(requestIn)
> }
> override def onDownstreamFinish() = cancel(requestIn)
>   })
>
>   setHandler(responseIn, new InHandler {
> override def onPush(): Unit = {
>   val msg = grab(responseIn)
>   push(responseOut, msg)
> }
> override def onUpstreamFinish() = completeStage()
>   })
>
>   setHandler(responseOut, new OutHandler {
> override def onPull(): Unit = {
>   pull(responseIn)
> }
> override def onDownstreamFinish() = cancel(responseIn)
>   })
> }
>
>
>
> --
> >>>>>>>>>> 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 Team
Lightbend <http://www.lightbend.com/> - Reactive apps on the JVM
Twitter: @akkateam

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


Re: [akka-user] Re: Is back pressure triggered upon exceptions

2016-10-28 Thread Akka Team
Hi Kunal

Streams supervision in its current state is not very usable. Some stages
support resume, others do not. If you want to tolerate exceptions at your
domain level then you likely need to stream elements of type Try[T] instead
or create custom stages that deal with errors.

As for 3. there is a mathematical model that perfectly fits streams:
well-formed free-choice Petri-nets. Well, to be precise, they can model
streams to a large extent.

-Endre

On Tue, Oct 18, 2016 at 9:09 PM, Kunal Deshpande <space...@gmail.com> wrote:

> Thanks Johannes for your feedback,
>
> For pt. 2 I am handling errors using Supervision.Resume so the stream
> should technically continue and not complete with an error, correct?
>
> Dagny -
>
> 1. It is unclear what your graph looks like and how you are materializing
> the value, also which supervision strategy you are employing (default is
> Supervision.Stop) so your stream will complete with an exception which
> means a failed Try with exception from event 2 (basically the first
> exception that causes the stream to fail).
>
> 2. I think you are alluding to recovery strategies here, I would suggest
> reading documentation on Supervision strategies to handle errors and
> potentially recover from them. Also, you can use recover / recoverWith ops
> to handle any errors and gracefully complete the stream (these can be
> applied to individual stream stages).
>
>
>
>
> On Sunday, September 25, 2016 at 11:44:40 PM UTC-7, Dagny T wrote:
>>
>> Hi Kunal and Johannes,
>>
>> THANKS for your posts on this -- as I was also wondering how
>> exception-handling mid-Flow is supposed to work!
>>
>> Followup questions for you, please:
>>
>> - Let's say for simplicity that we have only 3 events flowing through a
>> Streaming Flow with 5 Stages.
>> - We put a Try block around the myGraph.run() materialization
>> - Then, say an exception happens on Stage 3, and Event 2.
>>
>> 1) Does this mean that the resulting Try collection will contain:
>> - Success w Result from Event 1, all Stages
>> - Failure w Exception from Event 2, Stage 3
>> - NOTHING for Event 3; as Materialized Graph would have just stopped on
>> an exception
>>
>> 2) Does this then imply that Source has to somehow know Events 2,3 got
>> dropped via the UUID of Event- last processed;
>> then it has to re-stream those to the Sink?
>>
>> Please let me know if I'm understanding those two points correctly!
>>
>> THANKS!
>> D
>>
>> On Wednesday, September 14, 2016 at 10:49:18 PM UTC-7, Kunal Deshpande
>> wrote:
>>>
>>> Hi,
>>>
>>> I have been using Akka streams to implement a saved-search refresh
>>> system as well as a notification processing system at my current company.
>>>
>>> Recently we ran into a fast-publisher & slow subscriber problem where
>>> the downstream HTTP services were taking a long time to respond resulting
>>> in Timeout exceptions in our client. Currently we simply drop the event and
>>> resume the stream using Supervision.Resume but I am unsure whether that
>>> translates into back pressure.
>>>
>>> Few questions on back pressure
>>> 1. While using Flows in akka-streams using .via will a downstream flow
>>> apply back pressure to a flow upstream or is back pressure only signaled to
>>> a Source?
>>> 2. Will exceptions in a Flow trigger back pressure
>>> 3. Is there a mathematical way to represent back pressure and is it
>>> consistent across different reactive streams implementations?
>>>
>>> Thanks, and really appreciate your time!
>>>
>>> Kunal
>>>
>> --
> >>>>>>>>>> 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 Team
Lightbend <http://www.lightbend.com/> - Reactive apps on the JVM
Twitter: @akkateam

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


Re: [akka-user] Failing to see router configuration when using context.ActorOf(FromConfig.props(Props[LogWorker]),"logWorker")

2016-10-28 Thread Akka Team
Hi,

I think you need a double-star there (**), since the actor is deeper down
in the hierarchy.

-Endre

On Fri, Oct 21, 2016 at 3:38 PM, <mnielsen...@gmail.com> wrote:

> I would be grateful for some help with this Akka configuration question.
> This is probably something obvious, but I've been googling and looking at
> for a day or two and have not yet come up with an answer.
>
> Checking the name of the ActorSystem at the top of RCStreamReceiver shows
> that it is indeed the expected "fubar".
>
> My `ActorSystem` is created thus:
>
>
>  val config = ConfigFactory.load("akka.conf")
>  implicit val system = ActorSystem("fubar", config)
>
>
> The classloader sees my configuration file since changes to logging levels
> take effect.
>
> After creating the `ActorSystem`, my code does the following:
>
>
>val mpr = system.actorOf(Props[ProcessingFlow])
>
>
> In the `ProcessingFlow` the following:
>
>val actorSink: Sink[PackedRecord, ActorRef] = Sink.actorSubscriber(
> Props[RCStreamReceiver])
>
>
> In `RCStreamReceiver` the following:
>
>  val logWorkers = context.actorOf(FromConfig.props(Props[LogWorker]),
> "logWorker")
>
>
> Yet, I get the following:
>
>
>Configuration missing for router [akka://fubar/user/$a/
> StreamSupervisor-0/flow-3-2-actorSubscriberSink/logWorker] in
> 'akka.actor.deployment' section.
>
>
>
> This in spite of my config file looking like this:
>
> akka {
>   loggers = ["akka.event.slf4j.Slf4jLogger"]
>   loglevel = "WARNING"
>   logging-filter = "akka.event.slf4j.Slf4jLoggingFilter"
>   logger-startup-timeout = 15s
>   actor {
> provider = "akka.cluster.ClusterActorRefProvider"
> debug {
>   log-config-on-start = off
>   autoreceive = off
>   lifecycle = off
>   unhandled = on
>   event-stream = off
> }
> deployment {
>   default-dispatcher {
> fork-join-executor {
>   parallelism-min = 8
> }
>   }
>
>   /"*"/logWorker = {
> router = balancing-pool
> nr-of-instances = 5
> executor = "thread-pool-executor"
> thread-pool-executor {
>   core-pool-size-min = 5
>   core-pool-size-max = 5
> }
>   }
>
>
>   /"*"/editWorker = {
> router = balancing-pool
> nr-of-instances = 5
> routees.paths = ["/foo/editWorker"]
>   }
>
>
>   /"*"/unknownWorker = {
> router = balancing-pool
> nr-of-instances = 5
> routees.paths = ["/foo/unknownWorker"]
>   }
> }
>   }
> }
>
>
>
> --
> >>>>>>>>>> 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 Team
Lightbend <http://www.lightbend.com/> - Reactive apps on the JVM
Twitter: @akkateam

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


Re: [akka-user] graph control events propagation

2016-10-28 Thread Akka Team
Hi,

The explanation is that you use Source.empty which immediately completes
the stream. Since you overrode onUpstreamFinish() to ignore this
completion, it just gets stuck. Below your broken stage there are no
timeouts (timeouts don't apply to a whole stream, only to that exact
communication point where they are injected).

So the events are:
 1. Source.empty completes stream
 2. Completion is stuck at BrokenStage
 3. KillSwitch abort arrives in emptyness as stream is no longer running on
that upper half, only below BrokenStage
 4. Sink.last times out since no element is present and nothing is completed

If you replace Source.empty with Source.maybe (which does not immediately
close the stream, only once its materialized Promise is completed with a
None).

Once you done that, the Await.result will correctly throw the
RuntimeException("boom").

So everything works as designed :D

-Endre


On Tue, Oct 18, 2016 at 9:43 PM, Kyrylo Stokoz <k.sto...@gmail.com> wrote:

> Hi Akka Team, All,
>
> I have few custom stages, recently i find out that one of them under
> certain conditions was not properly completing graph stage, which was
> causing graph to run forever.
> I have timeouts attached to graph and would expect it to fail with timeout
> but it never happened. I created a simple reproducer (below).
>
> I have a BrokenStage that is not completing stage in onUpstreamFinish method
> and i have a graph which has idleTimeout, completionTimeout and killSwitch
> attached. None of this has an effect on the graph it fails with future
> timeout.
>
> I understand that this is developer issue and if i move any of timeouts
> after broken stage it will work as expected.
> My questions would be:
>
> 1. I would still expect killSwitch or completion timeout to fail the
> graph, why it is not a case?
> 2. how i can detect such things / safely attach timeouts to graphs?
>
> Reproducer:
> import akka.actor.ActorSystem
> import akka.stream._
> import akka.stream.scaladsl.{Keep, Sink, Source}
> import akka.stream.stage.{GraphStage, GraphStageLogic, InHandler, OutHandler}
>
> import scala.concurrent.Await
> import scala.concurrent.duration._
>
>
> case class BrokenStage[A](name: String) extends GraphStage[FlowShape[A, A]] {
>   val in = Inlet[A]("in")
>   val out = Outlet[A]("out")
>   override val shape: FlowShape[A, A] = FlowShape(in, out)
>
>   override def createLogic(inheritedAttributes: Attributes): GraphStageLogic 
> = new GraphStageLogic(shape) {
> setHandler(in, new InHandler {
>   override def onPush(): Unit = {
> println(s"$name: onPush")
> push(out, grab(in))
>   }
>   override def onUpstreamFinish(): Unit = {
> println(s"$name: onUpstreamFinish")
>   }
>   override def onUpstreamFailure(ex: Throwable): Unit = {
> println(s"$name: onUpstreamFailure: ${ex.getMessage}")
> super.onUpstreamFailure(ex)
>   }
> })
> setHandler(out, new OutHandler {
>   override def onPull(): Unit = {
> println(s"$name: onPull")
> pull(in)
>   }
>   override def onDownstreamFinish(): Unit = {
> println(s"$name: onDownstreamFinish")
> super.onDownstreamFinish()
>   }
> })
>   }
> }
>
> object Example {
>
>   implicit val actorSystem = ActorSystem()
>   implicit val ec = actorSystem.dispatcher
>   implicit val materializer = ActorMaterializer()
>
>   def main(args: Array[String]): Unit = {
> val source = Source.empty[Int]
> val sink = Sink.last[Int]
>
> val (killSwitch, last) =
>   source
> .idleTimeout(10.second)
> .completionTimeout(20.seconds)
> .viaMat(KillSwitches.single)(Keep.right)
> .via(new BrokenStage("after"))
> .toMat(sink)(Keep.both)
> .run()
>
> Thread.sleep(1000)
> killSwitch.abort(new RuntimeException("boom!"))
>
> Await.result(last, 25.second)
> sys.exit(-1)
>   }
>
> }
>
> --
> >>>>>>>>>> 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://gr

Re: [akka-user] Strange test failure in `Flow.filter(..)` with test-kit TestSink

2016-10-28 Thread Akka Team
Hi Alexey,

Isn't the issue is that you don't request enough elements? You have both ls
and ri lists, but you only demand ri.size count.

-Endre

On Fri, Oct 21, 2016 at 4:34 PM, Alexey Shuksto <seig...@gmail.com> wrote:

> Hello hAkkers,
>
> Consider this simple test (scalatest 3.0.0, scalacheck 1.13.2 and
> akka-streams-testkit 2.4.11 is used):
>
>   describe("Either") {
> implicit def noShrink[T]: Shrink[List[T]] = Shrink.shrinkAny
>
> it("should filter 'Either.Left(..)' objects") {
>
>   forAll("left", "right.head", "right.tail") { (ls: List[String], rh:
> Int, rt: List[Int]) ⇒
> val ri = rh :: rt
>
> // Will fail if last element is not Right(...)
> val source: List[Either[String, Int]] = ls.map(Left[String, Int])
> ::: ri.map(Right[String, Int])
>
> val (pub, sub) = TestSource.probe[Either[String, Int]]
>   .via(Flow[Either[String, Int]].filter(_.isRight).map { case
> Right(i) ⇒ i })
>   .toMat(TestSink.probe[Int])(Keep.both)
>   .run()
>
> sub.request(ri.size.toLong)
>
> source.foreach(pub.sendNext)
> sub.expectNextUnorderedN(ri)
>
> pub.sendComplete()
> sub.expectComplete()
>   }
> }
>   }
>
>
> This test will fail with `Message: assertion failed: timeout (3 seconds)
> during expectMsg while waiting for OnComplete` as soon as we change the
> order of `ls` and `ri` lists (or add some shuffle to it):
>
> val source: List[Either[String, Int]] = ri.map(Right[String, Int]) ::: ls.
> map(Left[String, Int])
>
>
> Actually, it will fail as soon as latest element in Source is not
> `Right(..)`. Seems to me that leftover `Left` elements in Source do not
> allow TestSink.probe to receive onComplete message.
>
> Is there any way to prevent that fail or is it normal and expected
> behavior?
>
> --
> >>>>>>>>>> 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 Team
Lightbend <http://www.lightbend.com/> - Reactive apps on the JVM
Twitter: @akkateam

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


Re: [akka-user] Unidirectinoal WebSocket in Java

2016-10-28 Thread Akka Team
Hi,

The Websocket API accepts a Flow(since it is bidirectional). You need to
pass in at least a Sink.ignore() on the read side to signify that you don't
intend to read anything from the websocket.

-Endre

On Fri, Oct 21, 2016 at 7:04 PM, <jpsteinm...@skydance.com> wrote:

> Hi,
>
> I am trying to set up a unidirectional websocket connection using the Java
> DSL to create a server-push mechanism.
>
> I am currently struggling with converting the Source to a proper Graph
> that UpgradeToWebSocket.handleMessagesWith() can accept.
>
> Here is what I have so far:
>
> public Route createRoute() {
> return route (
> headerValueByType(UpgradeToWebSocket.class, (upgradeToWebSocket) ->
> extractActorSystem(actorSystem -> {
> Source<Message, ActorRef> pubSource = 
> Source.actorPublisher(MyActorPublisher.props());
> Graph<SourceShape, ?> wsSource = ??;
> ...
> return upgradeToWebSocket.handleMessagesWith(null, wsSource); 
> // This doesn't return a proper route
> })
> ),
> reject()
> );
> }
>
>
> I tried using GraphDSL.create() but that created an incompatible
> SourceShape. Any help is appreciated.
>
> Thanks!
>
> Jean-Philippe Steinmetz
>
> --
> >>>>>>>>>> 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 Team
Lightbend <http://www.lightbend.com/> - Reactive apps on the JVM
Twitter: @akkateam

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


Re: [akka-user] [akka-cluster]How is the Terminate message issued to its watcher if wachee is closed during the unreachable period?

2016-10-28 Thread Akka Team
Hi,


On Mon, Oct 24, 2016 at 6:42 PM, <fh...@mails.tsinghua.edu.cn> wrote:

> Hi guys,
> I'm recently studying the source code of akka-cluster and there's
> something that I really cannot understand.
> Actually, I was trying to reproduce what akka-cluster document said "If
> system messages cannot be delivered to a node it will be quarantined and
> then it cannot come back from unreachable". So I've down these steps:
>
>1. Create Actor A on node1, Actor B on node2;
>2. Let A watch B;
>3. Cut the wire between node1 and node2;
>4. Let B send a user message, namely UMSG, to A;
>5. Close B, and I've seen that Actor B tried to send a message with
>type DeathWatchNotification;
>6. Reconnect node1 and node2, and the cluster "revived" with both
>nodes had changed state of each other from UNREACHABLE to UP;
>7. ActorA immediately received Terminated message from ActorB, while
>it didn't receive the user message (UMSG, see Step4) from B.
>
>
Yes, this is exactly how it should work. User messages have no guaranteed
delivery, and hence they are simply dropped during connection problems.
System messages (like Watch and DeathWatchNotification) on the other hand
are buffered until they are acknowledged by remote system. Once the
connection comes back, they are attempted to be redelivered (as you see at
step 7).

So what happens
  2. Watch sent from A to B and acknowledged as received by B
  4. UMSG is dropped as connection is severed
  5. DeathWatchNotification is attempted to be sent by B, but ack does not
arrive
  7. above DWN is resent, processed by actor A and acknowledged the
reception of the message


> Here is my questions
>
>1. DeathWatchNotification is also a kind of system message, and, which
>might not be true, it failed issuing to its watcher. According to the
>document mentioned above, the state of the node containing the watcher
>actor should have been put to DOWN, but it didn't. Why is this? Where can I
>find the code related to this behavior?
>
> This is a misunderstanding. System message delivery is only considered
failed once all the buffer space designated for containing system messages
for redelivery are depleted. Otherwise these messages are kept around for a
long time. If a remote system is not responding for a long time then it is
considered dead. This can happen in two ways:
 - In ordinary remoting DeathWatch is sending heartbeats between systems of
the watcher and watchee. If a limit is reached (watch-failure-detector)
then the remote system is considered dead, is quarantined and all system
messages are dropped, and watched actors declared dead.
 - if cluster is used (your case), cluster nodes monitor each other via
heartbeats, and if there are missed heartbeats from a system, members
designate that as unreachable. This is not the final state and recoverable,
it is only if a system is DOWN-ed when it is deemed dead, and watcher
actors are informed of this fact. DOWNing can be manual, programmatic, or
by using auto-downing:
http://doc.akka.io/docs/akka/2.4/scala/cluster-usage.html#Auto-downing__DO_NOT_USE_


>
>1. Who is the real actor that sends this Terminated system message?
>
> It is converted to a user message from the DWN system message.



>
>1. I've noted that in akka-cluster both system message and user
>message are delivered in a same way using akka-remote. So why is UMSG
>dropped but Terminated received?
>
> See above.



>
> Thanks for helping in advance
> Hangyu
>
> --
> >>>>>>>>>> Read the docs: http://akka.io/docs/
> >>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/c
> urrent/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 Team
Lightbend <http://www.lightbend.com/> - Reactive apps on the JVM
Twitter: @akkateam

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


Re: [akka-user] Cluster Sharding custom routing

2016-12-13 Thread Akka Team
Hi Luis,

Sharding allows for a custom ShardAllocationStrategy, which has two
purposes: allocating new shards and taking decisions about rebalancing.
Maybe this could cover what you want to do. (See API here:
http://doc.akka.io/api/akka/2.4/#akka.cluster.sharding.ShardCoordinator$$ShardAllocationStrategy
)

--
Johan Andrén
Akka Team

On Tue, Dec 6, 2016 at 7:13 PM, Luis Pedrosa <lpedros...@gmail.com> wrote:

> Hello!
>
>
> From what I understand, the cluster sharder GracefulShutdown
> implementation, removes the node from the cluster. It also signals all the
> remaining nodes to buffer any messages that target shards already allocated
> on the given node.
>
>
> I believe this is because the use case assumes that you will migrate the
> entities accordingly before the node is removed from the cluster.
>
>
> I have a different use case in mind. I would like to signal the sharder
> that a node shouldn't be considered for any new allocation. However, It
> should still be able to accept any message for pre-allocated shards.
>
>
> The reason is that my entities are not ready for persistence (something I
> would like to address at a later stage). Given that, migrating them is not
> a desirable option.
>
>
> I was wondering, is there a way to make this use case work with the
> cluster sharder mechanics?
>
> Should I consider implementing a simple clustered routing solution that
> satisfies our use case?
>
> Or is there another solution provided by the akka-cluster extensions that
> I should be looking at?
>
>
> In conclusion, on the ClusterSharder, a new shard is allocated to a node
> that is currently up. I would like to control this allocation, for a given
> node:
>
>- By still being able to accept messages for shards that are already
>allocated in the node
>- By not allowing any new shards to be allocated in the node
>
> Thank you 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.

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


<    2   3   4   5   6   7   8   >