You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@beam.apache.org by Kiran Hurakadli <ki...@gmail.com> on 2019/07/25 05:48:22 UTC

How to merge two streams and perform stateful operations on merged stream using Apache Beam

I have 2  kafka streams , i want to merge by some key and on top of the
merged stream i want to perform stateful operation so that i can sum up
counts from both streams

this what i tried, but dint work ..

PCollection<String> stream1 = .. read from kafka

PCollection<String> stream2 = .. read from kafka

PCollection<String,Long>  wonrdCount1 =  stream1.apply(...)

PCollection<String,Long>  wonrdCount2 =  stream2.apply(...)

PCollection<String,Long> merged = merge wordcount1 and wordcount2 using
CoGroupByKey



Pcolection<String,Long> finalStream = mergred.apply(...)


for finalstream apply state..

Please suggest solution ..

-- 
Regards,
*Kiran M Hurakadli.*

Re: How to merge two streams and perform stateful operations on merged stream using Apache Beam

Posted by Kiran Hurakadli <ki...@gmail.com>.
Yeah !This is same question .. thank you for you detailed explanation

On Thu, 25 Jul 2019 at 9:32 PM, Kenneth Knowles <ke...@apache.org> wrote:

> Is this the same question as your other email about your StackOverflow
> question? If it is, then please see my answer on StackOverflow. If it is
> not, can you explain a little more?
>
> Kenn
>
> On Wed, Jul 24, 2019 at 10:48 PM Kiran Hurakadli <ki...@gmail.com>
> wrote:
>
>> I have 2  kafka streams , i want to merge by some key and on top of the
>> merged stream i want to perform stateful operation so that i can sum up
>> counts from both streams
>>
>> this what i tried, but dint work ..
>>
>> PCollection<String> stream1 = .. read from kafka
>>
>> PCollection<String> stream2 = .. read from kafka
>>
>> PCollection<String,Long>  wonrdCount1 =  stream1.apply(...)
>>
>> PCollection<String,Long>  wonrdCount2 =  stream2.apply(...)
>>
>> PCollection<String,Long> merged = merge wordcount1 and wordcount2 using
>> CoGroupByKey
>>
>>
>>
>> Pcolection<String,Long> finalStream = mergred.apply(...)
>>
>>
>> for finalstream apply state..
>>
>> Please suggest solution ..
>>
>> --
>> Regards,
>> *Kiran M Hurakadli.*
>>
> --
Regards,
*Kiran M Hurakadli.*

Re: How to merge two streams and perform stateful operations on merged stream using Apache Beam

Posted by Kenneth Knowles <ke...@apache.org>.
Is this the same question as your other email about your StackOverflow
question? If it is, then please see my answer on StackOverflow. If it is
not, can you explain a little more?

Kenn

On Wed, Jul 24, 2019 at 10:48 PM Kiran Hurakadli <ki...@gmail.com>
wrote:

> I have 2  kafka streams , i want to merge by some key and on top of the
> merged stream i want to perform stateful operation so that i can sum up
> counts from both streams
>
> this what i tried, but dint work ..
>
> PCollection<String> stream1 = .. read from kafka
>
> PCollection<String> stream2 = .. read from kafka
>
> PCollection<String,Long>  wonrdCount1 =  stream1.apply(...)
>
> PCollection<String,Long>  wonrdCount2 =  stream2.apply(...)
>
> PCollection<String,Long> merged = merge wordcount1 and wordcount2 using
> CoGroupByKey
>
>
>
> Pcolection<String,Long> finalStream = mergred.apply(...)
>
>
> for finalstream apply state..
>
> Please suggest solution ..
>
> --
> Regards,
> *Kiran M Hurakadli.*
>