Re: [akka-user] Problem with akka tcp streams

2015-03-23 Thread Roland Kuhn
Glad you found it, thanks for closing the loop here!

Regards,

Roland


> 23 mar 2015 kl. 09:54 skrev zergood :
> 
> I had found the issue. The reason was frame coding. I supposed that every 
> message is send in single tcp packet but it is not. Now I have implemented 
> frame coding/decoding and everything is fine. Thank you for answers!
> 
> четверг, 19 марта 2015 г., 15:54:46 UTC+3 пользователь zergood написал:
> Hi!
> 
> I want to stream file lines through tcp to server.
> 
> Here is the code:
> 
> class StreamingTcpActor(remoteAddress:InetSocketAddress, system: ActorSystem){
>   implicit val actorSystem = system
>   implicit val materializer = ActorFlowMaterializer()
> 
>   val connection = StreamTcp().outgoingConnection(remoteAddress)
>   val file = scala.io.Source.fromFile(new File("./logfile.txt"))
>   val lines = file.getLines()
> 
>   Source(() => file.getLines()).map(line => {
> val message = MessageWithId(UUID.randomUUID().toString, line)
> RunTcpStreamEx.messageSerializer.toByteString(message)
>   }).via(connection.flow).to(Sink.ignore).run()
> }
> 
> Problem: Some lines were not send to the network.
> If I rewrite client code with out akka-streaming everything would be ok. 
> 
> I am new to akka streams. Could you provide me some doc links to figure out 
> what`s wrong here.
> 
> -- 
> >> 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 http://groups.google.com/group/akka-user 
> .
> For more options, visit https://groups.google.com/d/optout 
> .



Dr. Roland Kuhn
Akka Tech Lead
Typesafe  – Reactive apps on the JVM.
twitter: @rolandkuhn
 

-- 
>>  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 http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


Re: [akka-user] Problem with akka tcp streams

2015-03-23 Thread zergood
My mistake. 

четверг, 19 марта 2015 г., 23:07:15 UTC+3 пользователь √ написал:
>
> This looks weird:
>
> val file = scala.io.Source.fromFile(new File("./logfile.txt"))
>   val lines = file.getLines() <-- getLines here?
>
>   Source(() => file.getLines()).map(line => {
>
> On Thu, Mar 19, 2015 at 8:28 PM, Martynas Mickevičius <
> martynas.m...@typesafe.com > wrote:
>
>> Hi,
>>
>> are you sure you do not stop this actor or the whole ActorSystem while 
>> the transfer is still going?
>>
>> On Thu, Mar 19, 2015 at 1:32 AM, zergood > > wrote:
>>
>>> Hi!
>>>
>>> I want to stream file lines through tcp to server.
>>>
>>> Here is the code:
>>>
>>> class StreamingTcpActor(remoteAddress:InetSocketAddress, system: 
>>> ActorSystem){
>>>   implicit val actorSystem = system
>>>   implicit val materializer = ActorFlowMaterializer()
>>>
>>>   val connection = StreamTcp().outgoingConnection(remoteAddress)
>>>   val file = scala.io.Source.fromFile(new File("./logfile.txt"))
>>>   val lines = file.getLines()
>>>
>>>   Source(() => file.getLines()).map(line => {
>>> val message = MessageWithId(UUID.randomUUID().toString, line)
>>> RunTcpStreamEx.messageSerializer.toByteString(message)
>>>   }).via(connection.flow).to(Sink.ignore).run()
>>> }
>>>
>>>
>>> Problem: Some lines were not send to the network.
>>> If I rewrite client code with out akka-streaming everything would be ok. 
>>>
>>> I am new to akka streams. Could you provide me some doc links to figure 
>>> out what`s wrong here.
>>>
>>> -- 
>>> >> 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 http://groups.google.com/group/akka-user.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> -- 
>> Martynas Mickevičius
>> Typesafe  – Reactive 
>>  Apps on the JVM
>>  
>> -- 
>> >> 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 http://groups.google.com/group/akka-user.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Cheers,
> √
>  

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


Re: [akka-user] Problem with akka tcp streams

2015-03-19 Thread Viktor Klang
This looks weird:

val file = scala.io.Source.fromFile(new File("./logfile.txt"))
  val lines = file.getLines() <-- getLines here?

  Source(() => file.getLines()).map(line => {

On Thu, Mar 19, 2015 at 8:28 PM, Martynas Mickevičius <
martynas.mickevic...@typesafe.com> wrote:

> Hi,
>
> are you sure you do not stop this actor or the whole ActorSystem while the
> transfer is still going?
>
> On Thu, Mar 19, 2015 at 1:32 AM, zergood  wrote:
>
>> Hi!
>>
>> I want to stream file lines through tcp to server.
>>
>> Here is the code:
>>
>> class StreamingTcpActor(remoteAddress:InetSocketAddress, system: 
>> ActorSystem){
>>   implicit val actorSystem = system
>>   implicit val materializer = ActorFlowMaterializer()
>>
>>   val connection = StreamTcp().outgoingConnection(remoteAddress)
>>   val file = scala.io.Source.fromFile(new File("./logfile.txt"))
>>   val lines = file.getLines()
>>
>>   Source(() => file.getLines()).map(line => {
>> val message = MessageWithId(UUID.randomUUID().toString, line)
>> RunTcpStreamEx.messageSerializer.toByteString(message)
>>   }).via(connection.flow).to(Sink.ignore).run()
>> }
>>
>>
>> Problem: Some lines were not send to the network.
>> If I rewrite client code with out akka-streaming everything would be ok.
>>
>> I am new to akka streams. Could you provide me some doc links to figure
>> out what`s wrong here.
>>
>> --
>> >> 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 http://groups.google.com/group/akka-user.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> Martynas Mickevičius
> Typesafe  – Reactive
>  Apps on the JVM
>
> --
> >> 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 http://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Cheers,
√

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


Re: [akka-user] Problem with akka tcp streams

2015-03-19 Thread Martynas Mickevičius
Hi,

are you sure you do not stop this actor or the whole ActorSystem while the
transfer is still going?

On Thu, Mar 19, 2015 at 1:32 AM, zergood  wrote:

> Hi!
>
> I want to stream file lines through tcp to server.
>
> Here is the code:
>
> class StreamingTcpActor(remoteAddress:InetSocketAddress, system: ActorSystem){
>   implicit val actorSystem = system
>   implicit val materializer = ActorFlowMaterializer()
>
>   val connection = StreamTcp().outgoingConnection(remoteAddress)
>   val file = scala.io.Source.fromFile(new File("./logfile.txt"))
>   val lines = file.getLines()
>
>   Source(() => file.getLines()).map(line => {
> val message = MessageWithId(UUID.randomUUID().toString, line)
> RunTcpStreamEx.messageSerializer.toByteString(message)
>   }).via(connection.flow).to(Sink.ignore).run()
> }
>
>
> Problem: Some lines were not send to the network.
> If I rewrite client code with out akka-streaming everything would be ok.
>
> I am new to akka streams. Could you provide me some doc links to figure
> out what`s wrong here.
>
> --
> >> 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 http://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Martynas Mickevičius
Typesafe  – Reactive
 Apps on the JVM

-- 
>>  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 http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


[akka-user] Problem with akka tcp streams

2015-03-19 Thread zergood
Hi!

I want to stream file lines through tcp to server.

Here is the code:

class StreamingTcpActor(remoteAddress:InetSocketAddress, system: ActorSystem){
  implicit val actorSystem = system
  implicit val materializer = ActorFlowMaterializer()

  val connection = StreamTcp().outgoingConnection(remoteAddress)
  val file = scala.io.Source.fromFile(new File("./logfile.txt"))
  val lines = file.getLines()

  Source(() => file.getLines()).map(line => {
val message = MessageWithId(UUID.randomUUID().toString, line)
RunTcpStreamEx.messageSerializer.toByteString(message)
  }).via(connection.flow).to(Sink.ignore).run()
}


Problem: Some lines were not send to the network.
If I rewrite client code with out akka-streaming everything would be ok. 

I am new to akka streams. Could you provide me some doc links to figure out 
what`s wrong here.

-- 
>>  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 http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.