Re: [akka-user] Error about download akka proj from github and open it as a proj in intellij

2016-07-23 Thread Johan Andrén
Hi Leo,

What IntelliJ version and how did you open/import the Akka into IntelliJ? 
Make sure you have the latest as that works best, and just use Open make 
IntelliJ load the project.

IntelliJ doesn't quite understand the Akka build files in that it will give 
those red warning lines in the .sbt files because of not understanding what 
is available on the sbt project classpath or something like that. It should 
however work fine to open the project, let the IntelliJ Scala plugin do 
it's thing reading the sbt build into an IntelliJ project.

At some point when IntelliJ broke it's own project files I have had to 
close IntelliJ delete the generated .idea directory and open the project 
anew to make IntelliJ re-parse the sbt build, maybe this helps.

--
Johan

On Thursday, July 21, 2016 at 12:48:57 PM UTC+2, Leo Wolf wrote:
>
> By the way, the error shows this message:
>
>
> 
>
>
> Very thanks for the help!
>
>
> Leo Wolf於 2016年7月21日星期四 UTC+8下午6時46分13秒寫道:
>>
>> Hi Konrad,
>>
>> Thank you for getting back to me.
>> I have create a scala test file under Akka-http-sprayjson and the path is 
>> "/akka/akka-http-marshallers-scala/akka-http-spray-json/src/main/scala/akka/http/scaladsl/marshallers/sprayjson/UploadHandler.scala",
>>  
>> and package it as package akka.http.scaladsl.marshallers.sprayjson
>> , but some strange error shown:
>>
>>
>> 
>>
>> But the whole same scala file in a new project using sbt to include the 
>> normal akka library , I mean something like "com.typesafe.akka" %% 
>> "akka-http-experimental" 
>> % akkaVer withSources() withJavadoc(),is OK:
>>
>>
>> 
>>
>>
>>
>> And I do not really know why these errors occurred...
>>
>>
>>
>> Konrad Malawski於 2016年7月21日星期四 UTC+8下午4時25分16秒寫道:
>>>
>>> Hi Leo,
>>> what PR are you working on?
>>>
>>> But I found out there are lots of errors in build.sbt in every 
>>> directory. For instance,
>>>
>>> For the most part you can ignore these if intellij doesn't pick them up.
>>>
>>> The import into intellij from sbt feature works properly.
>>>
>>> And, I create a test.scala in akka.http.scaladsl.server.Directives, but 
>>> I found out I can't import akka.http.scaladsl.marshallers.sprayjson because 
>>> I can't find the directory below the menu:
>>>
>>>
>>> 
>>>
>>>
>>> "Akka-http" does not depend on "Akka-http-sprayjson", so it's not 
>>> available there.
>>> "Akka-http-sprayjson" does depend on "Akka HTTP" though, so in that 
>>> project you have all you need to write your test.scala
>>>
>>> Hope this helps
>>>
>>> -- konrad
>>>
>>

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


[akka-user] Re: Pass Future to Sink.ignore, how do I know it's completed

2016-07-23 Thread Johan Andrén
You can go from a stream of Future[T] to a stream of T by using mapAsync that 
way your stream will actually complete when the last future completes, 
Sink.ignore will materialize into a Future[Done] which completes when the 
stream completes, so those two in combination should be one solution.

--
Johan

On Thursday, July 21, 2016 at 11:50:13 PM UTC+2, Gary Struthers wrote:
>
> My Sink receives a Future. I don't want to do anything with it so I use 
> Sink.ignore but then I don't know when it's completed and that I need to 
> know. Should I write a custom Sink or does the API already have a solution 
> for this?
>
> Gary
>

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


[akka-user] Re: [cluster] why Connection refused.

2016-07-23 Thread Johan Andrén
There is not enough information to say anything certain about your problem. 
"Connection refused" means there is a route to that host but it was not 
possible to connect to the given port, it could for example be because of a 
internal firewall or a firewall between the systems, or if you use docker 
that the port you bind to is internal and maps to another port number on 
the actual network.

--
Johan

On Friday, July 22, 2016 at 11:35:17 AM UTC+2, 2817...@qq.com wrote:
>
> two nodes are cluster, but when starting , they all are following log:
>
> node akka.tcp://opendaylight-cluster-data@172.18.118.43:2550
> 07-21-16:23:01 2016-07-21 16:23:01,391 | WARN  | lt-dispatcher-16 | 
> ReliableDeliverySupervisor   | 167 - com.typesafe.akka.slf4j - 2.3.10 | 
> Association with remote system [akka.tcp://
> opendaylight-cluster-data@172.18.118.42:2550] has failed, address is now 
> gated for [5000] ms. Reason: [Association failed with [akka.tcp://
> opendaylight-cluster-data@172.18.118.42:2550]] Caused by: [Connection 
> refused: /172.18.118.42:2550]
>
>
> node akka.tcp://opendaylight-cluster-data@172.18.118.42:2550
> 07-21-16:23:04 2016-07-21 16:23:04,541 | WARN  | ult-dispatcher-4 | 
> ReliableDeliverySupervisor   | 167 - com.typesafe.akka.slf4j - 2.3.10 | 
> Association with remote system [akka.tcp://
> opendaylight-cluster-data@172.18.118.43:2550] has failed, address is now 
> gated for [5000] ms. Reason: [Association failed with [akka.tcp://
> opendaylight-cluster-data@172.18.118.43:2550]] Caused by: [Connection 
> refused: /172.18.118.43:2550]
>
>  "seed-nodes" : [ "akka.tcp://opendaylight-cluster-data@172.18.118.42:2550
> ",
>   "akka.tcp://opendaylight-cluster-data@172.18.118.43:2550" ]
>
> That could be some reason? 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] Creating Actor w/ Props having Value Class Argument(s)

2016-07-23 Thread Johan Andrén
Hi Kevin,

If you scroll down a bit from where you linked into the docs you can see 
the variations of prop factory methods and how to make it work with a value 
class 
(http://doc.akka.io/docs/akka/current/scala/actors.html#Value_classes_as_constructor_arguments)

Reflection is used when you do not provide a factory function to props but 
rather a class name and a list of constructor parameters. If all you have 
is a class name and a bunch of objects, the only way you can invoke a 
constructor is through reflection (or possibly a macro)

Both variations have their shortcomings, factory functions are hard to 
serialize and can easily close over surrounding scope by mistake, class + 
objects serializes fine but looses a bit of type safety - you won't know 
until runtime if you put the wrong number or wrong types of arguments in 
the list.

--
Johan

On Saturday, July 23, 2016 at 4:35:30 AM UTC+2, Kevin Meredith wrote:
>
> Thanks for the minimal example, Konrad. 
>
> On a side note, why is it necessary to use reflection (or possibly a 
> macro) in order to construct an Actor? 
>
> On Wednesday, July 20, 2016 at 11:48:15 AM UTC-4, Konrad Malawski wrote:
>>
>> This basically demonstrates the core of the problem:
>>
>> scala> class Meter(val m: Int) extends AnyVal
>> defined class Meter  
>> // in runtime you have *no way* to check if it's an AnyVal extending class 
>> or not. We would have to use macros. (scala reflection is a bit iffy...)
>>
>> scala> val m = new Meter(12)
>> m: Meter = Meter@c
>>
>> scala> class Act(m: Meter)
>> defined class Act
>>
>> scala> classOf[Act].getDeclaredConstructors.head
>> res23: java.lang.reflect.Constructor[_] = public Act(int)
>> // constructor takes int as you can see
>> // it is the ONLY constructor this class has - you can't pass in a Meter 
>> instance.
>>
>> scala> classOf[Act].getDeclaredConstructors.head.newInstance(new Integer(12))
>> res24: Any = Act@572db5ee
>>
>> scala> classOf[Act].getDeclaredConstructors.head.newInstance(new 
>> Meter(12).asInstanceOf[Object])
>> java.lang.IllegalArgumentException: argument type mismatch
>>   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>>   at 
>> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
>>   at 
>> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
>>   at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
>>   ... 32 elided
>> // NOPE.
>>
>>
>> // because if effectively is exactly the same as:
>> scala> class Act2(m: Int)
>> defined class Act2
>>
>> scala> classOf[Act2].getDeclaredConstructors.head
>> res27: java.lang.reflect.Constructor[_] = public Act2(int)
>>
>> scala>  classOf[Act].getDeclaredConstructors.head.newInstance(new 
>> Integer(12))
>> res28: Any = Act@50f65fe0
>>
>> scala>  classOf[Act].getDeclaredConstructors.head.newInstance(new 
>> Meter(12).asInstanceOf[Object])
>> java.lang.IllegalArgumentException: argument type mismatch
>>   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>>   at 
>> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
>>   at 
>> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
>>   at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
>>   ... 32 elided
>>
>>
>> So we’d be forced into guesswork about “hmmm! it has one field, maybe if 
>> we take the field out of that instance it will work!”. Which is weird, so 
>> we choose not to do this.
>>
>> If you have a solution to this problem I’d love to hear it :-)
>>
>>
>>
>> -- 
>> Konrad `ktoso` Malawski
>> Akka  @ Lightbend 
>>
>> On 20 July 2016 at 17:29:15, Kevin Meredith (kevin.m@gmail.com) 
>> wrote:
>>
>> Hi Konrad - 
>>
>> Could you please give me an example that demonstrates the "so we can't 
>> ..."?
>>
>> >AnyVal is a Scala compiler optimisation, so we can't figure out the 
>> right constructor (always / safely) in runtime.
>>
>> Thanks
>>
>> On Wednesday, July 20, 2016 at 9:44:33 AM UTC-4, Konrad Malawski wrote: 
>>>
>>> Because the type (wrapper) is not there at runtime.
>>> AnyVal is a Scala compiler optimisation, so we can't figure out the 
>>> right constructor (always / safely) in runtime.
>>>
>>> A resolution would be to "if thing has one field, and that value matches 
>>> we use that field" which could lead to very weird behaviour sometimes.
>>>
>>> -- 
>>> Konrad `ktoso` Malawski
>>> Akka  @ Lightbend 
>>>
>>> On 20 July 2016 at 15:40:08, Kevin Meredith (kevin.m@gmail.com) 
>>> wrote:
>>>
>>> Looking at the Akka docs 
>>>  for creating 
>>> an Actor:
>>>
>>> The recommended approach to create the actor Props is not supported for 
>>> cases when the actor constructor takes value classes as arguments.
>>>
>>> Please 

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

2016-07-23 Thread Dagny T

Responding to Endre from Akka Team.  So, I did look at the release 
documentation; and it says to use the experimental version because that 
contains the Routing DSL?  Also, I looked at the Central Maven site to 
lookup the latest Scala v2.11 compatible version for those libraries to get 
the 2.0.4.  However, I'll try just using v2.4.8 of akka-http-core and 
akka-stream and drop the experimental libs.  THANKS!

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

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


[akka-user] Re: Questions on Activator Template: Akka Sample Twitter Streaming

2016-07-23 Thread Dagny T

THANK YOU to the Akka Team for answering my questions; which I will need to 
go through tomorrow.


On Friday, July 15, 2016 at 10:55:55 PM UTC-7, Dagny T wrote:
>
> Hi there! Akka newbie. Trying to learn the latest Akka Http Streams API 
> from this:
> http://www.lightbend.com/activator/template/akka-sample-twitter-streaming ; 
> I'm running into bizarre behavior with that; and posted my list of 
> questions and what I've tried in the Disqus comments just under that 
> Template. Hoping someone with reliable current experience with the Akka 
> Http Streams API could please help with suggestions for where to find 
> answers to my questions, please. THANKS!
>
>

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

2016-07-23 Thread Dagny T

Trying to find the best code samples to learn how to use the APIs for Akka 
Streams for Http and Websockets.

Started with this Typesafe Activator Template:
http://www.lightbend.com/activator/template/akka-http-websocket-reactive-streams
Posting questions to the Disqus comments section for that.

1) Would anyone in this forum be able to answer my questions in that 
comments section -- and could you please share your answers on that Disqus 
comments section?

2) Does anyone here have experience using these APIs in Production; and 
could you please reply with links to recommended blogs with GitHub repos 
for the best places you found for learning the current forms of these APIs?

3) Does anyone here know the GitHub and/or Twitter contacts for the team 
who posted that Activator Template; and could you please reply with those? 



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

2016-07-23 Thread ajefrre
Hey,

This is one function in AsyncWriteJournal, while creating my own Journal 
Plugin I am receiving the warning Rejected to persist event type [blah] 
with sequence number [1] etc.

How do I make the function return without producing this warning, Thanks

public Future> 
doAsyncWriteMessages(Iterable messages) {

final Iterable r = messages;
ExecutionContext ec = context().system().dispatcher();
Future>temp = future(new 
Callable>() {
public Iterable call() throws Exception {
Iterable x;
ArrayList y = new 
ArrayList();
for(AtomicWrite entry : r){
y.add(Optional.of(new Exception("123")));

}
x = y;

return y;
}
},ec);
return temp;
}



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


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

2016-07-23 Thread Patrik Nordwall
It's one of Lightbend's commercial offerings. Contact Lightbend for more
information and pricing https://www.lightbend.com/contact

lör 23 juli 2016 kl. 06:26 skrev Yutao Shuai :

> Can I use the SBR for free?
>
> 在 2016年7月22日星期五 UTC+8下午10:02:13,Patrik Nordwall写道:
>>
>> Yes, it exists for 2.3.x
>>
> fre 22 juli 2016 kl. 13:01 skrev Yutao Shuai :
>>
>>> Can I use split brain resolver in version 2.3.10 ?
>>>
>>> 在 2016年7月22日星期五 UTC+8下午6:08:22,Akka Team写道:

 Hi Yutao,

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

 -Endre

>>>
 On Fri, Jul 22, 2016 at 11:18 AM, Yutao Shuai  wrote:

> The result we expected is divide into two cluster, one of the cluster
> has three or four nodes and work normally.
>
> 在 2016年7月22日星期五 UTC+8下午3:41:32,√写道:
>>
>> What behavior are you looking to achieve?
>>
>> --
>> Cheers,
>> √
>>
>> On Jul 22, 2016 5:11 AM, "Yutao Shuai"  wrote:
>>
>>>   In a 5-node cluster, hypothesis the nodes is A,B,C,D,E. All nodes
>>> monitor each other, enable auto-down,  and we  set the node-A random
>>> package loss rate 50%,  after a period of time, the cluster
>>>   will divide into two or more clusters. How can I fix this problem?
>>>
>>> --
>>> >> Read the docs: http://akka.io/docs/
>>> >> Check the FAQ:
>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>> >> Search the archives:
>>> https://groups.google.com/group/akka-user
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "Akka User List" group.
>>> To unsubscribe from this group and stop receiving emails from it,
>>> send an email to akka-user+...@googlegroups.com.
>>> To post to this group, send email to akka...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/akka-user.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> >> Read the docs: http://akka.io/docs/
> >> Check the FAQ:
> http://doc.akka.io/docs/akka/current/additional/faq.html
> >> Search the archives:
> https://groups.google.com/group/akka-user
> ---
> You received this message because you are subscribed to the Google
> Groups "Akka User List" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to akka-user+...@googlegroups.com.
> To post to this group, send email to akka...@googlegroups.com.
> Visit this group at https://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>



 --

>>> Akka Team
 Lightbend  - Reactive apps on the JVM
 Twitter: @akkateam

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