[akka-user] Re: Using ActorPublisher without ActorSubscriber

2016-03-09 Thread Simão Mata
Here is the code for my actor: 
https://gist.github.com/simao/3003ee256751cfb7b2f7

If i put a log message on `deliverBuf` then I see that this method gets 
called for each event, but totalDemand is always 0.

Thank you for your help.

Simao



On Wednesday, March 9, 2016 at 10:41:13 PM UTC+1, Rafał Krzewski wrote:
>
> Your actor is supposed to receive ActorPublisherMessage.Request message 
> after the stream is materialized. At this point totalDemand should be > 0 
> and you are allowed to call onNext
>
> Can you show the code of your publisher actor?
>
> Cheers,
> Rafał
>
> W dniu środa, 9 marca 2016 13:48:27 UTC+1 użytkownik Simão Mata napisał:
>>
>> Hello,
>>
>> I think I misunderstand the usage of ActorPublisher. I read the 
>> documentation (
>> http://doc.akka.io/docs/akka-stream-and-http-experimental/2.0.3/scala/stream-integrations.html#ActorPublisher)
>>  
>> but I cannot seem to understand how to use it.
>>
>> I am creating an ActorPublisher actor and creating a Source like this:
>>
>> val source = Source.actorPublisher(publisherProps)
>>
>> I then connect this source to a sink and run it: 
>> source.runWith(Sink.ignore). But debugging the actor I can see that 
>> totalDemand is always 0, so the actor never calls `onNext`. So what should 
>> update the demand on the actor? Do I always have to connect an 
>> ActorPublisher to an ActorSubscriber so that demand in ActorPublisher is 
>> updated properly?
>>
>> 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-user] Re: Using ActorPublisher without ActorSubscriber

2016-03-09 Thread Rafał Krzewski
Your actor is supposed to receive ActorPublisherMessage.Request message 
after the stream is materialized. At this point totalDemand should be > 0 
and you are allowed to call onNext

Can you show the code of your publisher actor?

Cheers,
Rafał

W dniu środa, 9 marca 2016 13:48:27 UTC+1 użytkownik Simão Mata napisał:
>
> Hello,
>
> I think I misunderstand the usage of ActorPublisher. I read the 
> documentation (
> http://doc.akka.io/docs/akka-stream-and-http-experimental/2.0.3/scala/stream-integrations.html#ActorPublisher)
>  
> but I cannot seem to understand how to use it.
>
> I am creating an ActorPublisher actor and creating a Source like this:
>
> val source = Source.actorPublisher(publisherProps)
>
> I then connect this source to a sink and run it: 
> source.runWith(Sink.ignore). But debugging the actor I can see that 
> totalDemand is always 0, so the actor never calls `onNext`. So what should 
> update the demand on the actor? Do I always have to connect an 
> ActorPublisher to an ActorSubscriber so that demand in ActorPublisher is 
> updated properly?
>
> 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-user] Re: [akka java 2.4.2] creating a flow sending elements of the stream to given actorRef and pushing results back to stream

2016-03-09 Thread Rafał Krzewski
You're welcome! I'm glad you managed to solve this puzzle :)

W dniu środa, 9 marca 2016 15:00:06 UTC+1 użytkownik paweł kamiński napisał:
>
> beware of singletons in spring :] be lazy be prototype ;]
> so updater ref for second connection was never created and then ask got 
> invalid ref or something like that because eventually messages were sent to 
> updater actor but from deadletter :)
>
> thanks for help :)
>
> On Wednesday, 9 March 2016 01:41:02 UTC+1, paweł kamiński wrote:
>>
>> thanks, for all help. 
>>
>> it is running for ever as I am testing concepts of updating a remote 
>> client asynchronously, in real time Updater will get updates from other 
>> actors and yes I will add supervision strategies.
>> Im running this app from unit tests that creates spring context and also 
>> http-serwer/actors along so maybe there is something funny going on. I ve 
>> never integrated akka with existing spring-based aps but this is just a 
>> proof of concept and I have almost identical app running both spring mvc 
>> with netty :) I ll dump logs to a file this way it should be easier to 
>> follow the flow.
>>
>> On Tuesday, 8 March 2016 23:33:38 UTC+1, Rafał Krzewski wrote:
>>>
>>> W dniu wtorek, 8 marca 2016 23:10:38 UTC+1 użytkownik paweł kamiński 
>>> napisał:

 but this is impossible to change concurrently as I log it and then pass 
 to Pattern#ask. I just wonder why it is send from 
 *akka://akka-system/deadLetters* and why *ReceiveTimeout* is not sent 
 back to Updater...

 Oh, that's right! A message sent without specifying a sender (like when 
>>> you are invoking ActorRef.tell from outside an actor) originates from 
>>> deadLetters, but message from an ask should originate from /temp/$ 
>>>  Something really weird is going on here.
>>>
>>> Regarding the ReceiveTimeouts, The log entries are 25 minutes later, and 
>>> log format is different - I don't know what to make of that. Two different 
>>> program runs with configuration change in between? That would explain why 
>>> serial # of B1 actor is different. Otherwise I don't see why should it be 
>>> restarted, as the Updater actor appears to run "forever", unless you are 
>>> terminating it somehow from the outside (in the code not shown here). If 
>>> the actor crashed with an exception in receive, you'd notice that in the 
>>> log. Also you'd probably have to configure appropriate supervisionStrategy 
>>> in updater's actor parent to restart it.
>>>
>>>  
>>>
 the application I try to put together is a proof of concept and there 
 is no use to use scala at this point.

 Well, it's a matter of what you are comfortable using. It would be much 
>>> shorter in Scala, and easier to read for some people, but harder for others 
>>> :) Neither am I suggesting that rewriting it in Scala would fix the problem 
>>> at hand.
>>>
>>> Cheers,
>>> Rafał
>>>
>>

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


[akka-user] awaitTermination not working?

2016-03-09 Thread Eduardo Fernandes
Hi group! Thanks for your time in advance.

I'm using Java version 2.3.13. In my JUnit tests and when I'm testing in 
single node the awaitTermination function after the traditional shutdown() 
is not awaiting for the actor system termination. In fact the actorsystem 
is not event starting to shutdown.

I found this 
and
 
this 

 but 
I didn't found a clear solution to my problem. For other tests in 
multi-node environment the awaiting function is working fine.

Any idea?

Many thanks again for your help.

/Eduardo


https://groups.google.com/forum/#!searchin/akka-user/awaitTermination/akka-user/kAbrnq9mTsM/YefmJmOw7bUJ

https://groups.google.com/forum/#!searchin/akka-user/awaitTermination/akka-user/9YCfjf2iuqc/edTwRBZJgUEJ

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


Re: [akka-user] akka 2.4.2 java - How to create custom ContentType

2016-03-09 Thread paweł kamiński
I know that this is maybe boring, but can you point me in any direction how 
to correctly construct akka.http.scaladsl.model.MediaType.
applicationWithFixedCharset("my-own", ?, ?) in java? charset I can take 
from scala enums but the last parameters I have no idea. 

and can you tell what is the real difference between Binary and 
WithFixedCharset. is it only to have clear hierarchy or http-core is using 
it to control how http response is processed? is anywhere described in 
documentation?

On Wednesday, 9 March 2016 11:12:42 UTC+1, Konrad Malawski wrote:
>
> Thanks, will look into it soon!
>
> -- 
> Cheers,
> Konrad 'ktoso’ Malawski
> Akka  @ Lightbend 
> 
> 
>
> On 8 March 2016 at 22:42:30, paweł kamiński (kam...@gmail.com 
> ) wrote:
>
> @Konrad https://github.com/akka/akka/issues/19976 created, hope it will 
> help 
>
> I need a hint how to create empty scala.collection.Seq in java, I cannot 
> goole anything like that
>
> On Tuesday, 8 March 2016 17:50:31 UTC+1, Konrad Malawski wrote: 
>>
>> All Scala DSL model types extend the Java ones,
>> so you can co over the ScalaDSL to create them, and pass them into any 
>> place that expects JavaDSL types.
>>
>> Thanks in advance for the ticket
>>
>> -- 
>> Cheers,
>> Konrad 'ktoso’ Malawski
>> Akka  @ Lightbend 
>>  
>>
>> On 8 March 2016 at 17:48:44, paweł kamiński (kam...@gmail.com) wrote:
>>
>> OK, thanks, any hints how to work this around? 
>>
>> I ll create an issue.
>>
>> On Tuesday, 8 March 2016 17:37:48 UTC+1, Konrad Malawski wrote: 
>>>
>>> Seems we might be missing some factory methods on the MediaTypes trait, 
>>> the scaladsl has methods for returning more specific types, such as 
>>> `applicationWithCharset` etc.
>>>
>>> Would you please open a ticket about "feature parity of creating 
>>> MediaTypes for JavaDSL"?
>>> Thanks in advance!
>>>
>>> Please note that we're reworking the Java Routing DSL nowadays and 
>>> focusing on such missing bits is definitely something we'll do next up,
>>> please keep the feedback coming, thanks!
>>>
>>>
>>>
>>> -- 
>>> Cheers,
>>> Konrad 'ktoso’ Malawski
>>> Akka  @ Lightbend 
>>>  
>>>
>>> On 8 March 2016 at 17:14:17, paweł kamiński (kam...@gmail.com) wrote:
>>>
>>> I try to force my http server (using only http-core) to respond with 
>>> headers. 
>>>
>>> I get from request Accept header 
>>>
>>> String mime = request.getHeader(Accept.class)
>>> .map(HttpHeader::value)
>>> .orElse("application/json");
>>>
>>>
>>>  but then it is not clear to me how to create custom Content-Type 
>>> header. I cannot use RawHeader as it is ignored (as documentation 
>>> suggested). using HttpEntity.create is just pain in java
>>> to convert my mime back to ContentType I need to decide whether it is 
>>> binary or not. I tried
>>>
>>> ContentTypes.create(MediaTypes.custom()) // but it creates MediaType rather 
>>> than Binary, WithFixedCharset ..
>>>
>>>
>>>  then I tried 
>>>
>>>
>>>  ContentType.WithFixedCharset contentType = ContentTypes.create(
>>> 
>>> akka.http.scaladsl.model.MediaType.applicationWithFixedCharset("my-own", ?, 
>>> ?));
>>>
>>>
>>> but it suddenly is a scaladsl and I need to pass some scala collection / 
>>> charsets ... and there is no equivalent in javadsl (or maybe I am missing 
>>> it).
>>>
>>>
>>> what I am looking for is a way to convert Accept header into ContentType. I 
>>> dont know why this is so complicated. why ContentTypes.create isn't just 
>>> consume string???
>>>
>>> none http frameworks are making creating response so complicated. Or maybe 
>>> only javadsl is immature.
>>>
>>>
>>>  (I dont want to offend anyone, I am just tired)
>>>
>>>
>>>  thanks for any 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+...@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 

Re: [akka-user] Re: How to? - Sink.foldM[U, T](zero: U)(f: (U, T) ⇒ Future[U]): Sink[T, Future[U]]

2016-03-09 Thread Andrew Gaydenko
On Wednesday, March 9, 2016 at 1:20:37 PM UTC+3, Giovanni Alberto 
Caporaletti wrote:
>
> It would fail with an empty stream. You can use lastOption but you would 
> need to map over the materialized value thus needing an execution context 
> outside the stream context.
>

Oh.. Yes! Thanks for pointing 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.


Re: [akka-user] Akka typed and persistent actors

2016-03-09 Thread Konrad Malawski

He surely could. But what's the point of it?

Only the PersistentActor will be recovered in case of failure, not the Typed 
one.
Two points which make it worthwhile:

- In case of failure a PersistentActor stops. Thus, having it supervised by the 
Typed one makes sense as we can restart it there or bubble up.

- If I have a friend, I can not only talk to my friend but he can also talk to 
me ;-) I.e. While recovering send messages to parent (Typed).



Sure – not beautiful, but composes and is a current workaround if you want to 
try Typed actors here.



-- Konrad



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


Re: [akka-user] Re: Is akka.http.scaladsl.HttpExt.cachedHostConnectionPoolHttps buggy ?

2016-03-09 Thread Konrad Malawski
Thanks for reporting, will have a look into it.

Thanks for the reproducer – is it actually usable without having some
external settings / account there?

Also, please use `ContentTypes` instead of RawHeaders for modeling content
types.

Ticket is here: https://github.com/akka/akka/issues/19985


-- 
Cheers,
Konrad 'ktoso' Malawski
Akka  @ Lightbend 

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


[akka-user] Re: [akka java 2.4.2] creating a flow sending elements of the stream to given actorRef and pushing results back to stream

2016-03-09 Thread paweł kamiński
beware of singletons in spring :] be lazy be prototype ;]
so updater ref for second connection was never created and then ask got 
invalid ref or something like that because eventually messages were sent to 
updater actor but from deadletter :)

thanks for help :)

On Wednesday, 9 March 2016 01:41:02 UTC+1, paweł kamiński wrote:
>
> thanks, for all help. 
>
> it is running for ever as I am testing concepts of updating a remote 
> client asynchronously, in real time Updater will get updates from other 
> actors and yes I will add supervision strategies.
> Im running this app from unit tests that creates spring context and also 
> http-serwer/actors along so maybe there is something funny going on. I ve 
> never integrated akka with existing spring-based aps but this is just a 
> proof of concept and I have almost identical app running both spring mvc 
> with netty :) I ll dump logs to a file this way it should be easier to 
> follow the flow.
>
> On Tuesday, 8 March 2016 23:33:38 UTC+1, Rafał Krzewski wrote:
>>
>> W dniu wtorek, 8 marca 2016 23:10:38 UTC+1 użytkownik paweł kamiński 
>> napisał:
>>>
>>> but this is impossible to change concurrently as I log it and then pass 
>>> to Pattern#ask. I just wonder why it is send from 
>>> *akka://akka-system/deadLetters* and why *ReceiveTimeout* is not sent 
>>> back to Updater...
>>>
>>> Oh, that's right! A message sent without specifying a sender (like when 
>> you are invoking ActorRef.tell from outside an actor) originates from 
>> deadLetters, but message from an ask should originate from /temp/$ 
>>  Something really weird is going on here.
>>
>> Regarding the ReceiveTimeouts, The log entries are 25 minutes later, and 
>> log format is different - I don't know what to make of that. Two different 
>> program runs with configuration change in between? That would explain why 
>> serial # of B1 actor is different. Otherwise I don't see why should it be 
>> restarted, as the Updater actor appears to run "forever", unless you are 
>> terminating it somehow from the outside (in the code not shown here). If 
>> the actor crashed with an exception in receive, you'd notice that in the 
>> log. Also you'd probably have to configure appropriate supervisionStrategy 
>> in updater's actor parent to restart it.
>>
>>  
>>
>>> the application I try to put together is a proof of concept and there is 
>>> no use to use scala at this point.
>>>
>>> Well, it's a matter of what you are comfortable using. It would be much 
>> shorter in Scala, and easier to read for some people, but harder for others 
>> :) Neither am I suggesting that rewriting it in Scala would fix the problem 
>> at hand.
>>
>> Cheers,
>> Rafał
>>
>

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


[akka-user] Using ActorPublisher without ActorSubscriber

2016-03-09 Thread Simão Mata
Hello,

I think I misunderstand the usage of ActorPublisher. I read the 
documentation 
(http://doc.akka.io/docs/akka-stream-and-http-experimental/2.0.3/scala/stream-integrations.html#ActorPublisher)
 
but I cannot seem to understand how to use it.

I am creating an ActorPublisher actor and creating a Source like this:

val source = Source.actorPublisher(publisherProps)

I then connect this source to a sink and run it: 
source.runWith(Sink.ignore). But debugging the actor I can see that 
totalDemand is always 0, so the actor never calls `onNext`. So what should 
update the demand on the actor? Do I always have to connect an 
ActorPublisher to an ActorSubscriber so that demand in ActorPublisher is 
updated properly?

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.


Re: [akka-user] Re: How to? - Sink.foldM[U, T](zero: U)(f: (U, T) ⇒ Future[U]): Sink[T, Future[U]]

2016-03-09 Thread Giovanni Alberto Caporaletti
It would fail with an empty stream. You can use lastOption but you would 
need to map over the materialized value thus needing an execution context 
outside the stream context.

cheers
G
On Wednesday, 9 March 2016 01:19:01 UTC+1, Andrew Gaydenko wrote:
>
> Giovanni, I mean your last suggestion with custom stage.
>

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


[akka-user] Re: [akka-http-2.4.2] connection timeouts under load

2016-03-09 Thread Giovanni Alberto Caporaletti
I have very little time but I'll try to create a simple reproducer app and 
open an issue (if that's the case) asap

On Wednesday, 9 March 2016 01:28:57 UTC+1, David Knapp wrote:
>
> For what it's worth I've been occasionally seeing something similar, but 
> it's extremely intermittent and hard to reproduce since my application is 
> quite large and complex and relies almost entirely on an upstream REST 
> endpoint.
>
> On Saturday, March 5, 2016 at 8:38:11 AM UTC-7, Giovanni Alberto 
> Caporaletti wrote:
>>
>> Let me add that using finch on the same project  with default settings 
>> (same exact code apart from the very first layer, http req/resp 
>> parsing/routing) I get *0* timeouts/drops and more or less the same 
>> performance.
>> The performance is not an issue (it's getting better and better with 
>> every release, it's basically already on par with spray/finagle) but 
>> dropping connections / timing out is.
>>
>> Luckily this won't go into production for a while so I have some time to 
>> solve this issue, I don't want to change http frontend, I really hate 
>> twitter APIs, my business layer is completely written using futures and 
>> streams
>>
>> I don't know exactly what to look into, I'm open to suggestions
>>
>> thank you!
>>
>> On Saturday, 5 March 2016 13:03:57 UTC+1, Giovanni Alberto Caporaletti 
>> wrote:
>>>
>>> Hi,
>>> I'll try to explain what I'm experiencing in my akka-http app.
>>> (I found this issue but it's not been updated for almost a year and I'm 
>>> not sure it's relevant: https://github.com/akka/akka/issues/17395)
>>>
>>> I noticed that under load a lot of connections (~1-2%) were dropped or 
>>> timed out. I started investigating, tuning os and akka params and trimming 
>>> down my sample app until I got this:
>>>
>>>
>>> //N.B.: this is a test
>>>
>>> implicit val system = ActorSystem()
>>> implicit val mat: ActorMaterializer = ActorMaterializer()
>>> implicit val ec = system.dispatcher
>>>
>>> val binding: Future[ServerBinding] = Http().bind("0.0.0.0", 1104).map { 
>>> conn ⇒
>>> val promise = Promise[Unit]()
>>> // I don't even wait for the end of the flow
>>> val handler = Flow[HttpRequest].map { _ ⇒ promise.success(()); 
>>> HttpResponse() }
>>>
>>> // to be sure it's not a mapAsync(1) problem I use map and block here, 
>>> same result
>>> val t0 = System.currentTimeMillis()
>>> println(s"${Thread.currentThread().getName} start")
>>>
>>> conn handleWith handler
>>>
>>> Await.result(promise.future, 10.seconds)
>>> println(s"${Thread.currentThread().getName} end 
>>> ${System.currentTimeMillis() - t0}ms");
>>>   }.to(Sink.ignore).run()
>>>
>>> Await.result(binding, 10.seconds)
>>>
>>>
>>>
>>> When I run a small test using ab with something like "-c 1000" 
>>> concurrent connections or more (even if I'm handling one at a time here), 
>>> some of the requests immediately start getting unusual delays:
>>>
>>> default-akka.actor.default-dispatcher-3 start
>>> default-akka.actor.default-dispatcher-3 end 2015ms -> gets bigger
>>>
>>> This keeps getting worse. After a while I can kill ab, wait some minutes 
>>> and make a single request and it either gets refused or times out. The 
>>> server is basically *dead*
>>>
>>>
>>> *I get the exact same result with this, if you're wondering why I did 
>>> all that blocking and printing stuff above:*
>>>
>>> val handler = Flow[HttpRequest].map(_ ⇒ 
>>> HttpResponse()).alsoToMat(Sink.ignore)(Keep.right)
>>>
>>> val binding: Future[ServerBinding] = Http().bind("0.0.0.0", 
>>> 1104).mapAsync(1) { conn ⇒
>>>   conn handleWith handler
>>> }.to(Sink.ignore).run()
>>>
>>> and the same happens if I use bindAndHandle with a simple route. 
>>>
>>>
>>> In my standard setup (bindAndHandle, any number of concurrent 
>>> connections (1k to 10k tried) and keepalive for the requests) I see a 
>>> number of connections between 1 and 3% failing.
>>> This is what I get calling a simple route with  bindAndHandle, 
>>> MaxConnections(1) and connection keepalive enabled on the client: 
>>> lots of timeouts after just 10k calls already:
>>>
>>> Concurrency Level:  4000
>>> Time taken for tests:   60.605 seconds
>>> Complete requests:  1
>>> Failed requests:261
>>>(Connect: 0, Receive: 87, Length: 87, Exceptions: 87)
>>> Keep-Alive requests:9913
>>> ...
>>>
>>> Connection Times (ms)
>>>   min  mean[+/-sd] median   max
>>> Connect:07  31.3  0 191
>>> Processing: 0  241 2780.8  5   60396
>>> *Waiting*:0   92 1270.8  5   *60396*
>>> Total:  0  248 2783.5  5   60459
>>>
>>> Percentage of the requests served within a certain time (ms)
>>> ...
>>>   90% 13
>>>   95%255
>>>   98%   2061
>>>   99%   3911
>>>  100%  60459 (longest request) 
>>>
>>> It looks like it does the same on my local machine (mac) but I'm not 
>>> 100% sure. I'm doing the tests on an ubuntu 8-core 24GB ram vm
>>> I really don't know what to do, I'm 

Re: [akka-user] akka 2.4.2 java - How to create custom ContentType

2016-03-09 Thread Konrad Malawski
Thanks, will look into it soon!

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

On 8 March 2016 at 22:42:30, paweł kamiński (kami...@gmail.com) wrote:

@Konrad https://github.com/akka/akka/issues/19976 created, hope it will help

I need a hint how to create empty scala.collection.Seq in java, I cannot goole 
anything like that

On Tuesday, 8 March 2016 17:50:31 UTC+1, Konrad Malawski wrote:
All Scala DSL model types extend the Java ones,
so you can co over the ScalaDSL to create them, and pass them into any place 
that expects JavaDSL types.

Thanks in advance for the ticket

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

On 8 March 2016 at 17:48:44, paweł kamiński (kam...@gmail.com) wrote:

OK, thanks, any hints how to work this around?

I ll create an issue.

On Tuesday, 8 March 2016 17:37:48 UTC+1, Konrad Malawski wrote:
Seems we might be missing some factory methods on the MediaTypes trait, 
the scaladsl has methods for returning more specific types, such as 
`applicationWithCharset` etc.

Would you please open a ticket about "feature parity of creating MediaTypes for 
JavaDSL"?
Thanks in advance!

Please note that we're reworking the Java Routing DSL nowadays and focusing on 
such missing bits is definitely something we'll do next up,
please keep the feedback coming, thanks!



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

On 8 March 2016 at 17:14:17, paweł kamiński (kam...@gmail.com) wrote:

I try to force my http server (using only http-core) to respond with headers.

I get from request Accept header 

String mime = request.getHeader(Accept.class)
.map(HttpHeader::value)
.orElse("application/json");



but then it is not clear to me how to create custom Content-Type header. I 
cannot use RawHeader as it is ignored (as documentation suggested). using 
HttpEntity.create is just pain in java
to convert my mime back to ContentType I need to decide whether it is binary or 
not. I tried

ContentTypes.create(MediaTypes.custom()) // but it creates MediaType rather 
than Binary, WithFixedCharset ..


then I tried


ContentType.WithFixedCharset contentType = ContentTypes.create(

akka.http.scaladsl.model.MediaType.applicationWithFixedCharset("my-own", ?, ?));

but it suddenly is a scaladsl and I need to pass some scala collection / 
charsets ... and there is no equivalent in javadsl (or maybe I am missing it).

what I am looking for is a way to convert Accept header into ContentType. I 
dont know why this is so complicated. why ContentTypes.create isn't just 
consume string???

none http frameworks are making creating response so complicated. Or maybe only 
javadsl is immature.



(I dont want to offend anyone, I am just tired)


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

-- 
>>  Read the docs: http://akka.io/docs/
>>  Check the FAQ: 
>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>  Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and 

[akka-user] Re: Akka HTTP Websockets Java with Actor

2016-03-09 Thread Guido Medina
*Disclaimer:* The Akka HTTP performance on that page is outdated, now; if 
Akka HTTP is around 75% performance of Play 2, you can guess where it would 
be on that list.

On Wednesday, March 9, 2016 at 9:58:04 AM UTC, Guido Medina wrote:
>
> Hi Alan,
>
> I hope the Akka/Java example has helped, I will eventually migrate to it 
> when Akka HTTP websockets performance gets better compared to Vert.x with 
> Netty implementation:
>
> https://www.techempower.com/benchmarks/#section=data-r12=peak=json
>
> If you notice on my original source code (in case you still need the 
> answer), I'm passing the upgraded socket to the actor so it should just be 
> a final property of the newly created actor.
> Such socket has a write method, I'll post here again another -and working- 
> example with two paths, notice that for each path a different type of actor 
> is created and the upgraded socket is part of the actor creator:
>
>
>   vertx.createHttpServer().requestHandler(request -> {
> switch (request.path()) {
>   case "/price": {
> final ServerWebSocket socket = request.upgrade();
> final ActorRef actorRef = context.actorOf(Props.create(new 
> PriceWebsocketCreator(TargetSupervisor.this, socket)));
> socket.setWriteQueueMaxSize(1024).
>   handler(event -> actorRef.tell(event, NO_SENDER)).
>   closeHandler(event -> 
> actorRef.tell(PoisonPill.getInstance(), NO_SENDER));
> log.info("Price websocket connection from '{}' to '{}' 
> established.", socket.remoteAddress(), socket.localAddress());
> break;
>   }
>   case "/ticket": {
> final ServerWebSocket socket = request.upgrade();
> final ActorRef actorRef = context.actorOf(Props.create(new 
> TicketWebsocketCreator(TargetSupervisor.this, socket)));
> socket.setWriteQueueMaxSize(1024).
>   handler(event -> actorRef.tell(event, NO_SENDER)).
>   closeHandler(event -> 
> actorRef.tell(PoisonPill.getInstance(), NO_SENDER));
> log.info("Ticket websocket connection from '{}' to '{}' 
> established.", socket.remoteAddress(), socket.localAddress());
> break;
>   }
>   default:
> request.response().setStatusCode(400).end();
> }
>   }).listen(config.getInt("http.port"), config.getString("http.host"));
>
>
> HTH,
>
> Guido.
>
> On Tuesday, March 8, 2016 at 10:03:23 AM UTC, Alan Klikic wrote:
>>
>> Hi Guido,
>>
>> this post helped me allot. Thanks.
>> How can I send message from the Actor to the "connected" websocket?
>> As a response to initial message received from websocket and as a 
>> standalone/push message from Actor to websocket?
>>
>> Thank you in advance.
>>
>> Br,
>> Alan
>>
>> Dana srijeda, 24. veljače 2016. u 13:36:17 UTC+1, korisnik Guido Medina 
>> napisao je:
>>>
>>> While Akka HTTP is accessible to Java 8 users I decided to go for an 
>>> alternative which I was trying to avoid but at least I know is of high 
>>> performance and it fits right my needs.
>>> When a connection is upgraded to websocket it is passed to an actor, 
>>> also every message sent is forwarded to an Actor, Java 8 code snippet below:
>>>
>>>   vertx.createHttpServer().requestHandler(request -> {
>>> if ("/signal".equals(request.path())) {
>>>   final ServerWebSocket socket = request.upgrade();
>>>   final ActorRef actorRef = context().system().actorOf(
>>> // Using an internal non-blocking bounded mailbox with 
>>> capacity reserved (similar to LMAX)
>>> Props.create(new SignalWebsocketCreator(SourceSupervisor.
>>> this, socket)).withMailbox("bounded-mailbox-1024")
>>>   );
>>>   socket.setWriteQueueMaxSize(1024).
>>> handler(event -> actorRef.tell(event, noSender())).
>>> closeHandler(event -> actorRef.tell(PoisonPill.getInstance
>>> (), noSender()));
>>>   log.info("Websocket connection from '{}' to {} established.", 
>>> socket.remoteAddress(), socket.localAddress());
>>> } else {
>>>   request.response().setStatusCode(400).end();
>>> }
>>>   }).listen(config.getInt("http.port"), config.getString("http.host"
>>> ));
>>>
>>>
>>> Hope it helps some Java fellows that are stuck on this matter, not ideal 
>>> if you want to strictly stick to Akka like I wanted though it is still a 
>>> quick, simple and efficient solution,
>>>
>>> Guido.
>>>
>>

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

Re: [akka-user] Akka cluster: Passivation + reshard

2016-03-09 Thread Eduardo Fernandes
Ok. I've tried to find it out in the group without success.

Many thanks for your time!



On Wed, Mar 9, 2016 at 10:36 AM, Patrik Nordwall 
wrote:

> I think this has been answered elsewhere, but anyway. Passivation of all
> entities does not mean that the shard goes away, so next message will
> trigger allocation of the entity actor where the shard is currently
> located. Rebalancing can change the current location.
>
> /Patrik
>
> On Mon, Feb 29, 2016 at 10:30 AM, Eduardo Fernandes 
> wrote:
>
>> Hi.
>>
>> Suppose that we have all actors of a particular shard passivated. The
>> next time an actor of that shard receive a message the new incarnation will
>> be in the same physical node where the shard was before or the the logic of
>> new shard is triggered again and the shard is created for example where
>> there is less shards?
>>
>> Obs: in my case the rebalancing logic is switched off so there is no
>> automatic resharding.
>>
>> Thanks for your 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.
>>
>
>
>
> --
>
> Patrik Nordwall
> Akka Tech Lead
> Lightbend  -  Reactive apps on the JVM
> Twitter: @patriknw
>
> [image: Lightbend] 
>
> --
> >> Read the docs: http://akka.io/docs/
> >> Check the FAQ:
> http://doc.akka.io/docs/akka/current/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/topic/akka-user/u7qcXv_F2Oc/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/current/additional/faq.html
>>  Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send 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] DistributedPubSub -- list of topics

2016-03-09 Thread Patrik Nordwall
On Fri, Feb 26, 2016 at 6:08 PM, Val P  wrote:

> Thanks, I found the GetTopics in the code eventually, and I can match
> wildcards on it.
>
> I did notice that topics hang around quite a bit, which means if I get
> topics, I may be publishing to topics that are no longer monitored. I don't
> know if that means I will create additional unnecessary cluster chatter? I
> have not been able to follow the entire code yet, is it reference-count
> based, so as clients go away the reference gets reduced to zero, and
> prevent delivering messages to nodes where there is noone listening?
>

Yes, they hang around for a while. It's configured by
https://github.com/akka/akka/blob/master/akka-cluster-tools/src/main/resources/reference.conf#L26


>
> On Friday, February 26, 2016 at 5:34:58 AM UTC-6, Akka Team wrote:
>>
>> Hi Val,
>>
>>
>>
>> On Fri, Feb 19, 2016 at 6:28 PM, Val P  wrote:
>>
>>> Hi All,
>>> I'm experimenting with the PubSubMediator and Akka Cluster. So far so
>>> good, but I have one use case which I cannot cover yet.
>>>
>>>
>>> Is it possible to either:
>>>
>>> a. Use a custom comparer on a  Publish operation, to match a Publish
>>> request against multiple topics using wildcards? E.g. similar to:
>>>   mediator ! Publish("prefix*", msg, { my custom comprarer... })
>>>
>>
>> No, we don't support wildcards.
>>
>>
>>>
>>> or
>>>
>>> b. Get access to the list of active topics that I can enumerate to do
>>> wildcard matching? I am assuming that the mediator maintains a local list
>>> of all defined topics in the cluster, but maybe I'm mistaken? It doesn't
>>> have to be perfectly consistent, "eventually consistent" is fine.
>>>
>>
>> There is a GetTpoics message that you can send to the PubSubMediator,
>> which in turn will answer with a CurrentTopics(Set[String]) message.
>>
>> -Endre
>>
>>
>>>
>>>
>>>
>>>
>>> --
>>> >> Read the docs: http://akka.io/docs/
>>> >> Check the FAQ:
>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>> >> Search the archives:
>>> https://groups.google.com/group/akka-user
>>> ---
>>> You received this message because you are subscribed to 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
>> 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.
>



-- 

Patrik Nordwall
Akka Tech Lead
Lightbend  -  Reactive apps on the JVM
Twitter: @patriknw

[image: Lightbend] 

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

2016-03-09 Thread Konrad Malawski
Our http://resources.typesafe.com/monitoring/docs/ monitoring has seen an 
internal release of supporting 2.4.2 already.
You can get access to it via getting a sub: 
http://www.lightbend.com/services/expert-support
via this form: https://www.lightbend.com/company/contact

Hope this helps.

I'm not sure how the OSS monitoring tools are catching up.

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

On 9 March 2016 at 10:05:33, gilad e (egila...@gmail.com) wrote:

Hey,
Our team is working with Akka v2.4.2, and I couldn't find any monitoring tool 
that supports this version.

Is there such a thing already or is it too early?

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

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


[akka-user] Open-Source Monitoring Tool - Akka 2.4.2

2016-03-09 Thread gilad e
Hey,
Our team is working with Akka v2.4.2, and I couldn't find any monitoring 
tool that supports this version.

Is there such a thing already or is it too early?

Thanks,
Gilad

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