Re: [akka-user] [akka-stream] Multi input/output flow

2016-08-25 Thread Konrad Malawski
Just replace the /scala/ in the url to /java/ :-)

So it becomes:
http://doc.akka.io/docs/akka/2.4.9/java/stream/stream-graphs.html

All Akka APIs have 100% coverage in both languages / DSLs.

The Java / Scala API for GraphStage is exactly the same class btw, so you
can read any blogs etc about it and won't even really notice it's Scala :-)
-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 

On 25 August 2016 at 20:31:33, Sergey Sopin (sopin1...@gmail.com) wrote:

Thanks a lot! It is exactly what I need, but can I do the same in Java?

Regards,
Sergey

четверг, 25 августа 2016 г., 21:16:44 UTC+3 пользователь Konrad Malawski
написал:
>
> If it has more than 1 input and 1 output it's not a Flow anymore, so let's
> not refer to it as a Flow.
> It's a Graph of a given Shape.
>
> There's nothing special about Shape, so if you want a custom one, you
> simply extend Shape, as is documented in the reference docs:
> http://doc.akka.io/docs/akka/2.4.9/scala/stream/stream-
> graphs.html#building-reusable-graph-components
>
> Notice that it's still fully typesafe for users of the shape!
>
> --
> Konrad `ktoso` Malawski
> Akka  @ Lightbend 
>
> On 25 August 2016 at 20:07:02, Sergey Sopin (sopi...@gmail.com
> ) wrote:
>
> Thanks a lot for your response.
>
> However it is still not clear.
> I am talking about FlowShape with several Inlets and Outlets. As I
> understood from: http://doc.akka.io/docs/akka/2.4/java/stream/stream-
> customize.html#Custom_linear_processing_stages_using_GraphStage
> I have to create Shape by myself as a pair of Inlet and Outlet, but in my
> case I either need to create all possible combinations of Inlets & Outlets
> and return one of them from the function
>   @Override
>   public SourceShape shape() {
> return shape;
>   }
> or invent something new.
>
> First option will not work in my case, so I need something new here.
>
> Could you please tell me how to create such multi inlet/outlet shape? Or
> please explain me if I don't understand something.
> Thanks a lot!
>
>
> четверг, 25 августа 2016 г., 17:50:00 UTC+3 пользователь Konrad Malawski
> написал:
>>
>> Handlers have no shape. The GraphStage does.
>>
>> So your stage has some shape.
>>
>> And then you set as many handlers as you need.
>>
>> Still simple sources and sinks, but we just published a blog post
>> explaining it a bit more: http://blog.akka.io/integrations/2016/08/25/
>> simple-sink-source-with-graphstage
>>
>> --
>> Konrad `ktoso` Malawski
>> Akka  @ Lightbend 
>>
>> On 25 August 2016 at 15:55:14, Sergey Sopin (sopi...@gmail.com) wrote:
>>
>> Hi,
>>
>> I am trying to create multi input/output flow. It should obtain messages
>> from different Inlets and emit to different Outlets based on parameter
>> inside the message.
>>
>> Something like following:
>>
>>1. ...
>>A elem = grab(in1);
>>2.if (p.test(elem)) {
>>3.  push(out1, elem);
>>4.} else {
>>5.  push(out2, elem);
>>6.}
>>...
>>
>>
>> But, usual case is when I am creating shape and setting handler for it.
>> It seems that in my case I need different shapes inside one handler.
>>
>> Thanks a lot!
>>
>> Regards,
>> Sergey
>>
>>
>> --
>> >> Read the docs: http://akka.io/docs/
>> >> Check the FAQ: http://doc.akka.io/docs/akka/
>> current/additional/faq.html
>> >> Search the archives: https://groups.google.com/group/akka-user
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "Akka User List" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to akka-user+...@googlegroups.com.
>> To post to this group, send email to akka...@googlegroups.com.
>> Visit this group at https://groups.google.com/group/akka-user.
>> For more options, visit https://groups.google.com/d/optout.
>>
>> --
> >> Read the docs: http://akka.io/docs/
> >> Check the FAQ: http://doc.akka.io/docs/akka/
> current/additional/faq.html
> >> Search the archives: https://groups.google.com/group/akka-user
> ---
> You received this message because you are subscribed to the Google Groups
> "Akka User List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to akka-user+...@googlegroups.com .
> To post to this group, send email to akka...@googlegroups.com
> .
> Visit this group at https://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>
> --
>> Read the docs: http://akka.io/docs/
>> Check the FAQ:
http://doc.akka.io/docs/akka/current/additional/faq.html
>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups
"Akka User List" group.
To unsubscribe from this group and stop receiving emails 

Re: [akka-user] [akka-stream] Multi input/output flow

2016-08-25 Thread Sergey Sopin
Thanks a lot! It is exactly what I need, but can I do the same in Java? 

Regards,
Sergey

четверг, 25 августа 2016 г., 21:16:44 UTC+3 пользователь Konrad Malawski 
написал:
>
> If it has more than 1 input and 1 output it's not a Flow anymore, so let's 
> not refer to it as a Flow.
> It's a Graph of a given Shape.
>
> There's nothing special about Shape, so if you want a custom one, you 
> simply extend Shape, as is documented in the reference docs:
>
> http://doc.akka.io/docs/akka/2.4.9/scala/stream/stream-graphs.html#building-reusable-graph-components
>  
>
> Notice that it's still fully typesafe for users of the shape!
>
> -- 
> Konrad `ktoso` Malawski
> Akka  @ Lightbend 
>
> On 25 August 2016 at 20:07:02, Sergey Sopin (sopi...@gmail.com 
> ) wrote:
>
> Thanks a lot for your response.  
>
> However it is still not clear.  
> I am talking about FlowShape with several Inlets and Outlets. As I 
> understood from: 
> http://doc.akka.io/docs/akka/2.4/java/stream/stream-customize.html#Custom_linear_processing_stages_using_GraphStage
> I have to create Shape by myself as a pair of Inlet and Outlet, but in my 
> case I either need to create all possible combinations of Inlets & Outlets 
> and return one of them from the function 
>   @Override
>   public SourceShape shape() {
> return shape;
>   }
> or invent something new. 
>
> First option will not work in my case, so I need something new here.
>
> Could you please tell me how to create such multi inlet/outlet shape? Or 
> please explain me if I don't understand something. 
> Thanks a lot!
>
>
> четверг, 25 августа 2016 г., 17:50:00 UTC+3 пользователь Konrad Malawski 
> написал: 
>>
>> Handlers have no shape. The GraphStage does.
>>
>> So your stage has some shape.
>>
>> And then you set as many handlers as you need.
>>
>> Still simple sources and sinks, but we just published a blog post 
>> explaining it a bit more: 
>> http://blog.akka.io/integrations/2016/08/25/simple-sink-source-with-graphstage
>>
>> -- 
>> Konrad `ktoso` Malawski
>> Akka  @ Lightbend 
>>
>> On 25 August 2016 at 15:55:14, Sergey Sopin (sopi...@gmail.com) wrote:
>>
>> Hi, 
>>
>> I am trying to create multi input/output flow. It should obtain messages 
>> from different Inlets and emit to different Outlets based on parameter 
>> inside the message. 
>>
>> Something like following:
>>
>>1. ...
>>A elem = grab(in1); 
>>2.if (p.test(elem)) { 
>>3.  push(out1, elem); 
>>4.} else { 
>>5.  push(out2, elem); 
>>6.}
>>... 
>>
>>
>> But, usual case is when I am creating shape and setting handler for it. 
>> It seems that in my case I need different shapes inside one handler.
>>
>> Thanks a lot!
>>
>> Regards,
>> Sergey
>>
>>  
>> --
>> >> Read the docs: http://akka.io/docs/
>> >> Check the FAQ: 
>> http://doc.akka.io/docs/akka/current/additional/faq.html
>> >> Search the archives: https://groups.google.com/group/akka-user
>> ---
>> You received this message because you are subscribed to the Google Groups 
>> "Akka User List" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to akka-user+...@googlegroups.com.
>> To post to this group, send email to akka...@googlegroups.com.
>> Visit this group at https://groups.google.com/group/akka-user.
>> For more options, visit https://groups.google.com/d/optout.
>>
>> --
> >> Read the docs: http://akka.io/docs/
> >> Check the FAQ: 
> http://doc.akka.io/docs/akka/current/additional/faq.html
> >> Search the archives: https://groups.google.com/group/akka-user
> ---
> You received this message because you are subscribed to the Google Groups 
> "Akka User List" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to akka-user+...@googlegroups.com .
> To post to this group, send email to akka...@googlegroups.com 
> .
> Visit this group at https://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>
>

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


Re: [akka-user] [akka-stream] Multi input/output flow

2016-08-25 Thread Konrad Malawski
If it has more than 1 input and 1 output it's not a Flow anymore, so let's
not refer to it as a Flow.
It's a Graph of a given Shape.

There's nothing special about Shape, so if you want a custom one, you
simply extend Shape, as is documented in the reference docs:
http://doc.akka.io/docs/akka/2.4.9/scala/stream/stream-graphs.html#building-reusable-graph-components


Notice that it's still fully typesafe for users of the shape!

-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 

On 25 August 2016 at 20:07:02, Sergey Sopin (sopin1...@gmail.com) wrote:

Thanks a lot for your response.

However it is still not clear.
I am talking about FlowShape with several Inlets and Outlets. As I
understood from:
http://doc.akka.io/docs/akka/2.4/java/stream/stream-customize.html#Custom_linear_processing_stages_using_GraphStage
I have to create Shape by myself as a pair of Inlet and Outlet, but in my
case I either need to create all possible combinations of Inlets & Outlets
and return one of them from the function
  @Override
  public SourceShape shape() {
return shape;
  }
or invent something new.

First option will not work in my case, so I need something new here.

Could you please tell me how to create such multi inlet/outlet shape? Or
please explain me if I don't understand something.
Thanks a lot!


четверг, 25 августа 2016 г., 17:50:00 UTC+3 пользователь Konrad Malawski
написал:
>
> Handlers have no shape. The GraphStage does.
>
> So your stage has some shape.
>
> And then you set as many handlers as you need.
>
> Still simple sources and sinks, but we just published a blog post
> explaining it a bit more: http://blog.akka.io/integrations/2016/08/25/
> simple-sink-source-with-graphstage
>
> --
> Konrad `ktoso` Malawski
> Akka  @ Lightbend 
>
> On 25 August 2016 at 15:55:14, Sergey Sopin (sopi...@gmail.com
> ) wrote:
>
> Hi,
>
> I am trying to create multi input/output flow. It should obtain messages
> from different Inlets and emit to different Outlets based on parameter
> inside the message.
>
> Something like following:
>
>1. ...
>A elem = grab(in1);
>2.if (p.test(elem)) {
>3.  push(out1, elem);
>4.} else {
>5.  push(out2, elem);
>6.}
>...
>
>
> But, usual case is when I am creating shape and setting handler for it. It
> seems that in my case I need different shapes inside one handler.
>
> Thanks a lot!
>
> Regards,
> Sergey
>
>
> --
> >> Read the docs: http://akka.io/docs/
> >> Check the FAQ: http://doc.akka.io/docs/akka/
> current/additional/faq.html
> >> Search the archives: https://groups.google.com/group/akka-user
> ---
> You received this message because you are subscribed to the Google Groups
> "Akka User List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to akka-user+...@googlegroups.com .
> To post to this group, send email to akka...@googlegroups.com
> .
> Visit this group at https://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>
> --
>> Read the docs: http://akka.io/docs/
>> Check the FAQ:
http://doc.akka.io/docs/akka/current/additional/faq.html
>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups
"Akka User List" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

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


Re: [akka-user] [akka-stream] Multi input/output flow

2016-08-25 Thread Sergey Sopin
Thanks a lot for your response. 

However it is still not clear. 
I am talking about FlowShape with several Inlets and Outlets. As I 
understood 
from: 
http://doc.akka.io/docs/akka/2.4/java/stream/stream-customize.html#Custom_linear_processing_stages_using_GraphStage
I have to create Shape by myself as a pair of Inlet and Outlet, but in my 
case I either need to create all possible combinations of Inlets & Outlets 
and return one of them from the function 
  @Override
  public SourceShape shape() {
return shape;
  }
or invent something new. 

First option will not work in my case, so I need something new here.

Could you please tell me how to create such multi inlet/outlet shape? Or 
please explain me if I don't understand something. 
Thanks a lot!


четверг, 25 августа 2016 г., 17:50:00 UTC+3 пользователь Konrad Malawski 
написал:
>
> Handlers have no shape. The GraphStage does.
>
> So your stage has some shape.
>
> And then you set as many handlers as you need.
>
> Still simple sources and sinks, but we just published a blog post 
> explaining it a bit more: 
> http://blog.akka.io/integrations/2016/08/25/simple-sink-source-with-graphstage
>
> -- 
> Konrad `ktoso` Malawski
> Akka  @ Lightbend 
>
> On 25 August 2016 at 15:55:14, Sergey Sopin (sopi...@gmail.com 
> ) wrote:
>
> Hi, 
>
> I am trying to create multi input/output flow. It should obtain messages 
> from different Inlets and emit to different Outlets based on parameter 
> inside the message. 
>
> Something like following:
>
>1. ...
>A elem = grab(in1); 
>2.if (p.test(elem)) { 
>3.  push(out1, elem); 
>4.} else { 
>5.  push(out2, elem); 
>6.}
>... 
>
>
> But, usual case is when I am creating shape and setting handler for it. It 
> seems that in my case I need different shapes inside one handler.
>
> Thanks a lot!
>
> Regards,
> Sergey
>
>  
> --
> >> Read the docs: http://akka.io/docs/
> >> Check the FAQ: 
> http://doc.akka.io/docs/akka/current/additional/faq.html
> >> Search the archives: https://groups.google.com/group/akka-user
> ---
> You received this message because you are subscribed to the Google Groups 
> "Akka User List" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to akka-user+...@googlegroups.com .
> To post to this group, send email to akka...@googlegroups.com 
> .
> Visit this group at https://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>
>

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


Re: [akka-user] [akka-stream] Multi input/output flow

2016-08-25 Thread Konrad Malawski
Handlers have no shape. The GraphStage does.

So your stage has some shape.

And then you set as many handlers as you need.

Still simple sources and sinks, but we just published a blog post
explaining it a bit more:
http://blog.akka.io/integrations/2016/08/25/simple-sink-source-with-graphstage

-- 
Konrad `ktoso` Malawski
Akka  @ Lightbend 

On 25 August 2016 at 15:55:14, Sergey Sopin (sopin1...@gmail.com) wrote:

Hi,

I am trying to create multi input/output flow. It should obtain messages
from different Inlets and emit to different Outlets based on parameter
inside the message.

Something like following:

   1. ...
   A elem = grab(in1);
   2.if (p.test(elem)) {
   3.  push(out1, elem);
   4.} else {
   5.  push(out2, elem);
   6.}
   ...


But, usual case is when I am creating shape and setting handler for it. It
seems that in my case I need different shapes inside one handler.

Thanks a lot!

Regards,
Sergey


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

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


[akka-user] [akka-stream] Multi input/output flow

2016-08-25 Thread Sergey Sopin
Hi,

I am trying to create multi input/output flow. It should obtain messages 
from different Inlets and emit to different Outlets based on parameter 
inside the message. 

Something like following:

   1. ...
   A elem = grab(in1);
   2.if (p.test(elem)) {
   3.  push(out1, elem);
   4.} else {
   5.  push(out2, elem);
   6.}
   ...


But, usual case is when I am creating shape and setting handler for it. It 
seems that in my case I need different shapes inside one handler.

Thanks a lot!

Regards,
Sergey

 

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