Re: [akka-user] Re: withSupervisionStrategy passed a japi Function but compiler complains that its expecting a scala Function1

2016-10-26 Thread murtuza chhil
Though my code is not HTTP related, so whatever is fixed will fix my 
problem too , right?

-chhil

On Wednesday, October 26, 2016 at 6:08:21 PM UTC+5:30, murtuza chhil wrote:
>
> Thanks Konrad.
>
> -chhil
>
>
> On Wednesday, October 26, 2016 at 6:01:34 PM UTC+5:30, Konrad Malawski 
> wrote:
>>
>> Well that's exactly the thing we fixed.
>> As you've found in the docs.
>>
>> We'll release a stable this week, please upgrade then.
>>
>> -- 
>> Konrad `ktoso` Malawski
>> Akka <http://akka.io> @ Lightbend <http://lightbend.com>
>>
>> On 26 October 2016 at 13:29:52, murtuza chhil (chi...@gmail.com) wrote:
>>
>> Still looking for an answer to this, if anyone can point out whats wrong 
>> and how to get it done. 
>> I was looking at some HTTP docs and there was a fix in there and wonder 
>> if the problem is related
>>
>>
>> http://doc.akka.io/docs/akka-http/current/java/http/migration-guide/migration-guide-2.4.x-3.0.x.html#akka-http-2-4-11-3-0-0
>>
>> "The Java DSL for the following directives pathPrefixText, 
>> rawPathPrefixTest, rawPathPrefix, pathSuffix
>> accidentally used the Scala function type instead of the 
>> java.util.function.Function"
>>
>> -chhil
>>
>> On Thursday, October 20, 2016 at 10:33:03 PM UTC+5:30, murtuza chhil 
>> wrote: 
>>>
>>> Having trouble setting up withSupervisionStrategy for the materializer.
>>>
>>> I get a compile time error of
>>>
>>>   Error:(30, 23) java: no suitable method found for 
>>> withSupervisionStrategy(akka.japi.function.Function)
>>> method 
>>> akka.stream.ActorMaterializerSettings.withSupervisionStrategy(scala.Function1)
>>>  is not applicable
>>>   (argument mismatch; 
>>> akka.japi.function.Function
>>>  cannot be converted to 
>>> scala.Function1)
>>> method 
>>> akka.stream.ActorMaterializerSettings.withSupervisionStrategy(akka.japi.function.Function)
>>>  is not applicable
>>>   (argument mismatch; 
>>> akka.japi.function.Function
>>>  cannot be converted to 
>>> akka.japi.function.Function)
>>>
>>> It for some reason is confusing the method that would be used for scala 
>>> (expecting a function1).
>>> How do I get this to compile using java?
>>>
>>> import akka.NotUsed;import akka.actor.ActorSystem;import 
>>> akka.actor.SupervisorStrategy;import akka.japi.function.Function;import 
>>> akka.stream.ActorAttributes;import akka.stream.ActorMaterializer;import 
>>> akka.stream.IOResult;import akka.stream.Supervision;import 
>>> akka.stream.javadsl.*;import akka.util.ByteString;import scala.Function1;
>>> import java.io.File;import java.util.concurrent.CompletionStage;
>>> /**
>>>  * Created by Murtuza on 10/19/2016.
>>>  */public class EventFilter {
>>>
>>> public static void main(String[] args) {
>>>
>>> State filteredState = new State("ok");
>>> ActorSystem system = ActorSystem.create("system");
>>> ActorMaterializer mat = ActorMaterializer.create(system);
>>> Function decider = thr 
>>> ->SupervisorStrategy.resume();
>>>
>>> mat.settings().withSupervisionStrategy(decider);
>>>
>>> }
>>>
>>> Below supervisionStrategy expects a Function1 unlike for the mat which 
>>> expects a japi function
>>>
>>>
>>> Flow parse = Flow.of(String.class)
>>> .map(x -> {
>>> //System.out.println(LogStreamProcessor.parseLineEx(x).get());
>>> return LogStreamProcessor.parseLineEx(x).get();
>>>
>>> }).withAttributes(ActorAttributes.supervisionStrategy(...));
>>>
>>> So I am kinda confused on passing the strategy.
>>>
>>> Any help will be greatly appreciated.
>>>
>>> -chhil
>>> ​
>>>
>> --
>> >>>>>>>>>> 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] Re: withSupervisionStrategy passed a japi Function but compiler complains that its expecting a scala Function1

2016-10-26 Thread murtuza chhil
Thanks Konrad.

-chhil


On Wednesday, October 26, 2016 at 6:01:34 PM UTC+5:30, Konrad Malawski 
wrote:
>
> Well that's exactly the thing we fixed.
> As you've found in the docs.
>
> We'll release a stable this week, please upgrade then.
>
> -- 
> Konrad `ktoso` Malawski
> Akka <http://akka.io> @ Lightbend <http://lightbend.com>
>
> On 26 October 2016 at 13:29:52, murtuza chhil (chi...@gmail.com 
> ) wrote:
>
> Still looking for an answer to this, if anyone can point out whats wrong 
> and how to get it done. 
> I was looking at some HTTP docs and there was a fix in there and wonder if 
> the problem is related
>
>
> http://doc.akka.io/docs/akka-http/current/java/http/migration-guide/migration-guide-2.4.x-3.0.x.html#akka-http-2-4-11-3-0-0
>
> "The Java DSL for the following directives pathPrefixText, 
> rawPathPrefixTest, rawPathPrefix, pathSuffix
> accidentally used the Scala function type instead of the 
> java.util.function.Function"
>
> -chhil
>
> On Thursday, October 20, 2016 at 10:33:03 PM UTC+5:30, murtuza chhil 
> wrote: 
>>
>> Having trouble setting up withSupervisionStrategy for the materializer.
>>
>> I get a compile time error of
>>
>>   Error:(30, 23) java: no suitable method found for 
>> withSupervisionStrategy(akka.japi.function.Function)
>> method 
>> akka.stream.ActorMaterializerSettings.withSupervisionStrategy(scala.Function1)
>>  is not applicable
>>   (argument mismatch; 
>> akka.japi.function.Function
>>  cannot be converted to 
>> scala.Function1)
>> method 
>> akka.stream.ActorMaterializerSettings.withSupervisionStrategy(akka.japi.function.Function)
>>  is not applicable
>>   (argument mismatch; 
>> akka.japi.function.Function
>>  cannot be converted to 
>> akka.japi.function.Function)
>>
>> It for some reason is confusing the method that would be used for scala 
>> (expecting a function1).
>> How do I get this to compile using java?
>>
>> import akka.NotUsed;import akka.actor.ActorSystem;import 
>> akka.actor.SupervisorStrategy;import akka.japi.function.Function;import 
>> akka.stream.ActorAttributes;import akka.stream.ActorMaterializer;import 
>> akka.stream.IOResult;import akka.stream.Supervision;import 
>> akka.stream.javadsl.*;import akka.util.ByteString;import scala.Function1;
>> import java.io.File;import java.util.concurrent.CompletionStage;
>> /**
>>  * Created by Murtuza on 10/19/2016.
>>  */public class EventFilter {
>>
>> public static void main(String[] args) {
>>
>> State filteredState = new State("ok");
>> ActorSystem system = ActorSystem.create("system");
>> ActorMaterializer mat = ActorMaterializer.create(system);
>> Function decider = thr 
>> ->SupervisorStrategy.resume();
>>
>> mat.settings().withSupervisionStrategy(decider);
>>
>> }
>>
>> Below supervisionStrategy expects a Function1 unlike for the mat which 
>> expects a japi function
>>
>>
>> Flow parse = Flow.of(String.class)
>> .map(x -> {
>> //System.out.println(LogStreamProcessor.parseLineEx(x).get());
>> return LogStreamProcessor.parseLineEx(x).get();
>>
>> }).withAttributes(ActorAttributes.supervisionStrategy(...));
>>
>> So I am kinda confused on passing the strategy.
>>
>> Any help will be greatly appreciated.
>>
>> -chhil
>> ​
>>
> --
> >>>>>>>>>> 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.


[akka-user] Re: withSupervisionStrategy passed a japi Function but compiler complains that its expecting a scala Function1

2016-10-26 Thread murtuza chhil
Still looking for an answer to this, if anyone can point out whats wrong 
and how to get it done.
I was looking at some HTTP docs and there was a fix in there and wonder if 
the problem is related

http://doc.akka.io/docs/akka-http/current/java/http/migration-guide/migration-guide-2.4.x-3.0.x.html#akka-http-2-4-11-3-0-0

"The Java DSL for the following directives pathPrefixText, 
rawPathPrefixTest, rawPathPrefix, pathSuffix
accidentally used the Scala function type instead of the 
java.util.function.Function"

-chhil

On Thursday, October 20, 2016 at 10:33:03 PM UTC+5:30, murtuza chhil wrote:
>
> Having trouble setting up withSupervisionStrategy for the materializer.
>
> I get a compile time error of
>
>   Error:(30, 23) java: no suitable method found for 
> withSupervisionStrategy(akka.japi.function.Function)
> method 
> akka.stream.ActorMaterializerSettings.withSupervisionStrategy(scala.Function1)
>  is not applicable
>   (argument mismatch; 
> akka.japi.function.Function
>  cannot be converted to 
> scala.Function1)
> method 
> akka.stream.ActorMaterializerSettings.withSupervisionStrategy(akka.japi.function.Function)
>  is not applicable
>   (argument mismatch; 
> akka.japi.function.Function
>  cannot be converted to 
> akka.japi.function.Function)
>
> It for some reason is confusing the method that would be used for scala 
> (expecting a function1).
> How do I get this to compile using java?
>
> import akka.NotUsed;import akka.actor.ActorSystem;import 
> akka.actor.SupervisorStrategy;import akka.japi.function.Function;import 
> akka.stream.ActorAttributes;import akka.stream.ActorMaterializer;import 
> akka.stream.IOResult;import akka.stream.Supervision;import 
> akka.stream.javadsl.*;import akka.util.ByteString;import scala.Function1;
> import java.io.File;import java.util.concurrent.CompletionStage;
> /**
>  * Created by Murtuza on 10/19/2016.
>  */public class EventFilter {
>
> public static void main(String[] args) {
>
> State filteredState = new State("ok");
> ActorSystem system = ActorSystem.create("system");
> ActorMaterializer mat = ActorMaterializer.create(system);
> Function decider = thr 
> ->SupervisorStrategy.resume();
>
> mat.settings().withSupervisionStrategy(decider);
>
> }
>
> Below supervisionStrategy expects a Function1 unlike for the mat which 
> expects a japi function
>
>
> Flow parse = Flow.of(String.class)
> .map(x -> {
> //System.out.println(LogStreamProcessor.parseLineEx(x).get());
> return LogStreamProcessor.parseLineEx(x).get();
>
> }).withAttributes(ActorAttributes.supervisionStrategy(...));
>
> So I am kinda confused on passing the strategy.
>
> Any help will be greatly appreciated.
>
> -chhil
> ​
>

-- 
>>>>>>>>>>  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] withSupervisionStrategy passed a japi Function but compiler complains that its expecting a scala Function1

2016-10-20 Thread murtuza chhil


Having trouble setting up withSupervisionStrategy for the materializer.

I get a compile time error of

  Error:(30, 23) java: no suitable method found for 
withSupervisionStrategy(akka.japi.function.Function)
method 
akka.stream.ActorMaterializerSettings.withSupervisionStrategy(scala.Function1)
 is not applicable
  (argument mismatch; 
akka.japi.function.Function
 cannot be converted to 
scala.Function1)
method 
akka.stream.ActorMaterializerSettings.withSupervisionStrategy(akka.japi.function.Function)
 is not applicable
  (argument mismatch; 
akka.japi.function.Function
 cannot be converted to 
akka.japi.function.Function)

It for some reason is confusing the method that would be used for scala 
(expecting a function1).
How do I get this to compile using java?

import akka.NotUsed;import akka.actor.ActorSystem;import 
akka.actor.SupervisorStrategy;import akka.japi.function.Function;import 
akka.stream.ActorAttributes;import akka.stream.ActorMaterializer;import 
akka.stream.IOResult;import akka.stream.Supervision;import 
akka.stream.javadsl.*;import akka.util.ByteString;import scala.Function1;
import java.io.File;import java.util.concurrent.CompletionStage;
/**
 * Created by Murtuza on 10/19/2016.
 */public class EventFilter {

public static void main(String[] args) {

State filteredState = new State("ok");
ActorSystem system = ActorSystem.create("system");
ActorMaterializer mat = ActorMaterializer.create(system);
Function decider = thr 
->SupervisorStrategy.resume();

mat.settings().withSupervisionStrategy(decider);

}

Below supervisionStrategy expects a Function1 unlike for the mat which 
expects a japi function


Flow parse = Flow.of(String.class)
.map(x -> {
//System.out.println(LogStreamProcessor.parseLineEx(x).get());
return LogStreamProcessor.parseLineEx(x).get();

}).withAttributes(ActorAttributes.supervisionStrategy(...));

So I am kinda confused on passing the strategy.

Any help will be greatly appreciated.

-chhil
​

-- 
>>  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-java] Exception in completionstage handling disappears without a trace

2016-10-17 Thread murtuza chhil
Hi,

Just some simple java code to learn some basics of materialized values.
There is an intentional error in the code snippet  in the String.format 
that uses an invalid %l which actually throws an exception but nothing gets 
printed in the console.
What exactly is happening and how does one handle a scenarios like this to 
actually see/debug the exception?
​
​

public class Sample {

public static void main(String[] args) throws IOException{

ActorSystem system = ActorSystem.create("system");
ActorMaterializer mat = ActorMaterializer.create(system);

Source> source = 
FileIO.fromFile(new File("blah.txt"));

Sink> sink = FileIO.toFile(new 
File("c:\\temp\\blah.txt.copy"));

RunnableGraph>  runnableGraph = 
source.to(sink);

//RunnableGraph> runnableGraph1 = 
source.toMat(sink, Keep.left());

//RunnableGraph> runnableGraph2 = 
source.toMat(sink, Keep.right());

//RunnableGraph, 
CompletionStage>> pairRunnableGraph = source.toMat(sink, Keep.both());

final CompletionStage cs = runnableGraph.run(mat).handle((x, 
t) -> {
if(t!=null){
System.out.println("Error: " + t);
}
if (x!=null){
String s = String.format("%s , %l bytes 
read",x.status(),x.count());
System.out.println(s);
}
return null;
});

​
-chhil

-- 
>>  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] Basic Akka stream server not receiving data sent by client

2016-08-19 Thread murtuza chhil
Thank you for the pointer.

Changed it to the following
```java
 final List options = new ArrayList();
Source> 
serverSource = Tcp

.get(system).bind("127.0.0.1",6000,100,options,true,Duration.create(5, 
TimeUnit.MINUTES));
```
Now I get the data.


I was mimicking this scala code 
<https://github.com/adamw/reactive-akka-pres/blob/master/src/main/scala/com/softwaremill/reactive/step1/ReceiverStep1.scala>
 after 
watching Adams youtube video. 
Does the scala implementation get away by not defining the halfclose option 
or its done behind the scenes or its an older version of akka that allows 
it?

-chhil

On Friday, August 19, 2016 at 2:54:36 PM UTC+5:30, Akka Team wrote:
>
>
>
> On Sun, Aug 14, 2016 at 2:18 PM, murtuza chhil  > wrote:
>
>> Hi,
>>
>> I have a simple client that reads a csv file and send it across. When I 
>> have a netcat server I can see the data come through.
>>
>> However when I have a Akka stream based server I do see the connection 
>> but I don't see the data come through. 
>>
>> Could someone be kind enough to let me know where I have screwed up?
>>
>> Server code 
>>
>>
>> ActorSystem system = ActorSystem.create("System");
>> ActorMaterializer mat = ActorMaterializer.create(system);
>>
>> Source> 
>> serverSource = Tcp
>> .get(system).bind("127.0.0.1", 6000);
>> serverSource.runForeach(
>> conn -> {
>> System.out.println(conn.remoteAddress());
>> Sink receiveSink = conn
>> .flow()
>> .via(Framing.delimiter(
>> ByteString.fromString("\r\n"), 10))
>> .to(Sink.foreach(str -> {
>> System.out.println("< " + str);
>> // Thread.sleep(10);
>> }));
>> Source emptySource = Source.empty();
>> emptySource.to(receiveSink).run(mat);
>>
>> Since you run with an emptySource, the connection will be closed, because 
> you just completed the output side of your TCP connection (because of the 
> emptySource) and you have halfClose = false in your bind command (the 
> default).
>  
>
>>
>>
>> }, mat);
>>
>> ​
>>
>>
>> Client code : Reads a file, prints it line by and sends it over the 
>> socket. The connecting and sending part works as I can see the data 
>> received at a netcat server.
>>
>> ActorSystem system = ActorSystem.create("client");
>> ActorMaterializer mat = ActorMaterializer.create(system);
>>
>> Flow> 
>> serverConnection = Tcp
>> .get(system).outgoingConnection("127.0.0.1", 6000);
>> Path file = Paths.get("C:\\temp\\Generic.csv");
>> CompletionStage cs = FileIO.fromPath(file)
>>
>> .via(Framing.delimiter(ByteString.fromString("\r\n"), 10))
>> .map(str -> {
>> System.out.println(str.utf8String());
>> return str.concat(ByteString.fromString("\r\n"));
>> })
>>
>> .via(serverConnection).to(akka.stream.javadsl.Sink.ignore())
>> .run(mat);
>>
>> ​
>> -chhil
>>
>> -- 
>> >>>>>>>>>> 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 <http://www.lightbend.com/> - 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+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: Access Denied Downloading standalone akka_2.11-2.4.9-RC2.zip

2016-08-15 Thread murtuza chhil
Its working now.

-chhil

On Monday, August 15, 2016 at 8:56:37 AM UTC+5:30, murtuza chhil wrote:
>
> Hello, 
>
> Get an error  downloading  latest standalone release from page 
> http://akka.io/downloads/
>
> The zip downlod link is 
>
> http://downloads.typesafe.com/akka/akka_2.11-2.4.9-RC2.zip?_ga=1.68079190.614045507.1468130713
>
> Error page Content
>
>  encoding="UTF-8"?>AccessDeniedAccess 
> Denied4E93081229D790D5hTqKBgBzP1ydnHywim1E/9e/YrVnhfWyZQ+m39zdiIqoJMrd+VwOLyCBQ+pTw4DX5vByBmimSBs=
>
> ​
>
> -chhil
>

-- 
>>>>>>>>>>  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] Access Denied Downloading standalone akka_2.11-2.4.9-RC2.zip

2016-08-14 Thread murtuza chhil
Hello, 

Get an error  downloading  latest standalone release from page 
http://akka.io/downloads/

The zip downlod link is 
http://downloads.typesafe.com/akka/akka_2.11-2.4.9-RC2.zip?_ga=1.68079190.614045507.1468130713

Error page Content

AccessDeniedAccess 
Denied4E93081229D790D5hTqKBgBzP1ydnHywim1E/9e/YrVnhfWyZQ+m39zdiIqoJMrd+VwOLyCBQ+pTw4DX5vByBmimSBs=

​

-chhil

-- 
>>  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] Basic Akka stream server not receiving data sent by client

2016-08-14 Thread murtuza chhil
Hi,

I have a simple client that reads a csv file and send it across. When I 
have a netcat server I can see the data come through.

However when I have a Akka stream based server I do see the connection but 
I don't see the data come through. 

Could someone be kind enough to let me know where I have screwed up?

Server code 


ActorSystem system = ActorSystem.create("System");
ActorMaterializer mat = ActorMaterializer.create(system);

Source> serverSource 
= Tcp
.get(system).bind("127.0.0.1", 6000);
serverSource.runForeach(
conn -> {
System.out.println(conn.remoteAddress());
Sink receiveSink = conn
.flow()
.via(Framing.delimiter(
ByteString.fromString("\r\n"), 10))
.to(Sink.foreach(str -> {
System.out.println("< " + str);
// Thread.sleep(10);
}));
Source emptySource = Source.empty();
emptySource.to(receiveSink).run(mat);

}, mat);

​


Client code : Reads a file, prints it line by and sends it over the socket. 
The connecting and sending part works as I can see the data received at a 
netcat server.

ActorSystem system = ActorSystem.create("client");
ActorMaterializer mat = ActorMaterializer.create(system);

Flow> 
serverConnection = Tcp
.get(system).outgoingConnection("127.0.0.1", 6000);
Path file = Paths.get("C:\\temp\\Generic.csv");
CompletionStage cs = FileIO.fromPath(file)

.via(Framing.delimiter(ByteString.fromString("\r\n"), 10))
.map(str -> {
System.out.println(str.utf8String());
return str.concat(ByteString.fromString("\r\n"));
})

.via(serverConnection).to(akka.stream.javadsl.Sink.ignore())
.run(mat);

​
-chhil

-- 
>>  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: explanation of pickMaxOfThree

2016-08-05 Thread murtuza chhil

Hi Gitted,

I am a newbie and not much of a scala guy

The example referenced is for producing the largest of the 3 numbers input.

zip1's zipwith is using 2 of the 3 numbers as input and producing one 
output that is the larger of the 2 numbers.
zip2's zipwith is going to use the third number and output of the max of 
zip1's 2 numbers getting you the largest of the 3 as output..

Look at  scaladoc  for zipwith 
 and 
zipwith2 
. 
The latter explains the in0, in1 and out (2 inputs 1 output)

UniformFanInShape takes an outlet and a number of inlets. [see doc here 

]
zip2.out is going to be the max value outputted and zip1.in0, zip1.in1 and 
zip2.in1 are going to take the 3 numbers as input (via the 
source.single(..)). 
Remember zip2.in0 is connected with zip1.out. 



-chhil

On Thursday, August 4, 2016 at 11:36:08 PM UTC+5:30, gitted wrote:
>
>
>1. Hello,
>
> Hoping someone can explain the example given herE: 
> http://doc.akka.io/docs/akka/2.4.9-RC1/scala/stream/stream-graphs.html
>
>1. 
>2. val pickMaxOfThree = GraphDSL.create() { implicit b =>
>3. import GraphDSL.Implicits._
>4.  
>5. val zip1 = b.add(ZipWith[Int, Int, Int](math.max _))
>6. val zip2 = b.add(ZipWith[Int, Int, Int](math.max _))
>7. zip1.out ~> zip2.in0
>8.  
>9. UniformFanInShape(zip2.out, zip1.in0, zip1.in1, zip2.in1)
>10. }
>
> This graph is returning a UniformFanInShape, which from what I understand 
> is multiple inputs and a single output correct?
>
> Can someone detail what this line is doing:
>
>1. val zip1 = b.add(ZipWith[Int, Int, Int](math.max _))
>
> Why does ZipWith have 3 type parameters? Is it just input, input and 
> output i.e [Int, Int, Int]
>
> Can someone explain what .out, .in0, .in1 etc. are doing here? 
>
>1. UniformFanInShape(zip2.out, zip1.in0, zip1.in1, zip2.in1)
>
>
>
>
>

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


[akka-user] Re: Akka Java TCP client , Sink.ignore()

2016-08-01 Thread murtuza chhil
Thanks for the clarification Konrad.
I kind  of figured it was a NoOp sink, but wasn't sure if there would be 
any side effects due to lack of knowledge.
For now my baby step simply wants to connect. As I move forward the 
Sink.ignore will get replaced by a sink that handles the responses.
My problem was resolved in this thread 
<https://groups.google.com/d/msg/akka-user/p4aWQQEJQts/qNFCDLjoBgAJ>.

-chhil

On Monday, August 1, 2016 at 12:45:22 PM UTC+5:30, Johan Andrén wrote:
>
> Hi Chhil,
>
> If you do not care about any incoming data from the TCP server Sink.ignore 
> should be fine (it will accept but discard any data from the server).
>
> --
> Johan
> Akka Team
>
> On Friday, July 29, 2016 at 12:48:52 PM UTC+2, murtuza chhil wrote:
>>
>>
>> Hi,
>>
>> I am an Akka newbie trying to get my head around streams.
>>
>> In the following working snippet, if I have a netcat server running I can 
>> get the client to send the bytes across.
>>
>> The sink.ignore that I added is simply because I needed a sink to connect 
>> to to run the graph. Is that really needed and how would I run something 
>> without it because as I see it, 
>> I have a source and a the flow created by the Tcp.get(), that should 
>> be sufficient to send the data. 
>>
>> Did have a look at the TCpEcho example, but I want to do it without the 
>> runfold.
>>
>> ```
>> Flow> flow = 
>> Tcp
>> .get(system).outgoingConnection("127.0.0.1", 6000);
>> Source clientSource = Source.single(ByteString
>> .fromString("Chhil"));
>> clientSource.via(flow).to(Sink.ignore()).run(mat);
>> ```
>>
>> -chhil
>>
>

-- 
>>>>>>>>>>  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-streams] Trying to mimic socket level programming , connect client and then send data if connection is available

2016-08-01 Thread murtuza chhil
Hi Konrad,

The  Source>> 
clientSource = Source.maybe(); does the trick, don't see a 
disconnect on the netcat server send.
Also figured, I shouldn't be running the graph multiple times once to 
connect and the second time to send data. Once its run, any data fed by the 
source will be sent out.
This was the reason I was seeing multiple connections.

Thank you. Appreciate the help.

-chhil

On Monday, August 1, 2016 at 2:57:47 PM UTC+5:30, Konrad Malawski wrote:
>
> Source.single completes the stream (closes the connection) once it has 
> signalled the data.
> Simply put a Source.maybe behind it (a.concat(b)) or use a different 
> source, like unfold or an iterator).
>
> -- 
> Konrad `ktoso` Malawski
> Akka <http://akka.io> @ Lightbend <http://lightbend.com>
>
> On 1 August 2016 at 11:24:51, murtuza chhil (chi...@gmail.com 
> ) wrote:
>
> Hi Johan,
>
> Thank you very much. Yes indeed stream + tcp is hurting me for sure and I 
> have tried reading the docs and sample code over and over.
>
> So yes, I made some progress. Please ignore the verbosity of the code, I 
> just need to familiarize myself with return values and look at the source 
> of those easily via eclipse.
>
>
> final ActorSystem system = ActorSystem.create("Client");
> final ActorMaterializer mat = ActorMaterializer.create(system);
>
> Tcp tcp = Tcp.get(system);
> Flow> 
> outgoingConnection = tcp
> .outgoingConnection("127.0.0.1", 6000);
>
> Source clientSource = Source.empty();  
>
> CompletionStage cs = clientSource.via(outgoingConnection)
> .runWith(Sink.ignore(), mat);
>
> cs.exceptionally(ex -> {
> ex.printStackTrace();
> return null;
> });
>
> Source clientSource1 = Source.single(ByteString
> .fromString("Chhil"));  
>
> NotUsed var = clientSource1.via(outgoingConnection).to(Sink.ignore())
> .run(mat);
>
> ​
>
> Managed to get a connection made usingSource.empty()​ for the initial 
> connect.
> The CompletionStage kicks in nicely. You mentioned I should be able to get 
>  CompletionStage to determine problems with the 
> connection, this I don't know how or when it gets returned when the graph 
> is run. Please do correct me if understanding is wrong.
> I use the materialized value from the connect and that works fine, as I 
> don't see a new connect after the initial connect with the Source.empty(). 
> I assume this is the right way to get the initial connection and then 
> change the source for regular communication.
>
> *Now the problem I have run into is, that after sending data, the channel 
> disconnects. What must I do to keep it open?*
>
> -chhil
>
>
> On Monday, August 1, 2016 at 12:31:08 PM UTC+5:30, Johan Andrén wrote: 
>>
>> Hi Chhil, 
>>
>> The flow returned by outgoingConnection materializes into a 
>> CompletionStage which will be failed if the 
>> connection fails, so that is where you can implement your error handling 
>> for the initial connection. You would have to keep the materialized value 
>> when you construct the flow though, so that it is returned from run(). 
>>
>> You can read more about materialized values here: 
>> http://doc.akka.io/docs/akka/2.4/java/stream/stream-composition.html#materialized-values
>>  
>> and TCP with streams here: 
>> http://doc.akka.io/docs/akka/2.4/java/stream/stream-io.html#stream-io-java 
>>  
>>
>> In general, read as much of the streams docs as you can to get a good 
>> understanding of how Akka Streams work, trial and error with streams + tcp 
>> will hurt!
>>
>> --
>> Johan
>> Akka Team
>>
>> On Monday, August 1, 2016 at 7:20:23 AM UTC+2, murtuza chhil wrote: 
>>>
>>> Hello, 
>>>
>>> I am a newbie trying to understand Akka Streams.
>>>
>>> Coming from regular socket programming I am trying to mimic a client 
>>> connection and have the following runnable graph.
>>>
>>> Flow> 
>>> flow = Tcp
>>> .get(system).outgoingConnection("127.0.0.1", 6000);
>>> Source clientSource = Source.single(ByteString
>>> .fromString("XYZ"));
>>>
>>> clientSource.via(flow).to(Sink.ignore()).run(mat);
>>>
>>> ​
>>>
>>> This works fine when used with the samples in the doc, where the source 
>>> is attached that has a list and there is a server listening and

[akka-user] Re: [akka-streams] Trying to mimic socket level programming , connect client and then send data if connection is available

2016-08-01 Thread murtuza chhil
Hi Johan,

Thank you very much. Yes indeed stream + tcp is hurting me for sure and I 
have tried reading the docs and sample code over and over.

So yes, I made some progress. Please ignore the verbosity of the code, I 
just need to familiarize myself with return values and look at the source 
of those easily via eclipse.


final ActorSystem system = ActorSystem.create("Client");
final ActorMaterializer mat = ActorMaterializer.create(system);

Tcp tcp = Tcp.get(system);
Flow> 
outgoingConnection = tcp
.outgoingConnection("127.0.0.1", 6000);

Source clientSource = Source.empty(); 

CompletionStage cs = clientSource.via(outgoingConnection)
.runWith(Sink.ignore(), mat);

cs.exceptionally(ex -> {
ex.printStackTrace();
return null;
});

Source clientSource1 = Source.single(ByteString
.fromString("Chhil")); 

NotUsed var = clientSource1.via(outgoingConnection).to(Sink.ignore())
.run(mat);

​

Managed to get a connection made usingSource.empty()​ for the initial 
connect.
The CompletionStage kicks in nicely. You mentioned I should be able to get  
CompletionStage 
to determine problems with the connection, this I don't know how or when it 
gets returned when the graph is run. Please do correct me if understanding 
is wrong.
I use the materialized value from the connect and that works fine, as I 
don't see a new connect after the initial connect with the Source.empty(). 
I assume this is the right way to get the initial connection and then 
change the source for regular communication.

*Now the problem I have run into is, that after sending data, the channel 
disconnects. What must I do to keep it open?*

-chhil


On Monday, August 1, 2016 at 12:31:08 PM UTC+5:30, Johan Andrén wrote:
>
> Hi Chhil,
>
> The flow returned by outgoingConnection materializes into a 
> CompletionStage which will be failed if the 
> connection fails, so that is where you can implement your error handling 
> for the initial connection. You would have to keep the materialized value 
> when you construct the flow though, so that it is returned from run(). 
>
> You can read more about materialized values here: 
> http://doc.akka.io/docs/akka/2.4/java/stream/stream-composition.html#materialized-values
>  
> and TCP with streams here: 
> http://doc.akka.io/docs/akka/2.4/java/stream/stream-io.html#stream-io-java 
>  
>
> In general, read as much of the streams docs as you can to get a good 
> understanding of how Akka Streams work, trial and error with streams + tcp 
> will hurt!
>
> --
> Johan
> Akka Team
>
> On Monday, August 1, 2016 at 7:20:23 AM UTC+2, murtuza chhil wrote:
>>
>> Hello,
>>
>> I am a newbie trying to understand Akka Streams.
>>
>> Coming from regular socket programming I am trying to mimic a client 
>> connection and have the following runnable graph.
>>
>> Flow> 
>> flow = Tcp
>> .get(system).outgoingConnection("127.0.0.1", 6000);
>> Source clientSource = Source.single(ByteString
>> .fromString("XYZ"));
>>
>> clientSource.via(flow).to(Sink.ignore()).run(mat);
>>
>> ​
>>
>> This works fine when used with the samples in the doc, where the source 
>> is attached that has a list and there is a server listening and we run the 
>> source->flow->sink through a materializer.
>>
>> But this is not a typical use case, typically one would attempt to 
>> connect to a server,  and either it connects or fails. If connected send 
>> data that will be made available and if connection fails, have the ability 
>> to backoff.
>>
>>
>> Currently I don't know how to access the error when a server is not 
>> available and want to establish a connection before data is available.
>> Don't know how to prevent connections every time data is sent, I 
>> understand why it happens, but don't know how to reuse a materialized flow 
>> that has already connected.
>> What I am trying to get my head around is how does one run a graph 
>> without any source data and get a completable future that tells me if it 
>> succeeded or not.
>> Then I want to use the same connection to send data later using the 
>> source.
>>
>> I have attempted with a runfold and that give me the akka TCP Exception 
>> when the server is not availble, but I simply want to forward the data from 
>> the source without manipulation.
>>
>> There was another thread that I had started 
>> https://groups.google.com/d/msg/akka-user/1z

[akka-user] [akka-streams] Trying to mimic socket level programming , connect client and then send data if connection is available

2016-07-31 Thread murtuza chhil
Hello,

I am a newbie trying to understand Akka Streams.

Coming from regular socket programming I am trying to mimic a client 
connection and have the following runnable graph.

Flow> flow 
= Tcp
.get(system).outgoingConnection("127.0.0.1", 6000);
Source clientSource = Source.single(ByteString
.fromString("XYZ"));

clientSource.via(flow).to(Sink.ignore()).run(mat);

​

This works fine when used with the samples in the doc, where the source is 
attached that has a list and there is a server listening and we run the 
source->flow->sink through a materializer.

But this is not a typical use case, typically one would attempt to connect 
to a server,  and either it connects or fails. If connected send data that 
will be made available and if connection fails, have the ability to backoff.


Currently I don't know how to access the error when a server is not 
available and want to establish a connection before data is available.
Don't know how to prevent connections every time data is sent, I understand 
why it happens, but don't know how to reuse a materialized flow that has 
already connected.
What I am trying to get my head around is how does one run a graph without 
any source data and get a completable future that tells me if it succeeded 
or not.
Then I want to use the same connection to send data later using the source.

I have attempted with a runfold and that give me the akka TCP Exception 
when the server is not availble, but I simply want to forward the data from 
the source without manipulation.

There was another thread that I had 
started https://groups.google.com/d/msg/akka-user/1ztizMy9FnI/U9toR-cOBgAJ, 
would appreciate if someone responds to it. 

Any pointers or snippets would be greatly appreciated. Yes I am not used to 
this paradigm of programming but trying to figure it out.

-chhil

-- 
>>  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 Java TCP client , Sink.ignore()

2016-07-29 Thread murtuza chhil

Hi,

I am an Akka newbie trying to get my head around streams.

In the following working snippet, if I have a netcat server running I can 
get the client to send the bytes across.

The sink.ignore that I added is simply because I needed a sink to connect 
to to run the graph. Is that really needed and how would I run something 
without it because as I see it, 
I have a source and a the flow created by the Tcp.get(), that should be 
sufficient to send the data. 

Did have a look at the TCpEcho example, but I want to do it without the 
runfold.

```
Flow> flow = Tcp
.get(system).outgoingConnection("127.0.0.1", 6000);
Source clientSource = Source.single(ByteString
.fromString("Chhil"));
clientSource.via(flow).to(Sink.ignore()).run(mat);
```

-chhil

-- 
>>  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.