[akka-user] Re: What is the different between a typed actor and a normal object wrapping an actor instance?

2016-04-05 Thread Lap Ming Lee
Seems like there is Typed Actors and Actor Typed.  Since Type Actors is 
being depreciated, my question is aimed at Actor Typed instead.  

On Wednesday, April 6, 2016 at 11:41:37 AM UTC+8, Lap Ming Lee wrote:
>
> Hi, 
>
> I am reading up on Typed Actors and it seems like its only recommended to 
> be used in some specific cases.   I want to know what is the difference 
> between a Typed Actor and a normal object wrapping an actor instance in 
> terms of functionality.  
>
> Specifically: 
>
> case class WrapObject(implicit context: ActorContext) {
>
>   val actorRef = context.actorOf(someProps, someName)
>
>   def callMethod(msg: Any): Future[Any] = new AskableActorRef(actorRef).
> ask(msg)
> }
>
> Is there a need to used Typed Actor in this case, if the Wrap Object will 
> be passed between Actors?
>
>  - 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.


[akka-user] How do you determine/set the version of Akka used by the Scala REPL?

2016-04-05 Thread Mark Bower
I am running MacOSX10.8, Java1.8, Scala 2.11 and would like to run Akka 2.4 
in the Scala REPL, but I cannot find out how to specific where the Scala 
REPL gets its Akka implementation. I can run simple Akka actors in the 
REPL, but more advanced topics (like remote applications) generate errors 
that indicate an older version of Akka is being used in the REPL, but I 
can't figure out which one. What I would like is the equivalent of a "java 
-version" in Unix, but for Akka in the Scala REPL. Thoughts?

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

2016-04-05 Thread Madabhattula Rajesh Kumar
Hi,

If I use below application.conf (default settings). 

akka {
  persistence {
journal.plugin="cassandra-journal"
snapshot-store.plugin="cassandra-snapshot-store"
}
}

I got below exception

Starting 
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further 
details.
[INFO] [04/06/2016 09:26:31.933] 
[persistent-actors-akka.actor.default-dispatcher-4] 
[akka://persistent-actors/user/$a] Message 
[com.akka.persistence.Counter$Cmd] from 
Actor[akka://persistent-actors/deadLetters] to 
Actor[akka://persistent-actors/user/$a#1418786537] was not delivered. [1] 
dead letters encountered. This logging can be turned off or adjusted with 
configuration settings 'akka.log-dead-letters' and 
'akka.log-dead-letters-during-shutdown'.
[INFO] [04/06/2016 09:26:31.933] 
[persistent-actors-akka.actor.default-dispatcher-4] 
[akka://persistent-actors/user/$a] Message 
[com.akka.persistence.Counter$Cmd] from 
Actor[akka://persistent-actors/deadLetters] to 
Actor[akka://persistent-actors/user/$a#1418786537] was not delivered. [2] 
dead letters encountered. This logging can be turned off or adjusted with 
configuration settings 'akka.log-dead-letters' and 
'akka.log-dead-letters-during-shutdown'.
[INFO] [04/06/2016 09:26:31.933] 
[persistent-actors-akka.actor.default-dispatcher-4] 
[akka://persistent-actors/user/$a] Message 
[com.akka.persistence.Counter$Cmd] from 
Actor[akka://persistent-actors/deadLetters] to 
Actor[akka://persistent-actors/user/$a#1418786537] was not delivered. [3] 
dead letters encountered. This logging can be turned off or adjusted with 
configuration settings 'akka.log-dead-letters' and 
'akka.log-dead-letters-during-shutdown'.
[INFO] [04/06/2016 09:26:31.933] 
[persistent-actors-akka.actor.default-dispatcher-4] 
[akka://persistent-actors/user/$a] Message [java.lang.String] from 
Actor[akka://persistent-actors/deadLetters] to 
Actor[akka://persistent-actors/user/$a#1418786537] was not delivered. [4] 
dead letters encountered. This logging can be turned off or adjusted with 
configuration settings 'akka.log-dead-letters' and 
'akka.log-dead-letters-during-shutdown'.
*[WARN] [04/06/2016 09:26:48.321] 
[persistent-actors-cassandra-journal.default-dispatcher-5] 
[akka://persistent-actors/system/cassandra-journal] Failed to connect to 
Cassandra and initialize. It will be retried on demand. Caused by: line 
2:13 no viable alternative at input 'MATERIALIZED' (  [CREATE] 
MATERIALIZED...)*

Regards,
Rajesh

On Tuesday, April 5, 2016 at 10:23:02 AM UTC+5:30, Patrik Nordwall wrote:
>
> Could it be something with authentication?
>
> tis 5 apr. 2016 kl. 05:41 skrev Madabhattula Rajesh Kumar <
> mraj...@gmail.com >:
>
>>
>>
>> On Monday, April 4, 2016 at 6:29:58 PM UTC+5:30, Madabhattula Rajesh 
>> Kumar wrote:
>>>
>>>  
>>> Hi,
>>>
>>> I am not able to connect Cassandra journal from Akka Persistence. Please 
>>> find below my application.conf and exception details.
>>>
>>> Could you please help me to resolve this issue.
>>>
>>> akka {
>>>   persistence {
>>> journal.plugin="cassandra-journal"
>>> snapshot-store.plugin="cassandra-snapshot-store"
>>> }
>>> }
>>>  
>>> cassandra-journal {
>>> class="akka.persistence.cassandra.journal.CassandraJournal"
>>> contact-points = [“127.0.0.1”]
>>> port = 9042
>>> keyspace = “akkajournal”
>>> table = "journal"
>>> keyspace-autocreate = true
>>>
>>> authentication {
>>> username = "cassandra"
>>> password = "cassandra"
>>>   }
>>>   }
>>>
>>>   cassandra-snapshot-store {
>>>   class = "akka.persistence.cassandra.snapshot.CassandraSnapshotStore"
>>>   contact-points = [“127.0.0.1”]
>>>   port = 9042
>>> keyspace = “akkasnapshot”
>>> table = "snapshots"
>>> keyspace-autocreate = true
>>>
>>> authentication {
>>> username = "cassandra"
>>> password = "cassandra"
>>> }
>>>   }
>>>
>>>
>>>
>>> *Exception :-*SLF4J: Failed to load class 
>>> "org.slf4j.impl.StaticLoggerBinder".
>>> SLF4J: Defaulting to no-operation (NOP) logger implementation
>>> SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for 
>>> further details.
>>> [INFO] [04/04/2016 18:25:18.760] 
>>> [persistent-actors-akka.actor.default-dispatcher-3] 
>>> [akka://persistent-actors/user/$a] Message 
>>> [com.akka.persistence.Counter$Cmd] from 
>>> Actor[akka://persistent-actors/deadLetters] to 
>>> Actor[akka://persistent-actors/user/$a#1288992689] was not delivered. [1] 
>>> dead letters encountered. This logging can be turned off or adjusted with 
>>> configuration settings 'akka.log-dead-letters' and 
>>> 'akka.log-dead-letters-during-shutdown'.
>>> [INFO] [04/04/2016 18:25:18.760] 
>>> [persistent-actors-akka.actor.default-dispatcher-3] 
>>> [akka://persistent-actors/user/$a] Message 
>>> 

Re: [akka-user] ANNOUNCE: Akka 2.4.3 released!

2016-04-05 Thread Richard Rodseth
I'll wait. Looking at that ScalaDoc, I have no idea whatsoever how to use
it :)

On Tue, Apr 5, 2016 at 3:19 PM, Konrad Malawski  wrote:

> Please refer to it's scala doc for the time being:
> http://doc.akka.io/api/akka/2.4.3/#akka.stream.KillSwitches$
>
> --
> 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.
>

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

2016-04-05 Thread John
I can't figure out a clean way to implement something like the following 
with akka-streams:

1. Pull work item from a large-but-finite queue
2. Wait for a resource to be available from a small and finite pool 
[blocking, so probably evil?]
3. Do a computation using work item and resource.  [ideally there will be 
many 3's running in parallel]
4. Return resource to pool
5. Send result of computation to some kind of output


The biggest issue is the interaction between steps 4 and 2.  I cannot 
figure out how to create a cycle that would feed resources back to the 
pool.  
I also cannot figure out a clean way to implement step 2.   
Source.unfoldResource with explicit blocking in my read function seems like 
the best option.

Is there a good way to build this type of flow?   Thanks,

-John

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

2016-04-05 Thread Konrad Malawski
Please refer to it's scala doc for the time being: 
http://doc.akka.io/api/akka/2.4.3/#akka.stream.KillSwitches$

-- 
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] Dstributing data in akka cluster (guidance needed)

2016-04-05 Thread Val P
HI,

I am looking for guidance, if anyway is willing to share their experience:

I have an akka distributed system where I want to store small amounts of 
data (basically tombstones and other assorted bits). They may be stored on 
one node and consumed on another at a later time if the connection is later 
made to that other node. They aid in resuming some specialized TCP 
connections in a cluster, mostly.

What I'm looking for is a way to distribute this data in such a way that 
it's durable and eventually consistent across all nodes. I do not need it 
in memory. Basically I'd like to implement a key-value store similar to 
CoreOS etcd, but integrated with my Akka Cluster, instead of a separate 
entity with its own gossiping cluster and configuration.

Can anyone provide any guidance / pointers?

Thanks in advance, and apologies if I'm missing something obvious in Akka 
Persistence library.



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

2016-04-05 Thread Yan Pei
thank you Patrick.

On Tuesday, April 5, 2016 at 2:15:53 PM UTC-5, Patrik Nordwall wrote:
>
> 127.0.0.1 will only work on one machine (localhost).
> Read more: 
> http://doc.akka.io/docs/akka/2.4.3/java/cluster-usage.html#Joining_to_Seed_Nodes
> tis 5 apr. 2016 kl. 20:48 skrev Yan Pei :
>
>> Thank you Patrick for the hints. other team set up Cassandra in CF. I 
>> will ask them and give update if I get anything useful.
>>
>> Could you please clarify this to me:
>> remote {
>>#log-remote-lifecycle-events = on
>># if off then they are not logged
>>#log-sent-messages = on
>># if off then they are not logged
>>#log-received-messages = on
>>netty.tcp {
>>hostname = "127.0.0.1"
>>port = 2550
>>}
>>}
>>cluster {
>>seed-nodes = [
>>"akka.tcp://ClusterSystem@127.0.0.1:2550",
>>"akka.tcp://ClusterSystem@127.0.0.1:2551",
>>"akka.tcp://ClusterSystem@127.0.0.1:2552"]
>>
>> auto-down-unreachable-after = 10s
>>}
>>
>> If I deploy the Application with above configuration to different nodes, 
>> will those nodes join the cluster automatically by identify themself as 
>> ClusterSystem?
>>
>> Yan
>>
>>
>> On Tuesday, April 5, 2016 at 1:39:01 PM UTC-5, Patrik Nordwall wrote:
>>
>>> I have heard that you can run Cassandra in CF. i think you would need a 
>>> similar solution for Akka seed nodes as how Cassandra contact points are 
>>> handled in CF.
>>>
>>> If someone has a better answer or knows how Cassandra in CF works I 
>>> would also be curious to know.
>>>
>>> /Patrik
>>>
>>> tis 5 apr. 2016 kl. 18:12 skrev Yan Pei :
>>>
>> The problem we are facing right now is how to get the IP for node 
 instance running inside CF since the IP is dynamically generated. 
 Another question: is it possible to run Actor instance in difference 
 node?

 for example:
 final Config config = 
 ConfigFactory.parseString("akka.remote.netty.tcp.port=" + port).
 withFallback(ConfigFactory.parseString(""akka.remote.netty.tcp.hostname=" 
 + hostname")).
 withFallback(ConfigFactory.parseString("akka.cluster.roles = 
 [backend]")).
 withFallback(ConfigFactory.load());

 ActorSystem system = ActorSystem.create("example", config);
 ActorRef backend = system.actorOf(Props.create(ActorExample.class, 
 customers, chunk), "backend");


 Can I create different ActorExample instance in different nodes? 

 Thanks a lot!
 Yan


 On Monday, April 4, 2016 at 12:17:25 PM UTC-5, Yan Pei wrote:
>
> If we want to deploy our AKKA application to CF with CF's load 
> balancer, should we configure the locad balancer ip in side our AKKA 
> application.conf? How do we dynamically configure ip address for 
> seed-nodes?
>
> Thanks for any inputs!
>
> Emily
>
 -- 
 >> Read the docs: http://akka.io/docs/
 >> Check the FAQ: 
 http://doc.akka.io/docs/akka/current/additional/faq.html
 >> Search the archives: 
 https://groups.google.com/group/akka-user
 --- 
 You received this message because you are subscribed to the Google 
 Groups "Akka User List" group.

>>> To unsubscribe from this group and stop receiving emails from it, send 
 an email to akka-user+...@googlegroups.com.
 To post to this group, send email to akka...@googlegroups.com.
>>>
>>>
 Visit this group at https://groups.google.com/group/akka-user.
 For more options, visit https://groups.google.com/d/optout.

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

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


Re: [akka-user] ANNOUNCE: Akka 2.4.3 released!

2016-04-05 Thread Richard Rodseth
Thank you. The divide by zero fix to throttle has already helped me.
I'm not seeing any documentation for KillSwitch. Did I miss it?

On Mon, Apr 4, 2016 at 1:08 PM, Justin du coeur  wrote:

> +1, with a particular thank-you for the more-transparent process.  Being
> able to see the sprint plan is lovely, and helps the community get a sense
> of where the priorities currently are.  (As well as the number of tasks
> y'all are juggling.)
>
> On Sun, Apr 3, 2016 at 3:55 PM, paweł kamiński  wrote:
>
>> +1
>>
>> On Friday, 1 April 2016 18:38:32 UTC+2, drewhk wrote:
>>>
>>> Yay!
>>>
>>> On Fri, Apr 1, 2016 at 6:37 PM, Konrad Malawski 
>>> wrote:
>>>
 ANNOUNCE: Akka 2.4.3 Released

 Dear hakkers,

 we—the Akka committers—are proud to announce the third patch release of
 Akka 2.4.

 This release focused mostly on hardening and polishing of existing
 features. We fixed a total of 58 flaky tests or bugs, continuing towards
 our stretch goal of reaching a clean slate in terms of known defects.

 The key features of the 2.4.3 release are:


-

KillSwitch  streams
operator, which allows external completion of streams,
-

the headerValueByType directive can now also handle
ModeledCustomHeaders,
-

the “no elements passed since 1 minute” error log is now a debug
message, as it is a fully expected thing to happen
-

   please remember that idle connections in Akka HTTP will be
   automatically closed after an idle-timeout. Timeouts in Akka HTTP
   
 
   now have a documentation page.
   -

performance improvements in flatMapMerge

-

Performance improvements in materialized value computation
-

Fixed HTTPS support which broke due to changes behaviour changes in
the JDK with respect to SNI
 handling
-

new search engine (powered by algolia) for our docs
 - which should
make navigating the documentation much more pleasant.


 Akka HTTP JavaDSL status update

 We are intensely working on introducing the new Routing Java DSL for
 Akka HTTP, which aims to be as close as possible to the Directives-style
 API that the Scala DSL provides. The majority of this work was contributed
 by Jan Ypma, and we continue to work together to push it over the finish
 line very soon – at which point we will release Akka 2.4.4.

 If you have been using the old Routing Java DSL this change will mean
 that these routes will have to be implemented using the new DSL when you
 upgrade. We are certain that the new DSL will be to your liking – we
 listened to lots of feedback from the community when deciding to make this
 change.

 As such, the entire old routing dsl will be removed and replaced with
 the new DSL in the upcoming 2.4.4 release.

 Transparency of core Akka team plans

 For the sake of improving transparency and inclusiveness of our
 community we decided to publish the core team’s sprint planning notes on
 the akka-meta repository, such that interested parties can have a look at
 what we’re focusing on in the next weeks.

 We hope that this experiment will work out well and improve awareness
 of where our efforts are spent, or where it would be a good time to
 contribute pull requests.

 The plan which included shipping Akka 2.4.3 is available here
 .

 Binary Compatibility

 Akka 2.4.x is backwards binary compatible with previous 2.3.x versions
 (exceptions listed below). This means that the new JARs are a drop-in
 replacement for the old one (but not the other way around) as long as your
 build does not enable the inliner (Scala-only restriction). It should be
 noted that Scala 2.11.x is is not binary compatible with Scala 2.10.x,
 which means that Akka’s binary compatibility property only holds between
 versions that were built for a given Scala version—
 akka-actor_2.11-2.4.0.jar is compatible with akka-actor_2.11-2.3.14.jar
 but not with akka-actor_2.10-2.3.14.jar.

 Binary compatibility is not maintained for the following:


-

testkits:
-

   akka-testkit
   -

   akka-multi-node-testkit
   -

   akka-persistence-tck
   -

   akka-stream-testkit
   -

   akka-http-testkit

Re: [akka-user] Re: Cloud Foundry + AKKA Cluster

2016-04-05 Thread Patrik Nordwall
127.0.0.1 will only work on one machine (localhost).
Read more:
http://doc.akka.io/docs/akka/2.4.3/java/cluster-usage.html#Joining_to_Seed_Nodes
tis 5 apr. 2016 kl. 20:48 skrev Yan Pei :

> Thank you Patrick for the hints. other team set up Cassandra in CF. I will
> ask them and give update if I get anything useful.
>
> Could you please clarify this to me:
> remote {
>#log-remote-lifecycle-events = on
># if off then they are not logged
>#log-sent-messages = on
># if off then they are not logged
>#log-received-messages = on
>netty.tcp {
>hostname = "127.0.0.1"
>port = 2550
>}
>}
>cluster {
>seed-nodes = [
>"akka.tcp://ClusterSystem@127.0.0.1:2550",
>"akka.tcp://ClusterSystem@127.0.0.1:2551",
>"akka.tcp://ClusterSystem@127.0.0.1:2552"]
>
> auto-down-unreachable-after = 10s
>}
>
> If I deploy the Application with above configuration to different nodes,
> will those nodes join the cluster automatically by identify themself as
> ClusterSystem?
>
> Yan
>
>
> On Tuesday, April 5, 2016 at 1:39:01 PM UTC-5, Patrik Nordwall wrote:
>
>> I have heard that you can run Cassandra in CF. i think you would need a
>> similar solution for Akka seed nodes as how Cassandra contact points are
>> handled in CF.
>>
>> If someone has a better answer or knows how Cassandra in CF works I would
>> also be curious to know.
>>
>> /Patrik
>>
>> tis 5 apr. 2016 kl. 18:12 skrev Yan Pei :
>>
> The problem we are facing right now is how to get the IP for node instance
>>> running inside CF since the IP is dynamically generated.
>>> Another question: is it possible to run Actor instance in difference
>>> node?
>>>
>>> for example:
>>> final Config config =
>>> ConfigFactory.parseString("akka.remote.netty.tcp.port=" + port).
>>> withFallback(ConfigFactory.parseString(""akka.remote.netty.tcp.hostname="
>>> + hostname")).
>>> withFallback(ConfigFactory.parseString("akka.cluster.roles =
>>> [backend]")).
>>> withFallback(ConfigFactory.load());
>>>
>>> ActorSystem system = ActorSystem.create("example", config);
>>> ActorRef backend = system.actorOf(Props.create(ActorExample.class,
>>> customers, chunk), "backend");
>>>
>>>
>>> Can I create different ActorExample instance in different nodes?
>>>
>>> Thanks a lot!
>>> Yan
>>>
>>>
>>> On Monday, April 4, 2016 at 12:17:25 PM UTC-5, Yan Pei wrote:

 If we want to deploy our AKKA application to CF with CF's load
 balancer, should we configure the locad balancer ip in side our AKKA
 application.conf? How do we dynamically configure ip address for 
 seed-nodes?

 Thanks for any inputs!

 Emily

>>> --
>>> >> Read the docs: http://akka.io/docs/
>>> >> Check the FAQ:
>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>> >> Search the archives:
>>> https://groups.google.com/group/akka-user
>>> ---
>>> You received this message because you are subscribed to 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: Cloud Foundry + AKKA Cluster

2016-04-05 Thread Yan Pei
Thank you Patrick for the hints. other team set up Cassandra in CF. I will 
ask them and give update if I get anything useful.

Could you please clarify this to me:
remote {
   #log-remote-lifecycle-events = on
   # if off then they are not logged
   #log-sent-messages = on
   # if off then they are not logged
   #log-received-messages = on
   netty.tcp {
   hostname = "127.0.0.1"
   port = 2550
   }
   }
   cluster {
   seed-nodes = [
   "akka.tcp://ClusterSystem@127.0.0.1:2550",
   "akka.tcp://ClusterSystem@127.0.0.1:2551",
   "akka.tcp://ClusterSystem@127.0.0.1:2552"]

auto-down-unreachable-after = 10s
   }

If I deploy the Application with above configuration to different nodes, 
will those nodes join the cluster automatically by identify themself as 
ClusterSystem?

Yan

On Tuesday, April 5, 2016 at 1:39:01 PM UTC-5, Patrik Nordwall wrote:
>
> I have heard that you can run Cassandra in CF. i think you would need a 
> similar solution for Akka seed nodes as how Cassandra contact points are 
> handled in CF.
>
> If someone has a better answer or knows how Cassandra in CF works I would 
> also be curious to know.
>
> /Patrik
>
> tis 5 apr. 2016 kl. 18:12 skrev Yan Pei :
>
>> The problem we are facing right now is how to get the IP for node 
>> instance running inside CF since the IP is dynamically generated. 
>> Another question: is it possible to run Actor instance in difference node?
>>
>> for example:
>> final Config config = 
>> ConfigFactory.parseString("akka.remote.netty.tcp.port=" + port).
>> withFallback(ConfigFactory.parseString(""akka.remote.netty.tcp.hostname=" 
>> + hostname")).
>> withFallback(ConfigFactory.parseString("akka.cluster.roles = [backend]")).
>> withFallback(ConfigFactory.load());
>>
>> ActorSystem system = ActorSystem.create("example", config);
>> ActorRef backend = system.actorOf(Props.create(ActorExample.class, 
>> customers, chunk), "backend");
>>
>>
>> Can I create different ActorExample instance in different nodes? 
>>
>> Thanks a lot!
>> Yan
>>
>>
>> On Monday, April 4, 2016 at 12:17:25 PM UTC-5, Yan Pei wrote:
>>>
>>> If we want to deploy our AKKA application to CF with CF's load balancer, 
>>> should we configure the locad balancer ip in side our AKKA 
>>> application.conf? How do we dynamically configure ip address for seed-nodes?
>>>
>>> Thanks for any inputs!
>>>
>>> Emily
>>>
>> -- 
>> >> Read the docs: http://akka.io/docs/
>> >> Check the FAQ: 
>> http://doc.akka.io/docs/akka/current/additional/faq.html
>> >> Search the archives: https://groups.google.com/group/akka-user
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Akka User List" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to akka-user+...@googlegroups.com .
>> To post to this group, send email to akka...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/akka-user.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

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


Re: [akka-user] Akka HTTP bind exception on Windows

2016-04-05 Thread Michi
Hi,

I think SO_REUSEADDR is enabled by default for Akka HTTP. At least it looks 
like that when I looked at the code. But even if it is disabled, the OS 
should not need ten minutes to release the socket.  Maybe I write a simple 
test program tomorrow that demonstrates the problem. 

My problem is that I am running out of time. Our customer is getting 
impatient and the server-side rest interface is just a small part of the 
application. I think it is probably best if I just use something else for 
now and go back to Akka HTTP if I have some more time. Can anyone suggest a 
lightweight, easy to use HTTP Server library for Java to provide a REST 
interface and deliver some HTML, CSS and Javascript files?

Thanks,
Michael

On Tuesday, April 5, 2016 at 6:34:26 PM UTC+2, drewhk wrote:
>
> Have you tried to add a configuration (ServerSettings) when you bind the 
> TCP which enables the ReuseAddress (
> http://doc.akka.io/api/akka/2.4.3/#akka.io.Inet$$SO$$ReuseAddress) option?
>
> -Endre
>
> On Tue, Apr 5, 2016 at 6:29 PM, Endre Varga  > wrote:
>
>> But that code uses SO_REUSEADDR.
>>
>> -Endre
>>
>> On Tue, Apr 5, 2016 at 5:50 PM, Michi > > wrote:
>>
>>> Hi Endre,
>>>
>>> I wrote a small test program that creates a socket channel, closes it 
>>> and creates another one using the same port:
>>>
>>> import java.io.IOException;
>>> import java.net.InetSocketAddress;
>>> import java.net.SocketAddress;
>>> import java.net.StandardSocketOptions;
>>> import java.nio.channels.NetworkChannel;
>>> import java.nio.channels.ServerSocketChannel;
>>>
>>> public class Main {
>>>
>>> public static void main(String[] args) throws IOException, 
>>> InterruptedException {
>>> int port = Integer.parseInt(args[0]);
>>> SocketAddress addr = new InetSocketAddress(port);
>>> System.out.println("Binding server socket to " + addr);
>>> ServerSocketChannel s = ServerSocketChannel.open();
>>> s.setOption(StandardSocketOptions.SO_REUSEADDR, true);
>>> System.out.println("Created server socket channel " + s);
>>> NetworkChannel c = s.bind(addr);
>>> System.out.println("Bound server socket to " + addr);
>>> s.close();
>>> System.out.println("Closed channel: " + s);
>>> Thread.sleep(1000);
>>> System.out.println("Binding server socket to " + addr);
>>> ServerSocketChannel s2 = ServerSocketChannel.open();
>>> s2.setOption(StandardSocketOptions.SO_REUSEADDR, true);
>>> System.out.println("Created server socket channel " + s2);
>>> NetworkChannel c2 = s2.bind(addr);
>>> System.out.println("Bound server socket to " + addr);
>>> s2.close();
>>> System.out.println("Closed channel: " + s2);
>>>
>>> }
>>> }
>>>
>>> It works perfectly both on Linux and on Windows. Here is the output on 
>>> Windows:
>>>
>>> C:\Users\Michael\Desktop>java Main 
>>> Binding server socket to 0.0.0.0/0.0.0.0:
>>> Created server socket channel sun.nio.ch.ServerSocketChannelImpl[unbound]
>>> Bound server socket to 0.0.0.0/0.0.0.0:
>>> Closed channel: sun.nio.ch.ServerSocketChannelImpl[closed]
>>> Binding server socket to 0.0.0.0/0.0.0.0:
>>> Created server socket channel sun.nio.ch.ServerSocketChannelImpl[unbound]
>>> Bound server socket to 0.0.0.0/0.0.0.0:
>>> Closed channel: sun.nio.ch.ServerSocketChannelImpl[closed]
>>>
>>>
>>> There is also AsynchronousServerSocketChannel, but I doubt this makes a 
>>> big difference. I really don't think that NIO does not properly unbind 
>>> sockets on Windows. There might be a small delay, but certainly not 10 
>>> Minutes! As far as I know StandardSocketOptions.SO_REUSEADDR should 
>>> allow to reuse sockets that are no longer in use, even if the operating 
>>> system did not unbind them yet.
>>>
>>> If there is anything I can do to help, let me know.
>>>
>>> Best regards,
>>> Michael
>>>
>>> On Tuesday, April 5, 2016 at 5:08:09 PM UTC+2, drewhk wrote:
>>>


 On Tue, Apr 5, 2016 at 5:04 PM, Michi  wrote:

> Hi Endre,
>
> even after 10 Minutes TCPView shows that the socket is still bound by 
> jawaw.exe. If I close the application, the socket gets unbound 
> immediately. 
> That's why I am wondering if I do something wrong or if this is a bug in 
> Akka HTTP. 
>

 We use NIO underneath and don't do anything special, so I am not sure 
 what we can do here (it works on all other OSes).
  

>
> I tried to use a independent Actor System for the Http Server class 
> and shut the system down after unbinding, but that does not help either.
>

 At that point Akka had cleaned up every actor, so I am not sure what 
 else to do :(
  

>
> Unfortunately our customer uses Windows and I am wondering if there is 
> anything I can do about it or if it would 

Re: [akka-user] Re: Cloud Foundry + AKKA Cluster

2016-04-05 Thread Patrik Nordwall
I have heard that you can run Cassandra in CF. i think you would need a
similar solution for Akka seed nodes as how Cassandra contact points are
handled in CF.

If someone has a better answer or knows how Cassandra in CF works I would
also be curious to know.

/Patrik

tis 5 apr. 2016 kl. 18:12 skrev Yan Pei :

> The problem we are facing right now is how to get the IP for node instance
> running inside CF since the IP is dynamically generated.
> Another question: is it possible to run Actor instance in difference node?
>
> for example:
> final Config config =
> ConfigFactory.parseString("akka.remote.netty.tcp.port=" + port).
> withFallback(ConfigFactory.parseString(""akka.remote.netty.tcp.hostname="
> + hostname")).
> withFallback(ConfigFactory.parseString("akka.cluster.roles = [backend]")).
> withFallback(ConfigFactory.load());
>
> ActorSystem system = ActorSystem.create("example", config);
> ActorRef backend = system.actorOf(Props.create(ActorExample.class,
> customers, chunk), "backend");
>
>
> Can I create different ActorExample instance in different nodes?
>
> Thanks a lot!
> Yan
>
>
> On Monday, April 4, 2016 at 12:17:25 PM UTC-5, Yan Pei wrote:
>>
>> If we want to deploy our AKKA application to CF with CF's load balancer,
>> should we configure the locad balancer ip in side our AKKA
>> application.conf? How do we dynamically configure ip address for seed-nodes?
>>
>> Thanks for any inputs!
>>
>> Emily
>>
> --
> >> Read the docs: http://akka.io/docs/
> >> Check the FAQ:
> http://doc.akka.io/docs/akka/current/additional/faq.html
> >> Search the archives: https://groups.google.com/group/akka-user
> ---
> You received this message because you are subscribed to the Google Groups
> "Akka User List" group.
> To unsubscribe from this group and stop receiving emails from it, send 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] Behavior of akka 2.4.3 with modeled custom headers

2016-04-05 Thread Chris Baxter
So I have some custom modeled headers, with one of them being defined like 
so:

object `X-Access-Token` extends 
ModeledCustomHeaderCompanion[`X-Access-Token`]{

  override val name = "X-Access-Token"

  override def parse(value:String) = util.Try(`X-Access-Token`(value))

}

case class `X-Access-Token`(token:String) extends 
ModeledCustomHeader[`X-Access-Token`] with DefaultHeaderRendering{

  override val companion = `X-Access-Token`

  val value = token

}


Using akka 2.4.3, if I pass it in on a request as:


X-Access-Token: abc123


and then in a route extract it via headerValueByType[`X-Access-Token`] the 
value of the token on the case class produced is "X-Access-Token: abc123" 
(included the header name) instead of the expected "abc123".  I tracked 
this down to the HeaderMagnet used for modeled headers:


implicit def fromUnitForModeledCustomHeader[T <: ModeledCustomHeader[T], H 
<: ModeledCustomHeaderCompanion[T]]

(u: Unit)(implicit tag: ClassTag[T], companion: 
ModeledCustomHeaderCompanion[T]): HeaderMagnet[T] =

new HeaderMagnet[T] {

  override def runtimeClass = tag.runtimeClass.asInstanceOf[Class[T]]

  override def classTag = tag

  override def extractPF = {

case h if h.is(companion.lowercaseName) => companion.apply(h
.toString)

  }

}


In extractPF, it's using the companion.apply with h.toString instead of 
just the .value of the header.  Am I supposed to be parsing out the value 
from that string in .parse on my companion because if that's the case it's 
not clear from the docs.  This all worked correctly in 2.4.2.

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

2016-04-05 Thread Endre Varga
Have you tried to add a configuration (ServerSettings) when you bind the
TCP which enables the ReuseAddress (
http://doc.akka.io/api/akka/2.4.3/#akka.io.Inet$$SO$$ReuseAddress) option?

-Endre

On Tue, Apr 5, 2016 at 6:29 PM, Endre Varga 
wrote:

> But that code uses SO_REUSEADDR.
>
> -Endre
>
> On Tue, Apr 5, 2016 at 5:50 PM, Michi <
> michael.tha...@physik.tu-muenchen.de> wrote:
>
>> Hi Endre,
>>
>> I wrote a small test program that creates a socket channel, closes it and
>> creates another one using the same port:
>>
>> import java.io.IOException;
>> import java.net.InetSocketAddress;
>> import java.net.SocketAddress;
>> import java.net.StandardSocketOptions;
>> import java.nio.channels.NetworkChannel;
>> import java.nio.channels.ServerSocketChannel;
>>
>> public class Main {
>>
>> public static void main(String[] args) throws IOException, 
>> InterruptedException {
>> int port = Integer.parseInt(args[0]);
>> SocketAddress addr = new InetSocketAddress(port);
>> System.out.println("Binding server socket to " + addr);
>> ServerSocketChannel s = ServerSocketChannel.open();
>> s.setOption(StandardSocketOptions.SO_REUSEADDR, true);
>> System.out.println("Created server socket channel " + s);
>> NetworkChannel c = s.bind(addr);
>> System.out.println("Bound server socket to " + addr);
>> s.close();
>> System.out.println("Closed channel: " + s);
>> Thread.sleep(1000);
>> System.out.println("Binding server socket to " + addr);
>> ServerSocketChannel s2 = ServerSocketChannel.open();
>> s2.setOption(StandardSocketOptions.SO_REUSEADDR, true);
>> System.out.println("Created server socket channel " + s2);
>> NetworkChannel c2 = s2.bind(addr);
>> System.out.println("Bound server socket to " + addr);
>> s2.close();
>> System.out.println("Closed channel: " + s2);
>>
>> }
>> }
>>
>> It works perfectly both on Linux and on Windows. Here is the output on 
>> Windows:
>>
>> C:\Users\Michael\Desktop>java Main 
>> Binding server socket to 0.0.0.0/0.0.0.0:
>> Created server socket channel sun.nio.ch.ServerSocketChannelImpl[unbound]
>> Bound server socket to 0.0.0.0/0.0.0.0:
>> Closed channel: sun.nio.ch.ServerSocketChannelImpl[closed]
>> Binding server socket to 0.0.0.0/0.0.0.0:
>> Created server socket channel sun.nio.ch.ServerSocketChannelImpl[unbound]
>> Bound server socket to 0.0.0.0/0.0.0.0:
>> Closed channel: sun.nio.ch.ServerSocketChannelImpl[closed]
>>
>>
>> There is also AsynchronousServerSocketChannel, but I doubt this makes a
>> big difference. I really don't think that NIO does not properly unbind
>> sockets on Windows. There might be a small delay, but certainly not 10
>> Minutes! As far as I know StandardSocketOptions.SO_REUSEADDR should
>> allow to reuse sockets that are no longer in use, even if the operating
>> system did not unbind them yet.
>>
>> If there is anything I can do to help, let me know.
>>
>> Best regards,
>> Michael
>>
>> On Tuesday, April 5, 2016 at 5:08:09 PM UTC+2, drewhk wrote:
>>
>>>
>>>
>>> On Tue, Apr 5, 2016 at 5:04 PM, Michi 
>>> wrote:
>>>
 Hi Endre,

 even after 10 Minutes TCPView shows that the socket is still bound by
 jawaw.exe. If I close the application, the socket gets unbound immediately.
 That's why I am wondering if I do something wrong or if this is a bug in
 Akka HTTP.

>>>
>>> We use NIO underneath and don't do anything special, so I am not sure
>>> what we can do here (it works on all other OSes).
>>>
>>>

 I tried to use a independent Actor System for the Http Server class and
 shut the system down after unbinding, but that does not help either.

>>>
>>> At that point Akka had cleaned up every actor, so I am not sure what
>>> else to do :(
>>>
>>>

 Unfortunately our customer uses Windows and I am wondering if there is
 anything I can do about it or if it would be better to reimplement the code
 with Apache Http Components.

>>>
>>> You can try out other frameworks, if they happen to work (and use NIO)
>>> then at least we can see what magic they do to make Windows happy :(
>>>
>>> -Endre
>>>
>>>

 best regards,
 Michael

 On Tuesday, April 5, 2016 at 2:07:52 PM UTC+2, drewhk wrote:
>
> Hi,
>
> As far as I know event though NIO reports the unbind, unbinding on
> Windows is not immediate and you are not guaranteed to be able to bind
> again immediately. I don't know if this comes from Windows or the NIO
> windows drivers though.
>
> -Endre
>
> On Tue, Apr 5, 2016 at 2:05 PM, Michi <
> michael...@physik.tu-muenchen.de> wrote:
>
>> Hi,
>>
>> we have a problem with Akka HTTP on Windows: after creating a server
>> binding and unbinding it, it is not possible to bind it again. We get a

Re: [akka-user] Akka HTTP bind exception on Windows

2016-04-05 Thread Endre Varga
But that code uses SO_REUSEADDR.

-Endre

On Tue, Apr 5, 2016 at 5:50 PM, Michi 
wrote:

> Hi Endre,
>
> I wrote a small test program that creates a socket channel, closes it and
> creates another one using the same port:
>
> import java.io.IOException;
> import java.net.InetSocketAddress;
> import java.net.SocketAddress;
> import java.net.StandardSocketOptions;
> import java.nio.channels.NetworkChannel;
> import java.nio.channels.ServerSocketChannel;
>
> public class Main {
>
> public static void main(String[] args) throws IOException, 
> InterruptedException {
> int port = Integer.parseInt(args[0]);
> SocketAddress addr = new InetSocketAddress(port);
> System.out.println("Binding server socket to " + addr);
> ServerSocketChannel s = ServerSocketChannel.open();
> s.setOption(StandardSocketOptions.SO_REUSEADDR, true);
> System.out.println("Created server socket channel " + s);
> NetworkChannel c = s.bind(addr);
> System.out.println("Bound server socket to " + addr);
> s.close();
> System.out.println("Closed channel: " + s);
> Thread.sleep(1000);
> System.out.println("Binding server socket to " + addr);
> ServerSocketChannel s2 = ServerSocketChannel.open();
> s2.setOption(StandardSocketOptions.SO_REUSEADDR, true);
> System.out.println("Created server socket channel " + s2);
> NetworkChannel c2 = s2.bind(addr);
> System.out.println("Bound server socket to " + addr);
> s2.close();
> System.out.println("Closed channel: " + s2);
>
> }
> }
>
> It works perfectly both on Linux and on Windows. Here is the output on 
> Windows:
>
> C:\Users\Michael\Desktop>java Main 
> Binding server socket to 0.0.0.0/0.0.0.0:
> Created server socket channel sun.nio.ch.ServerSocketChannelImpl[unbound]
> Bound server socket to 0.0.0.0/0.0.0.0:
> Closed channel: sun.nio.ch.ServerSocketChannelImpl[closed]
> Binding server socket to 0.0.0.0/0.0.0.0:
> Created server socket channel sun.nio.ch.ServerSocketChannelImpl[unbound]
> Bound server socket to 0.0.0.0/0.0.0.0:
> Closed channel: sun.nio.ch.ServerSocketChannelImpl[closed]
>
>
> There is also AsynchronousServerSocketChannel, but I doubt this makes a
> big difference. I really don't think that NIO does not properly unbind
> sockets on Windows. There might be a small delay, but certainly not 10
> Minutes! As far as I know StandardSocketOptions.SO_REUSEADDR should allow
> to reuse sockets that are no longer in use, even if the operating system
> did not unbind them yet.
>
> If there is anything I can do to help, let me know.
>
> Best regards,
> Michael
>
> On Tuesday, April 5, 2016 at 5:08:09 PM UTC+2, drewhk wrote:
>
>>
>>
>> On Tue, Apr 5, 2016 at 5:04 PM, Michi 
>> wrote:
>>
>>> Hi Endre,
>>>
>>> even after 10 Minutes TCPView shows that the socket is still bound by
>>> jawaw.exe. If I close the application, the socket gets unbound immediately.
>>> That's why I am wondering if I do something wrong or if this is a bug in
>>> Akka HTTP.
>>>
>>
>> We use NIO underneath and don't do anything special, so I am not sure
>> what we can do here (it works on all other OSes).
>>
>>
>>>
>>> I tried to use a independent Actor System for the Http Server class and
>>> shut the system down after unbinding, but that does not help either.
>>>
>>
>> At that point Akka had cleaned up every actor, so I am not sure what else
>> to do :(
>>
>>
>>>
>>> Unfortunately our customer uses Windows and I am wondering if there is
>>> anything I can do about it or if it would be better to reimplement the code
>>> with Apache Http Components.
>>>
>>
>> You can try out other frameworks, if they happen to work (and use NIO)
>> then at least we can see what magic they do to make Windows happy :(
>>
>> -Endre
>>
>>
>>>
>>> best regards,
>>> Michael
>>>
>>> On Tuesday, April 5, 2016 at 2:07:52 PM UTC+2, drewhk wrote:

 Hi,

 As far as I know event though NIO reports the unbind, unbinding on
 Windows is not immediate and you are not guaranteed to be able to bind
 again immediately. I don't know if this comes from Windows or the NIO
 windows drivers though.

 -Endre

 On Tue, Apr 5, 2016 at 2:05 PM, Michi  wrote:

> Hi,
>
> we have a problem with Akka HTTP on Windows: after creating a server
> binding and unbinding it, it is not possible to bind it again. We get a
> akka.stream.BindFailedException. On Linux, this works without problems.
>
> The application uses the following code to create the server binding:
>
>   private val binding: Future[ServerBinding] = {
> val httpsContext = if (protocol == Protocol.Https)
> Some(HttpsContexts.serverContext) else None
> val serverSource: Source[Http.IncomingConnection,
> 

[akka-user] Re: Cloud Foundry + AKKA Cluster

2016-04-05 Thread Yan Pei
The problem we are facing right now is how to get the IP for node instance 
running inside CF since the IP is dynamically generated. 
Another question: is it possible to run Actor instance in difference node?

for example:
final Config config = 
ConfigFactory.parseString("akka.remote.netty.tcp.port=" + port).
withFallback(ConfigFactory.parseString(""akka.remote.netty.tcp.hostname=" + 
hostname")).
withFallback(ConfigFactory.parseString("akka.cluster.roles = [backend]")).
withFallback(ConfigFactory.load());

ActorSystem system = ActorSystem.create("example", config);
ActorRef backend = system.actorOf(Props.create(ActorExample.class, 
customers, chunk), "backend");


Can I create different ActorExample instance in different nodes? 

Thanks a lot!
Yan

On Monday, April 4, 2016 at 12:17:25 PM UTC-5, Yan Pei wrote:
>
> If we want to deploy our AKKA application to CF with CF's load balancer, 
> should we configure the locad balancer ip in side our AKKA 
> application.conf? How do we dynamically configure ip address for seed-nodes?
>
> Thanks for any inputs!
>
> Emily
>

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

2016-04-05 Thread Roland Kuhn
[forget the last paragraph, found the answer in the first post]

> 5 apr 2016 kl. 18:00 skrev Roland Kuhn :
> 
>> 
>> 5 apr 2016 kl. 17:50 skrev Michi > >:
>> 
>> Hi Endre,
>> 
>> I wrote a small test program that creates a socket channel, closes it and 
>> creates another one using the same port:
>> 
>> import java.io.IOException;
>> import java.net.InetSocketAddress;
>> import java.net.SocketAddress;
>> import java.net.StandardSocketOptions;
>> import java.nio.channels.NetworkChannel;
>> import java.nio.channels.ServerSocketChannel;
>> 
>> public class Main {
>> 
>> public static void main(String[] args) throws IOException, 
>> InterruptedException {
>> int port = Integer.parseInt(args[0]);
>> SocketAddress addr = new InetSocketAddress(port);
>> System.out.println("Binding server socket to " + addr);
>> ServerSocketChannel s = ServerSocketChannel.open();
>> s.setOption(StandardSocketOptions.SO_REUSEADDR, true);
>> System.out.println("Created server socket channel " + s);
>> NetworkChannel c = s.bind(addr);
>> System.out.println("Bound server socket to " + addr);
>> s.close();
>> System.out.println("Closed channel: " + s);
>> Thread.sleep(1000);
>> System.out.println("Binding server socket to " + addr);
>> ServerSocketChannel s2 = ServerSocketChannel.open();
>> s2.setOption(StandardSocketOptions.SO_REUSEADDR, true);
>> System.out.println("Created server socket channel " + s2);
>> NetworkChannel c2 = s2.bind(addr);
>> System.out.println("Bound server socket to " + addr);
>> s2.close();
>> System.out.println("Closed channel: " + s2);
>> 
>> }
>> }
>> 
>> It works perfectly both on Linux and on Windows. Here is the output on 
>> Windows:
>> 
>> C:\Users\Michael\Desktop>java Main 
>> Binding server socket to 0.0.0.0/0.0.0.0:
>> Created server socket channel sun.nio.ch.ServerSocketChannelImpl[unbound]
>> Bound server socket to 0.0.0.0/0.0.0.0:
>> Closed channel: sun.nio.ch.ServerSocketChannelImpl[closed]
>> Binding server socket to 0.0.0.0/0.0.0.0:
>> Created server socket channel sun.nio.ch.ServerSocketChannelImpl[unbound]
>> Bound server socket to 0.0.0.0/0.0.0.0:
>> Closed channel: sun.nio.ch.ServerSocketChannelImpl[closed]
>> 
>> There is also AsynchronousServerSocketChannel, but I doubt this makes a big 
>> difference. I really don't think that NIO does not properly unbind sockets 
>> on Windows. There might be a small delay, but certainly not 10 Minutes! As 
>> far as I know StandardSocketOptions.SO_REUSEADDR should allow to reuse 
>> sockets that are no longer in use, even if the operating system did not 
>> unbind them yet.
> 
> This is slightly incorrect: it only allows binding to specific address while 
> there is a bound listen socket for the wildcard address, or binding during 
> the TIME_WAIT period. Otherwise binding to a local address for which an 
> active listener exists is still forbidden.
> 
> Are you sure that the socket is still bound when using Akka HTTP, or could it 
> be the post-unbind grace period (TIME_WAIT on Linux)? (i.e. does the re-bind 
> fail?)
> 
> Regards,
> 
> Roland
> 
>> 
>> If there is anything I can do to help, let me know.
>> 
>> Best regards,
>> Michael
>> 
>> On Tuesday, April 5, 2016 at 5:08:09 PM UTC+2, drewhk wrote:
>> 
>> 
>> On Tue, Apr 5, 2016 at 5:04 PM, Michi > 
>> wrote:
>> Hi Endre,
>> 
>> even after 10 Minutes TCPView shows that the socket is still bound by 
>> jawaw.exe. If I close the application, the socket gets unbound immediately. 
>> That's why I am wondering if I do something wrong or if this is a bug in 
>> Akka HTTP. 
>> 
>> We use NIO underneath and don't do anything special, so I am not sure what 
>> we can do here (it works on all other OSes).
>>  
>> 
>> I tried to use a independent Actor System for the Http Server class and shut 
>> the system down after unbinding, but that does not help either.
>> 
>> At that point Akka had cleaned up every actor, so I am not sure what else to 
>> do :(
>>  
>> 
>> Unfortunately our customer uses Windows and I am wondering if there is 
>> anything I can do about it or if it would be better to reimplement the code 
>> with Apache Http Components.
>> 
>> You can try out other frameworks, if they happen to work (and use NIO) then 
>> at least we can see what magic they do to make Windows happy :(
>> 
>> -Endre
>>  
>> 
>> best regards,
>> Michael
>> 
>> On Tuesday, April 5, 2016 at 2:07:52 PM UTC+2, drewhk wrote:
>> Hi,
>> 
>> As far as I know event though NIO reports the unbind, unbinding on Windows 
>> is not immediate and you are not guaranteed to be able to bind again 
>> immediately. I don't know if this comes from Windows or the NIO windows 
>> drivers though.
>> 
>> -Endre
>> 
>> On Tue, 

Re: [akka-user] Akka HTTP bind exception on Windows

2016-04-05 Thread Roland Kuhn

> 5 apr 2016 kl. 17:50 skrev Michi :
> 
> Hi Endre,
> 
> I wrote a small test program that creates a socket channel, closes it and 
> creates another one using the same port:
> 
> import java.io.IOException;
> import java.net.InetSocketAddress;
> import java.net.SocketAddress;
> import java.net.StandardSocketOptions;
> import java.nio.channels.NetworkChannel;
> import java.nio.channels.ServerSocketChannel;
> 
> public class Main {
> 
> public static void main(String[] args) throws IOException, 
> InterruptedException {
> int port = Integer.parseInt(args[0]);
> SocketAddress addr = new InetSocketAddress(port);
> System.out.println("Binding server socket to " + addr);
> ServerSocketChannel s = ServerSocketChannel.open();
> s.setOption(StandardSocketOptions.SO_REUSEADDR, true);
> System.out.println("Created server socket channel " + s);
> NetworkChannel c = s.bind(addr);
> System.out.println("Bound server socket to " + addr);
> s.close();
> System.out.println("Closed channel: " + s);
> Thread.sleep(1000);
> System.out.println("Binding server socket to " + addr);
> ServerSocketChannel s2 = ServerSocketChannel.open();
> s2.setOption(StandardSocketOptions.SO_REUSEADDR, true);
> System.out.println("Created server socket channel " + s2);
> NetworkChannel c2 = s2.bind(addr);
> System.out.println("Bound server socket to " + addr);
> s2.close();
> System.out.println("Closed channel: " + s2);
> 
> }
> }
> 
> It works perfectly both on Linux and on Windows. Here is the output on 
> Windows:
> 
> C:\Users\Michael\Desktop>java Main 
> Binding server socket to 0.0.0.0/0.0.0.0:
> Created server socket channel sun.nio.ch.ServerSocketChannelImpl[unbound]
> Bound server socket to 0.0.0.0/0.0.0.0:
> Closed channel: sun.nio.ch.ServerSocketChannelImpl[closed]
> Binding server socket to 0.0.0.0/0.0.0.0:
> Created server socket channel sun.nio.ch.ServerSocketChannelImpl[unbound]
> Bound server socket to 0.0.0.0/0.0.0.0:
> Closed channel: sun.nio.ch.ServerSocketChannelImpl[closed]
> 
> There is also AsynchronousServerSocketChannel, but I doubt this makes a big 
> difference. I really don't think that NIO does not properly unbind sockets on 
> Windows. There might be a small delay, but certainly not 10 Minutes! As far 
> as I know StandardSocketOptions.SO_REUSEADDR should allow to reuse sockets 
> that are no longer in use, even if the operating system did not unbind them 
> yet.

This is slightly incorrect: it only allows binding to specific address while 
there is a bound listen socket for the wildcard address, or binding during the 
TIME_WAIT period. Otherwise binding to a local address for which an active 
listener exists is still forbidden.

Are you sure that the socket is still bound when using Akka HTTP, or could it 
be the post-unbind grace period (TIME_WAIT on Linux)? (i.e. does the re-bind 
fail?)

Regards,

Roland

> 
> If there is anything I can do to help, let me know.
> 
> Best regards,
> Michael
> 
> On Tuesday, April 5, 2016 at 5:08:09 PM UTC+2, drewhk wrote:
> 
> 
> On Tue, Apr 5, 2016 at 5:04 PM, Michi  > wrote:
> Hi Endre,
> 
> even after 10 Minutes TCPView shows that the socket is still bound by 
> jawaw.exe. If I close the application, the socket gets unbound immediately. 
> That's why I am wondering if I do something wrong or if this is a bug in Akka 
> HTTP. 
> 
> We use NIO underneath and don't do anything special, so I am not sure what we 
> can do here (it works on all other OSes).
>  
> 
> I tried to use a independent Actor System for the Http Server class and shut 
> the system down after unbinding, but that does not help either.
> 
> At that point Akka had cleaned up every actor, so I am not sure what else to 
> do :(
>  
> 
> Unfortunately our customer uses Windows and I am wondering if there is 
> anything I can do about it or if it would be better to reimplement the code 
> with Apache Http Components.
> 
> You can try out other frameworks, if they happen to work (and use NIO) then 
> at least we can see what magic they do to make Windows happy :(
> 
> -Endre
>  
> 
> best regards,
> Michael
> 
> On Tuesday, April 5, 2016 at 2:07:52 PM UTC+2, drewhk wrote:
> Hi,
> 
> As far as I know event though NIO reports the unbind, unbinding on Windows is 
> not immediate and you are not guaranteed to be able to bind again 
> immediately. I don't know if this comes from Windows or the NIO windows 
> drivers though.
> 
> -Endre
> 
> On Tue, Apr 5, 2016 at 2:05 PM, Michi > 
> wrote:
> Hi,
> 
> we have a problem with Akka HTTP on Windows: after creating a server binding 
> and unbinding it, it is not possible to bind it again. We get a 
> akka.stream.BindFailedException. On Linux, this works without problems.
> 
> The application 

Re: [akka-user] Akka HTTP bind exception on Windows

2016-04-05 Thread Michi
Hi Endre,

I wrote a small test program that creates a socket channel, closes it and 
creates another one using the same port:

import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.net.StandardSocketOptions;
import java.nio.channels.NetworkChannel;
import java.nio.channels.ServerSocketChannel;

public class Main {

public static void main(String[] args) throws IOException, 
InterruptedException {
int port = Integer.parseInt(args[0]);
SocketAddress addr = new InetSocketAddress(port);
System.out.println("Binding server socket to " + addr);
ServerSocketChannel s = ServerSocketChannel.open();
s.setOption(StandardSocketOptions.SO_REUSEADDR, true);
System.out.println("Created server socket channel " + s);
NetworkChannel c = s.bind(addr);
System.out.println("Bound server socket to " + addr);
s.close();
System.out.println("Closed channel: " + s);
Thread.sleep(1000);
System.out.println("Binding server socket to " + addr);
ServerSocketChannel s2 = ServerSocketChannel.open();
s2.setOption(StandardSocketOptions.SO_REUSEADDR, true);
System.out.println("Created server socket channel " + s2);
NetworkChannel c2 = s2.bind(addr);
System.out.println("Bound server socket to " + addr);
s2.close();
System.out.println("Closed channel: " + s2);

}
}

It works perfectly both on Linux and on Windows. Here is the output on Windows:

C:\Users\Michael\Desktop>java Main 
Binding server socket to 0.0.0.0/0.0.0.0:
Created server socket channel sun.nio.ch.ServerSocketChannelImpl[unbound]
Bound server socket to 0.0.0.0/0.0.0.0:
Closed channel: sun.nio.ch.ServerSocketChannelImpl[closed]
Binding server socket to 0.0.0.0/0.0.0.0:
Created server socket channel sun.nio.ch.ServerSocketChannelImpl[unbound]
Bound server socket to 0.0.0.0/0.0.0.0:
Closed channel: sun.nio.ch.ServerSocketChannelImpl[closed]


There is also AsynchronousServerSocketChannel, but I doubt this makes a big 
difference. I really don't think that NIO does not properly unbind sockets 
on Windows. There might be a small delay, but certainly not 10 Minutes! As 
far as I know StandardSocketOptions.SO_REUSEADDR should allow to reuse 
sockets that are no longer in use, even if the operating system did not 
unbind them yet.

If there is anything I can do to help, let me know.

Best regards,
Michael

On Tuesday, April 5, 2016 at 5:08:09 PM UTC+2, drewhk wrote:
>
>
>
> On Tue, Apr 5, 2016 at 5:04 PM, Michi  > wrote:
>
>> Hi Endre,
>>
>> even after 10 Minutes TCPView shows that the socket is still bound by 
>> jawaw.exe. If I close the application, the socket gets unbound immediately. 
>> That's why I am wondering if I do something wrong or if this is a bug in 
>> Akka HTTP. 
>>
>
> We use NIO underneath and don't do anything special, so I am not sure what 
> we can do here (it works on all other OSes).
>  
>
>>
>> I tried to use a independent Actor System for the Http Server class and 
>> shut the system down after unbinding, but that does not help either.
>>
>
> At that point Akka had cleaned up every actor, so I am not sure what else 
> to do :(
>  
>
>>
>> Unfortunately our customer uses Windows and I am wondering if there is 
>> anything I can do about it or if it would be better to reimplement the code 
>> with Apache Http Components.
>>
>
> You can try out other frameworks, if they happen to work (and use NIO) 
> then at least we can see what magic they do to make Windows happy :(
>
> -Endre
>  
>
>>
>> best regards,
>> Michael
>>
>> On Tuesday, April 5, 2016 at 2:07:52 PM UTC+2, drewhk wrote:
>>>
>>> Hi,
>>>
>>> As far as I know event though NIO reports the unbind, unbinding on 
>>> Windows is not immediate and you are not guaranteed to be able to bind 
>>> again immediately. I don't know if this comes from Windows or the NIO 
>>> windows drivers though.
>>>
>>> -Endre
>>>
>>> On Tue, Apr 5, 2016 at 2:05 PM, Michi  
>>> wrote:
>>>
 Hi,

 we have a problem with Akka HTTP on Windows: after creating a server 
 binding and unbinding it, it is not possible to bind it again. We get a 
 akka.stream.BindFailedException. On Linux, this works without problems.

 The application uses the following code to create the server binding:

   private val binding: Future[ServerBinding] = {
 val httpsContext = if (protocol == Protocol.Https) 
 Some(HttpsContexts.serverContext) else None
 val serverSource: Source[Http.IncomingConnection, 
 Future[Http.ServerBinding]] = Http(actorSystem).bind(interface = 
 interface, 
 port = port, httpsContext = httpsContext)

 logger.info("Binding to interface " + interface + ":" + port + " 
 using " + protocol)

 val bindingFuture: Future[ServerBinding] = 
 

Re: [akka-user] Akka HTTP bind exception on Windows

2016-04-05 Thread Endre Varga
On Tue, Apr 5, 2016 at 5:04 PM, Michi 
wrote:

> Hi Endre,
>
> even after 10 Minutes TCPView shows that the socket is still bound by
> jawaw.exe. If I close the application, the socket gets unbound immediately.
> That's why I am wondering if I do something wrong or if this is a bug in
> Akka HTTP.
>

We use NIO underneath and don't do anything special, so I am not sure what
we can do here (it works on all other OSes).


>
> I tried to use a independent Actor System for the Http Server class and
> shut the system down after unbinding, but that does not help either.
>

At that point Akka had cleaned up every actor, so I am not sure what else
to do :(


>
> Unfortunately our customer uses Windows and I am wondering if there is
> anything I can do about it or if it would be better to reimplement the code
> with Apache Http Components.
>

You can try out other frameworks, if they happen to work (and use NIO) then
at least we can see what magic they do to make Windows happy :(

-Endre


>
> best regards,
> Michael
>
> On Tuesday, April 5, 2016 at 2:07:52 PM UTC+2, drewhk wrote:
>>
>> Hi,
>>
>> As far as I know event though NIO reports the unbind, unbinding on
>> Windows is not immediate and you are not guaranteed to be able to bind
>> again immediately. I don't know if this comes from Windows or the NIO
>> windows drivers though.
>>
>> -Endre
>>
>> On Tue, Apr 5, 2016 at 2:05 PM, Michi 
>> wrote:
>>
>>> Hi,
>>>
>>> we have a problem with Akka HTTP on Windows: after creating a server
>>> binding and unbinding it, it is not possible to bind it again. We get a
>>> akka.stream.BindFailedException. On Linux, this works without problems.
>>>
>>> The application uses the following code to create the server binding:
>>>
>>>   private val binding: Future[ServerBinding] = {
>>> val httpsContext = if (protocol == Protocol.Https)
>>> Some(HttpsContexts.serverContext) else None
>>> val serverSource: Source[Http.IncomingConnection,
>>> Future[Http.ServerBinding]] = Http(actorSystem).bind(interface = interface,
>>> port = port, httpsContext = httpsContext)
>>>
>>> logger.info("Binding to interface " + interface + ":" + port + "
>>> using " + protocol)
>>>
>>> val bindingFuture: Future[ServerBinding] =
>>> serverSource.to(Sink.foreach { connection =>
>>>   connection.handleWith(route)
>>> }).run()
>>> bindingFuture
>>>   }
>>>
>>>   binding onComplete {
>>> case Success(result) => logger.info("Bound to interface " +
>>> interface + ":" + port + " using " + protocol)
>>> case Failure(reason) => logger.error("Could not bind to interface "
>>> + interface + ":" + port + " using " + protocol, reason)
>>>   }
>>>
>>> protected override def dispose(): Unit = {
>>> // stop webserver
>>> for(binding <- binding) {
>>>   binding.unbind() onComplete {
>>> case Success(result) => logger.info("Unbound " + binding)
>>> case Failure(reason) => logger.error("Could not unbind " +
>>> binding, reason)
>>>   }
>>> }
>>>   }
>>>
>>> Restarting the application solves the problem.
>>>
>>> Is there anything I can do to solve the problem?
>>>
>>> Thanks,
>>> Michael
>>>
>>> --
>>> >> Read the docs: http://akka.io/docs/
>>> >> Check the FAQ:
>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>> >> Search the archives:
>>> https://groups.google.com/group/akka-user
>>> ---
>>> You received this message because you are subscribed to 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 

Re: [akka-user] Akka HTTP bind exception on Windows

2016-04-05 Thread Michi
Hi Endre,

even after 10 Minutes TCPView shows that the socket is still bound by 
jawaw.exe. If I close the application, the socket gets unbound immediately. 
That's why I am wondering if I do something wrong or if this is a bug in 
Akka HTTP. 

I tried to use a independent Actor System for the Http Server class and 
shut the system down after unbinding, but that does not help either.

Unfortunately our customer uses Windows and I am wondering if there is 
anything I can do about it or if it would be better to reimplement the code 
with Apache Http Components.

best regards,
Michael

On Tuesday, April 5, 2016 at 2:07:52 PM UTC+2, drewhk wrote:
>
> Hi,
>
> As far as I know event though NIO reports the unbind, unbinding on Windows 
> is not immediate and you are not guaranteed to be able to bind again 
> immediately. I don't know if this comes from Windows or the NIO windows 
> drivers though.
>
> -Endre
>
> On Tue, Apr 5, 2016 at 2:05 PM, Michi  > wrote:
>
>> Hi,
>>
>> we have a problem with Akka HTTP on Windows: after creating a server 
>> binding and unbinding it, it is not possible to bind it again. We get a 
>> akka.stream.BindFailedException. On Linux, this works without problems.
>>
>> The application uses the following code to create the server binding:
>>
>>   private val binding: Future[ServerBinding] = {
>> val httpsContext = if (protocol == Protocol.Https) 
>> Some(HttpsContexts.serverContext) else None
>> val serverSource: Source[Http.IncomingConnection, 
>> Future[Http.ServerBinding]] = Http(actorSystem).bind(interface = interface, 
>> port = port, httpsContext = httpsContext)
>>
>> logger.info("Binding to interface " + interface + ":" + port + " 
>> using " + protocol)
>>
>> val bindingFuture: Future[ServerBinding] = 
>> serverSource.to(Sink.foreach { connection =>
>>   connection.handleWith(route)
>> }).run()
>> bindingFuture
>>   }
>>
>>   binding onComplete {
>> case Success(result) => logger.info("Bound to interface " + 
>> interface + ":" + port + " using " + protocol)
>> case Failure(reason) => logger.error("Could not bind to interface " + 
>> interface + ":" + port + " using " + protocol, reason)
>>   }
>>
>> protected override def dispose(): Unit = {
>> // stop webserver
>> for(binding <- binding) {
>>   binding.unbind() onComplete {
>> case Success(result) => logger.info("Unbound " + binding)
>> case Failure(reason) => logger.error("Could not unbind " + 
>> binding, reason)
>>   }
>> }
>>   }
>>
>> Restarting the application solves the problem.
>>
>> Is there anything I can do to solve the problem?
>>
>> Thanks,
>> Michael
>>
>> -- 
>> >> Read the docs: http://akka.io/docs/
>> >> Check the FAQ: 
>> http://doc.akka.io/docs/akka/current/additional/faq.html
>> >> Search the archives: https://groups.google.com/group/akka-user
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Akka User List" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to akka-user+...@googlegroups.com .
>> To post to this group, send email to akka...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/akka-user.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

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


Re: [akka-user] Akka 2.4.3 cannot read response body when using http 1.0 request

2016-04-05 Thread Konrad Malawski
Let's continue the discussion in the ticket.
As Viktor found, it'd seem the 1.0 spec simply does not support this
though...?

On Tue, Apr 5, 2016 at 2:29 PM, xiaog zh  wrote:

> https://github.com/akka/akka/issues/20236
>
> Can somebody give me a little clue or even guide me get this problem fixed?
>
> On Tuesday, April 5, 2016 at 6:14:30 PM UTC+8, André wrote:
>>
>> The mandatory connection closing in HTTP 1.0 doesn't seem to work with
>> non-strict entities.
>>
>> HttpResponse(StatusCodes.OK, entity =
>> HttpEntity(ContentTypes.`application/json`, json)) works.
>>
>> HttpResponse(StatusCodes.OK, entity =
>> HttpEntity(ContentTypes.`application/json`, source), headers =
>> Connection("close") :: Nil) produces the same failure when requested with
>> HTTP 1.1.
>>
>> Could you open a ticket?
>>
>> Cheers
>> André
>>
>> On Tuesday, April 5, 2016 at 10:17:42 AM UTC+2, xiaog zh wrote:
>>>
>>> debug level logs:
>>>
>>> INFO - akka.event.slf4j.Slf4jLogger - Slf4jLogger started
>>> DEBUG - akka.event.EventStream - logger log1-Slf4jLogger started
>>> DEBUG - akka.event.EventStream - Default Loggers started
>>> DEBUG - com.typesafe.sslconfig.akka.AkkaSSLConfig - Initializing
>>> AkkaSSLConfig extension...
>>> DEBUG - com.typesafe.sslconfig.akka.AkkaSSLConfig -
>>> buildHostnameVerifier: created hostname verifier:
>>> com.typesafe.sslconfig.ssl.DefaultHostnameVerifier@39a2fc30
>>> DEBUG - akka.io.TcpListener - Successfully bound to /127.0.0.1:57407
>>> DEBUG - akka.http.impl.engine.client.PoolInterfaceActor - (Re-)starting
>>> host connection pool to localhost:57407
>>> DEBUG - akka.http.impl.engine.client.PoolSlot$SlotProcessor - become
>>> unconnected, from subscriber pending
>>> DEBUG - akka.http.impl.engine.client.PoolSlot$SlotProcessor - become
>>> unconnected, from subscriber pending
>>> DEBUG - akka.http.impl.engine.client.PoolSlot$SlotProcessor - become
>>> unconnected, from subscriber pending
>>> DEBUG - akka.http.impl.engine.client.PoolSlot$SlotProcessor - become
>>> unconnected, from subscriber pending
>>> DEBUG - akka.io.TcpOutgoingConnection - Attempting connection to
>>> [localhost/127.0.0.1:57407]
>>> DEBUG - akka.io.TcpListener - New connection accepted
>>> DEBUG - akka.io.TcpOutgoingConnection - Connection established to
>>> [localhost/127.0.0.1:57407]
>>> INFO - akka.actor.LocalActorRef - Message [akka.io.Tcp$ResumeReading$]
>>> from Actor[akka://ProxyActorTest/user/StreamSupervisor-1/$$b#-1567866888]
>>> to Actor[akka://ProxyActorTest/system/IO-TCP/selectors/$a/1#1829940929] was
>>> not delivered. [1] dead letters encountered. This logging can be turned off
>>> or adjusted with configuration settings 'akka.log-dead-letters' and
>>> 'akka.log-dead-letters-during-shutdown'.
>>> DEBUG - akka.http.impl.engine.client.PoolSlot$SlotProcessor - Slot 0
>>> disconnected after regular connection close
>>> response returned
>>>
>>> Futures timed out after [10 seconds]
>>> java.util.concurrent.TimeoutException: Futures timed out after [10
>>> seconds]
>>> at scala.concurrent.impl.Promise$DefaultPromise.ready(Promise.scala:219)
>>> at scala.concurrent.impl.Promise$DefaultPromise.result(Promise.scala:223)
>>> at scala.concurrent.Await$$anonfun$result$1.apply(package.scala:190)
>>> at
>>> scala.concurrent.BlockContext$DefaultBlockContext$.blockOn(BlockContext.scala:53)
>>> at scala.concurrent.Await$.result(package.scala:190)
>>> at
>>> com.oneapm.mordor.actors.marathon.ProxyActorTest$$anonfun$1$$anonfun$apply$mcV$sp$3.apply$mcV$sp(ProxyActorTest.scala:160)
>>> at
>>> com.oneapm.mordor.actors.marathon.ProxyActorTest$$anonfun$1$$anonfun$apply$mcV$sp$3.apply(ProxyActorTest.scala:122)
>>> at
>>> com.oneapm.mordor.actors.marathon.ProxyActorTest$$anonfun$1$$anonfun$apply$mcV$sp$3.apply(ProxyActorTest.scala:122)
>>>
>>>
>>> On Tuesday, April 5, 2016 at 3:44:37 PM UTC+8, √ wrote:

 Could you include the error?

 --
 Cheers,
 √
 On Apr 5, 2016 08:37, "xiaog zh"  wrote:

> Hi,
>   Below is a whole unit test in my project, and it fails when using
> `HTTP/1.0` protocol, success when using `HTTP/1.1`. Can somebody help
> explain the reason?
>
> // setup mock server
> val json =
>   """
> |{"result":true}
>   """.stripMargin
>
> val source = Source(ByteString(json) :: Nil)
> val mockRoutes = path("test" / "proxy_chunked.do") {
>   get {
> complete {
>   HttpResponse(StatusCodes.OK, entity = 
> HttpEntity(ContentTypes.`application/json`, source))
> }
>   }
> } ~ complete {
>   HttpResponse(StatusCodes.NotFound)
> }
>
> val (_, host, port) = AkkaHttpTestUtils.temporaryServerHostnameAndPort()
> val bindingFuture = Http().bindAndHandle(mockRoutes, host, port)
>
> val request = HttpRequest(
>   HttpMethods.GET,
>   uri = s"http://${host}:${port}/test/proxy_chunked.do;,
>   protocol = HttpProtocols.`HTTP/1.0`
> )
>
> 

Re: [akka-user] Akka 2.4.3 cannot read response body when using http 1.0 request

2016-04-05 Thread xiaog zh
https://github.com/akka/akka/issues/20236

Can somebody give me a little clue or even guide me get this problem fixed?

On Tuesday, April 5, 2016 at 6:14:30 PM UTC+8, André wrote:
>
> The mandatory connection closing in HTTP 1.0 doesn't seem to work with 
> non-strict entities.
>
> HttpResponse(StatusCodes.OK, entity = 
> HttpEntity(ContentTypes.`application/json`, json)) works.
>
> HttpResponse(StatusCodes.OK, entity = 
> HttpEntity(ContentTypes.`application/json`, source), headers = 
> Connection("close") :: Nil) produces the same failure when requested with 
> HTTP 1.1.
>
> Could you open a ticket?
>
> Cheers
> André
>
> On Tuesday, April 5, 2016 at 10:17:42 AM UTC+2, xiaog zh wrote:
>>
>> debug level logs:
>>
>> INFO - akka.event.slf4j.Slf4jLogger - Slf4jLogger started
>> DEBUG - akka.event.EventStream - logger log1-Slf4jLogger started
>> DEBUG - akka.event.EventStream - Default Loggers started
>> DEBUG - com.typesafe.sslconfig.akka.AkkaSSLConfig - Initializing 
>> AkkaSSLConfig extension...
>> DEBUG - com.typesafe.sslconfig.akka.AkkaSSLConfig - 
>> buildHostnameVerifier: created hostname verifier: 
>> com.typesafe.sslconfig.ssl.DefaultHostnameVerifier@39a2fc30
>> DEBUG - akka.io.TcpListener - Successfully bound to /127.0.0.1:57407
>> DEBUG - akka.http.impl.engine.client.PoolInterfaceActor - (Re-)starting 
>> host connection pool to localhost:57407
>> DEBUG - akka.http.impl.engine.client.PoolSlot$SlotProcessor - become 
>> unconnected, from subscriber pending
>> DEBUG - akka.http.impl.engine.client.PoolSlot$SlotProcessor - become 
>> unconnected, from subscriber pending
>> DEBUG - akka.http.impl.engine.client.PoolSlot$SlotProcessor - become 
>> unconnected, from subscriber pending
>> DEBUG - akka.http.impl.engine.client.PoolSlot$SlotProcessor - become 
>> unconnected, from subscriber pending
>> DEBUG - akka.io.TcpOutgoingConnection - Attempting connection to 
>> [localhost/127.0.0.1:57407]
>> DEBUG - akka.io.TcpListener - New connection accepted
>> DEBUG - akka.io.TcpOutgoingConnection - Connection established to 
>> [localhost/127.0.0.1:57407]
>> INFO - akka.actor.LocalActorRef - Message [akka.io.Tcp$ResumeReading$] 
>> from Actor[akka://ProxyActorTest/user/StreamSupervisor-1/$$b#-1567866888] 
>> to Actor[akka://ProxyActorTest/system/IO-TCP/selectors/$a/1#1829940929] was 
>> not delivered. [1] dead letters encountered. This logging can be turned off 
>> or adjusted with configuration settings 'akka.log-dead-letters' and 
>> 'akka.log-dead-letters-during-shutdown'.
>> DEBUG - akka.http.impl.engine.client.PoolSlot$SlotProcessor - Slot 0 
>> disconnected after regular connection close
>> response returned
>>
>> Futures timed out after [10 seconds]
>> java.util.concurrent.TimeoutException: Futures timed out after [10 
>> seconds]
>> at scala.concurrent.impl.Promise$DefaultPromise.ready(Promise.scala:219)
>> at scala.concurrent.impl.Promise$DefaultPromise.result(Promise.scala:223)
>> at scala.concurrent.Await$$anonfun$result$1.apply(package.scala:190)
>> at 
>> scala.concurrent.BlockContext$DefaultBlockContext$.blockOn(BlockContext.scala:53)
>> at scala.concurrent.Await$.result(package.scala:190)
>> at 
>> com.oneapm.mordor.actors.marathon.ProxyActorTest$$anonfun$1$$anonfun$apply$mcV$sp$3.apply$mcV$sp(ProxyActorTest.scala:160)
>> at 
>> com.oneapm.mordor.actors.marathon.ProxyActorTest$$anonfun$1$$anonfun$apply$mcV$sp$3.apply(ProxyActorTest.scala:122)
>> at 
>> com.oneapm.mordor.actors.marathon.ProxyActorTest$$anonfun$1$$anonfun$apply$mcV$sp$3.apply(ProxyActorTest.scala:122)
>>
>>
>> On Tuesday, April 5, 2016 at 3:44:37 PM UTC+8, √ wrote:
>>>
>>> Could you include the error?
>>>
>>> -- 
>>> Cheers,
>>> √
>>> On Apr 5, 2016 08:37, "xiaog zh"  wrote:
>>>
 Hi,
   Below is a whole unit test in my project, and it fails when using 
 `HTTP/1.0` protocol, success when using `HTTP/1.1`. Can somebody help 
 explain the reason?

 // setup mock server
 val json =
   """
 |{"result":true}
   """.stripMargin

 val source = Source(ByteString(json) :: Nil)
 val mockRoutes = path("test" / "proxy_chunked.do") {
   get {
 complete {
   HttpResponse(StatusCodes.OK, entity = 
 HttpEntity(ContentTypes.`application/json`, source))
 }
   }
 } ~ complete {
   HttpResponse(StatusCodes.NotFound)
 }

 val (_, host, port) = AkkaHttpTestUtils.temporaryServerHostnameAndPort()
 val bindingFuture = Http().bindAndHandle(mockRoutes, host, port)

 val request = HttpRequest(
   HttpMethods.GET,
   uri = s"http://${host}:${port}/test/proxy_chunked.do;,
   protocol = HttpProtocols.`HTTP/1.0`
 )

 val futureByteString = Http().singleRequest(request).map { resp =>
   println("response returned")
   resp.entity.dataBytes
 } flatMap { source =>
   source.runFold(ByteString.empty)((r, bs) => r ++ bs)
 }
 val byteString = Await.result(futureByteString, 10 

Re: [akka-user] Akka HTTP bind exception on Windows

2016-04-05 Thread Endre Varga
Hi,

As far as I know event though NIO reports the unbind, unbinding on Windows
is not immediate and you are not guaranteed to be able to bind again
immediately. I don't know if this comes from Windows or the NIO windows
drivers though.

-Endre

On Tue, Apr 5, 2016 at 2:05 PM, Michi 
wrote:

> Hi,
>
> we have a problem with Akka HTTP on Windows: after creating a server
> binding and unbinding it, it is not possible to bind it again. We get a
> akka.stream.BindFailedException. On Linux, this works without problems.
>
> The application uses the following code to create the server binding:
>
>   private val binding: Future[ServerBinding] = {
> val httpsContext = if (protocol == Protocol.Https)
> Some(HttpsContexts.serverContext) else None
> val serverSource: Source[Http.IncomingConnection,
> Future[Http.ServerBinding]] = Http(actorSystem).bind(interface = interface,
> port = port, httpsContext = httpsContext)
>
> logger.info("Binding to interface " + interface + ":" + port + "
> using " + protocol)
>
> val bindingFuture: Future[ServerBinding] =
> serverSource.to(Sink.foreach { connection =>
>   connection.handleWith(route)
> }).run()
> bindingFuture
>   }
>
>   binding onComplete {
> case Success(result) => logger.info("Bound to interface " + interface
> + ":" + port + " using " + protocol)
> case Failure(reason) => logger.error("Could not bind to interface " +
> interface + ":" + port + " using " + protocol, reason)
>   }
>
> protected override def dispose(): Unit = {
> // stop webserver
> for(binding <- binding) {
>   binding.unbind() onComplete {
> case Success(result) => logger.info("Unbound " + binding)
> case Failure(reason) => logger.error("Could not unbind " +
> binding, reason)
>   }
> }
>   }
>
> Restarting the application solves the problem.
>
> Is there anything I can do to solve the problem?
>
> Thanks,
> Michael
>
> --
> >> Read the docs: http://akka.io/docs/
> >> Check the FAQ:
> http://doc.akka.io/docs/akka/current/additional/faq.html
> >> Search the archives: https://groups.google.com/group/akka-user
> ---
> You received this message because you are subscribed to the Google Groups
> "Akka User List" group.
> To unsubscribe from this group and stop receiving emails from it, send 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] Akka HTTP bind exception on Windows

2016-04-05 Thread Michi
Hi,

we have a problem with Akka HTTP on Windows: after creating a server 
binding and unbinding it, it is not possible to bind it again. We get a 
akka.stream.BindFailedException. On Linux, this works without problems.

The application uses the following code to create the server binding:

  private val binding: Future[ServerBinding] = {
val httpsContext = if (protocol == Protocol.Https) 
Some(HttpsContexts.serverContext) else None
val serverSource: Source[Http.IncomingConnection, 
Future[Http.ServerBinding]] = Http(actorSystem).bind(interface = interface, 
port = port, httpsContext = httpsContext)

logger.info("Binding to interface " + interface + ":" + port + " using 
" + protocol)

val bindingFuture: Future[ServerBinding] = serverSource.to(Sink.foreach 
{ connection =>
  connection.handleWith(route)
}).run()
bindingFuture
  }

  binding onComplete {
case Success(result) => logger.info("Bound to interface " + interface + 
":" + port + " using " + protocol)
case Failure(reason) => logger.error("Could not bind to interface " + 
interface + ":" + port + " using " + protocol, reason)
  }

protected override def dispose(): Unit = {
// stop webserver
for(binding <- binding) {
  binding.unbind() onComplete {
case Success(result) => logger.info("Unbound " + binding)
case Failure(reason) => logger.error("Could not unbind " + binding, 
reason)
  }
}
  }

Restarting the application solves the problem.

Is there anything I can do to solve the problem?

Thanks,
Michael

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

2016-04-05 Thread Endre Varga
Hi,

Akka 2.2 is an ancient version, almost 3 years old and it is not supported
at all. 2.2.5 is the last version of that line. If you want support for
these versions you need commercial support subscription.

-Endre

On Tue, Apr 5, 2016 at 12:35 PM, Aurélien Panhaleux 
wrote:

> Hello,
>
> I use akka (v2.2) over Play Framework (v2.2.6).
> I have a scheduler programmed to be executed each day at 8am. Everything
> was working fine, until one day to come where one of my scheduler became to
> be triggered twice in a row.
> The calls are separated by 1 millisecond, you can see logs of my
> application triggered in first place in the onReceive method of my
> scheduler :
> 2016-03-09T07:00:38.741Z: [ [37minfo [0m] application -
> EmailNotification.onReceive.DAILY
> 2016-03-09T07:00:38.742Z: [ [37minfo [0m] application -
> EmailNotification.onReceive.DAILY
>
> This misbehaviour happens in a sporadic way, I can't find any reliable
> information in my application to understand this probem, does someone have
> any clue about it ?
>
> 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.


[akka-user] Scheduler onReceive method called twice in a row but registered once

2016-04-05 Thread Aurélien Panhaleux
Hello,

I use akka (v2.2) over Play Framework (v2.2.6).
I have a scheduler programmed to be executed each day at 8am. Everything 
was working fine, until one day to come where one of my scheduler became to 
be triggered twice in a row. 
The calls are separated by 1 millisecond, you can see logs of my 
application triggered in first place in the onReceive method of my 
scheduler :
2016-03-09T07:00:38.741Z: [ [37minfo [0m] application - 
EmailNotification.onReceive.DAILY
2016-03-09T07:00:38.742Z: [ [37minfo [0m] application - 
EmailNotification.onReceive.DAILY

This misbehaviour happens in a sporadic way, I can't find any reliable 
information in my application to understand this probem, does someone have 
any clue about it ?

Thanks

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


Re: [akka-user] Dispatcher for ClientResponseTunnel

2016-04-05 Thread Patrik Nordwall
A tunnel is created for each sender, and when you ask it will be a
different sender for each request. The tunnel actors will by default be
stopped after 30 seconds of inactivity. When you use ask you should
probably reduce this timeout to be similar to your ask timeout, a few
seconds.

```
akka.cluster.client.receptionist.response-tunnel-receive-timeout = 3s
```

If that still doesn't solve your problem I think you should open an issue.
Perhaps we can see that it's a ask request and close the tunnel immediately
when the first reply is passed.

Regards,
Patrik

On Mon, Apr 4, 2016 at 9:08 PM, lochsarun  wrote:

> I have a Akka project utilizing the cluster client.  I've found that
> "ask"ing the ClusterReceptionist a large volume (100's) of questions
> creates a large number of ClientResponseTunnel actors as children of the
> ClusterReceptionist.  Although the actor associated with the
> ClusterReceptionist can be configured to use a custom dispatcher I haven't
> figured out how to get the instances of ClientResponseTunnel off of the
> default dispatcher.  The result is that the default dispatcher gets flooded
> with requests.  Has anyone found a way of addressing this issue?  Maybe
> Akka should have configuration options to address this?
>
> --
> >> Read the docs: http://akka.io/docs/
> >> Check the FAQ:
> http://doc.akka.io/docs/akka/current/additional/faq.html
> >> Search the archives: https://groups.google.com/group/akka-user
> ---
> You received this message because you are subscribed to the Google Groups
> "Akka User List" group.
> To unsubscribe from this group and stop receiving emails from it, send 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

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

2016-04-05 Thread xiaog zh
Hi,
  Below is a whole unit test in my project, and it fails when using 
`HTTP/1.0` protocol, success when using `HTTP/1.1`. Can somebody help 
explain the reason?

// setup mock server
val json =
  """
|{"result":true}
  """.stripMargin

val source = Source(ByteString(json) :: Nil)
val mockRoutes = path("test" / "proxy_chunked.do") {
  get {
complete {
  HttpResponse(StatusCodes.OK, entity = 
HttpEntity(ContentTypes.`application/json`, source))
}
  }
} ~ complete {
  HttpResponse(StatusCodes.NotFound)
}

val (_, host, port) = AkkaHttpTestUtils.temporaryServerHostnameAndPort()
val bindingFuture = Http().bindAndHandle(mockRoutes, host, port)

val request = HttpRequest(
  HttpMethods.GET,
  uri = s"http://${host}:${port}/test/proxy_chunked.do;,
  protocol = HttpProtocols.`HTTP/1.0`
)

val futureByteString = Http().singleRequest(request).map { resp =>
  println("response returned")
  resp.entity.dataBytes
} flatMap { source =>
  source.runFold(ByteString.empty)((r, bs) => r ++ bs)
}
val byteString = Await.result(futureByteString, 10 seconds)
byteString.utf8String shouldEqual (json)



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