[akka-user] how to get the number of actors from actor system?

2017-03-21 Thread Leo Wolf
Hi there,

I have constructed the shard region in actor system, but I wonder if 
there's any way to know the number of entity actors in the system, or get 
the number of all actors in whole actor system?
If I count it with a counter, then if the actor system crashed and 
restarted, I will lose counter information because it's not be cleaned, so 
I prefer to find some way to acquire the information from the system. 
Thanks a lot.

-- 
>>  Read the docs: http://akka.io/docs/
>>  Check the 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: How to get the number of source actors with akka stream?

2017-03-08 Thread Leo Wolf
Hi Rafał,

I have a source as val userSource = Source.actorRef(10, OverflowStrategy.
fail).mapMaterializedValue(connected())), and a sink as val userSink = Sink.
actorRef[NotifyEnvelope](usrActor, disconnect())

And I printed the log in the connected() and the disconnect(), but found 
out when the connection was established, the disconnect() always be called 
first, then the connected(). Thus if I use the counter in the disconnect() 
and connected(), the counter will be not correct. Do you know any 
information about why disconnect() will be called first then the 
connected()?

p.s.: I have confirmed the connection was established correctly.

Many thanks,
Leo

Rafał Krzewski於 2017年3月5日星期日 UTC+8下午5時27分38秒寫道:
>
> Hi Leo,
>
> The actor is created each time you materialize a new instance of your 
> stream, which is something your application code does explicitly. 
> Materializing the stream yields and ActorRef that you can send to a 
> dedicated tracking actor.
> Each time it receives and ActorRef, it increments an internal counter and 
> starts to watch that ActorRef. Each time it receives a Terminated message 
> it decrements the counter. Finally, each time it receives a dedicated 
> ReturnCount message it responds with current value of the counter.
>
> Cheers,
> Rafał
>
> W dniu czwartek, 2 marca 2017 12:00:00 UTC+1 użytkownik Leo Wolf napisał:
>>
>> Hi,
>>
>> I have a question about how to measure the number of source actors with 
>> akka stream?
>> In code of akka stream, we can use Source.actorRef to create souce actor 
>> for akka streaming, but is there any way to get the number of created 
>> actors rather than calculate it in code of akka stream? Since every 
>> actor has a supervisor for it, can I get the number of created source 
>> actors by the supervisor? If yes, then how? Thanks for the help!
>>
>

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


[akka-user] Does akka-http-spray-json result in tostring() function during scala case class to json transition?

2017-01-17 Thread Leo Wolf
Hi there,

I use akka-http-spray-json for json marshalling/unmarshalling. Then I see a 
interesting result when I recording server performance as following picture:



I see lots of tostring() result when server is running, I think this might 
caused by case class to json transition. 
So my question is,will akka-http-spray-json result in tostring() for case 
class to json transition? Thanks.

Leo

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


[akka-user] Re: akka directive for uploading multiple files

2016-09-01 Thread Leo Wolf
Hi Cyril,

Not yet now.
I just use two solutions to fit the requirement, one is calling the api 
multiple times, and another is taring the whole file into a pkg and 
untaring it on server. Maybe this can help you.

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


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

2016-07-24 Thread Leo Wolf
Hi Johan,

Thank you for your reply and the information!
Now it's correctly worked!!

Leo

Johan Andrén於 2016年7月23日星期六 UTC+8下午5時53分21秒寫道:
>
> 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:
>>
>>
>> <https://lh3.googleusercontent.com/-HqOJ5c18VDs/V5Cog7Oy7_I/CxA/K-L1I1LQK9g-Mro4RwYiSVWPeXryTQ7RQCLcB/s1600/%25E8%259E%25A2%25E5%25B9%2595%25E5%25BF%25AB%25E7%2585%25A7%2B2016-07-21%2B%25E4%25B8%258B%25E5%258D%25886.47.51.png>
>>
>>
>> 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:
>>>
>>>
>>> <https://lh3.googleusercontent.com/-F8sjqier8v8/V5CmkUFojwI/Cws/UOlzkUtmQJEQ30jmQItjk9UrMX5DbJPYwCLcB/s1600/%25E8%259E%25A2%25E5%25B9%2595%25E5%25BF%25AB%25E7%2585%25A7%2B2016-07-21%2B%25E4%25B8%258B%25E5%258D%25886.34.46.png>
>>>
>>> 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:
>>>
>>>
>>> <https://lh3.googleusercontent.com/-XaZWg4q8aT0/V5CnYxkADjI/Cw0/GWeImnPpxNEZZd7JXxI_5hp-3JXVpE_cQCLcB/s1600/%25E8%259E%25A2%25E5%25B9%2595%25E5%25BF%25AB%25E7%2585%25A7%2B2016-07-21%2B%25E4%25B8%258B%25E5%258D%25886.34.16.png>
>>>
>>>
>>>
>>> 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:
>>>>
>>>>
>>>> <https://lh3.googleusercontent.com/-B6POZXa1aPg/V5CEknhLUXI/CwQ/ZXjLvgZamAkFSl7lboxqH5DihQD_Y5S3wCLcB/s1600/%25E8%259E%25A2%25E5%25B9%2595%25E5%25BF%25AB%25E7%2585%25A7%2B2016-07-21%2B%25E4%25B8%258B%25E5%258D%25884.14.42.png>
>>>>
>>>>
>>>> "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.


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

2016-07-21 Thread Leo Wolf
By the way, the error shows this message:

<https://lh3.googleusercontent.com/-HqOJ5c18VDs/V5Cog7Oy7_I/CxA/K-L1I1LQK9g-Mro4RwYiSVWPeXryTQ7RQCLcB/s1600/%25E8%259E%25A2%25E5%25B9%2595%25E5%25BF%25AB%25E7%2585%25A7%2B2016-07-21%2B%25E4%25B8%258B%25E5%258D%25886.47.51.png>


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:
>
>
> <https://lh3.googleusercontent.com/-F8sjqier8v8/V5CmkUFojwI/Cws/UOlzkUtmQJEQ30jmQItjk9UrMX5DbJPYwCLcB/s1600/%25E8%259E%25A2%25E5%25B9%2595%25E5%25BF%25AB%25E7%2585%25A7%2B2016-07-21%2B%25E4%25B8%258B%25E5%258D%25886.34.46.png>
>
> 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:
>
>
> <https://lh3.googleusercontent.com/-XaZWg4q8aT0/V5CnYxkADjI/Cw0/GWeImnPpxNEZZd7JXxI_5hp-3JXVpE_cQCLcB/s1600/%25E8%259E%25A2%25E5%25B9%2595%25E5%25BF%25AB%25E7%2585%25A7%2B2016-07-21%2B%25E4%25B8%258B%25E5%258D%25886.34.16.png>
>
>
>
> 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:
>>
>>
>> <https://lh3.googleusercontent.com/-B6POZXa1aPg/V5CEknhLUXI/CwQ/ZXjLvgZamAkFSl7lboxqH5DihQD_Y5S3wCLcB/s1600/%25E8%259E%25A2%25E5%25B9%2595%25E5%25BF%25AB%25E7%2585%25A7%2B2016-07-21%2B%25E4%25B8%258B%25E5%258D%25884.14.42.png>
>>
>>
>> "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.


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

2016-07-21 Thread Leo Wolf
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] Error about download akka proj from github and open it as a proj in intellij

2016-07-21 Thread Leo Wolf
Hi,

I'm new to akka-proj. I encounter some problems about modify the akka-proj, 
and found you have made some pull request on it so I decide to ask you 
about it.
I have forked the akka-proj, download it, and open it as a project in 
intellij. But I found out there are lots of errors in build.sbt in every 
directory. For instance,

build.sbt in akka proj:



build.sbt in 
akka/akka-http-marshallers-scala/akka-http-spray-json/build.sbt:



And even the line of import akka._ is useless and encounter errors with 
AkkaBuild??


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:





I'll very appreciate if you can give me some advices. Thank you for your 
attention to this matter.



-- 
>>  Read the docs: http://akka.io/docs/
>>  Check the 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] About akka websocket support

2016-06-07 Thread Leo Wolf
Hi Johan,

Thanks for the reply.
In the user register scheme, I will create user account according different 
email address, and user who want to connect to the websocket server should 
use these created account. Another to say, every user has their own account 
to connect server.

After a user connected, I use Source.actorRef catching the user account 
information and register it to a actor A, and use Sink.actorRef after user 
disconnected and remove user from actor A.

I use darkwebsocket terminal on notebook to connect to my server on MAC, 
and the message as 
system: connection established
will show on darkwebsocket terminal. After a few minutes I will receive the 
websocket disconnected message as 
system: connection closed
 on the darkwebsocket terminal. I think this is correct.

Now I use darkwebsocket terminal connecting to my server, say client B, and 
after successful connecting I change my notebook's IP address, but 
darkwebsocket terminal didn't show any message. Then I reconnect to the 
server using the same client B account and the darkwebsocket terminal will 
receive 
system: connection established
too, but after about 1 minute the darkwebsocket terminal will receive a 
system connection closed message first, and the darkwebsocket terminal will 
receive another system connection closed message in about another 30 
seconds to 1 minute after.

So, the situation is, after the IP changed, the reconnected client will 
receive connection closed message very soon (about 1 minute), compare to a 
few minutes in normal connecting, and the darkwebsocket terminal will 
receive two connection closed message. Now I still don't know how to fix 
this.


Akka Team於 2016年6月3日星期五 UTC+8下午4時51分02秒寫道:
>
> Hi Leo,
>
> I find it a bit hard to understand what it is you are asking.
>
> You connect a websocket client, but then change the IP of what? What is 
> the "user register scheme"?
> Where does the "system: connection closed" message appear? 
>
> Please see if you can clarify your question a bit and I'm sure we will be 
> able to help you out.
>
> -- 
> Johan
> Akka Team
> Typesafe - Reactive apps on the JVM
> Blog: letitcrash.com
> Twitter: @akkateam
>

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


[akka-user] akka directive for uploading multiple files

2016-06-02 Thread Leo Wolf
Hi, I'm using akka http for file uploading as bellow: 
formFields('json.as[String]) { json =>

  uploadedFile("file") {

...

}


And it works fine if I upload one file at a time. But I want to upload 
multiple different files in a http request, and how can I get it with the 
uploadedFile("file") directive? As now I always got the last file for 
uploading while multiple files are sent to the server by rest client. 

Thank you.


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


[akka-user] About akka websocket support

2016-05-26 Thread Leo Wolf
Hi,

I have encountered a akka websocket situation with akka stream, and need 
some advices. I built a websocket server via handleWebSocketMessages with 
user register scheme, and it's correctly worked. After that I changed the 
websocket client IP when it's connected with the websocket server, and 
found out after the IP changed, I can't get any response while message sent 
to the websocket server. Then, I reconnected to the websocket server with 
same user id, and found out I received two 
system: connection closed
message after a few minutes. But shouldn't it be correct that only received 
one connection closed response? It's really weird.

I thought maybe it can be solved if I could find some akka websocket 
timeout structure or some information like this, but found out there seems 
no further information about it in the doc of akka stream and akka http. 
And I really need some advices about the situation. Thank you.

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