incubator-s4-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jia Ding <realyoun...@gmail.com>
Subject Re: How to split a stream
Date Tue, 21 Feb 2012 19:15:56 GMT
Hi Marthieu,

thanks for your help.
It works.

regards,
Jia
Am 20.02.2012 13:35 schrieb "Matthieu Morel" <mmorel@apache.org>:

> On 2/19/12 7:18 AM, Jia Ding wrote:
>
>> Hello everyone,
>>
>> I'm a beginner of s4.
>> Now I've a question about how to split a event stream.
>> e.g.
>> There is a raw event stream, named RawStream.
>> It contains two different events: event with name "a" and "b".
>>
>> RawStream looks like:
>> {"id":100, "name":"a", "value":3}
>> {"id":200, "name":"b", "value":1}
>> {"id":100, "name":"a", "value":16}
>> {"id":100, "name":"a", "value":24}
>> {"id":200, "name":"b", "value":7}
>> {"id":100, "name":"a", "value":100}
>> {"id":200, "name":"b", "value":59}
>>
>>
>> I want to implement a PE, which can process the RawStream, and separate
>> it into two streams: StreamA (events with name "a") and StreamB(events
>> with name "b").
>>
>> Now the problem is, in the configuration,
>> one PE can only define one "outputStreamName".
>> Is it means for one PE, can only output to one stream?
>> How can it output to two streams?
>>
>
> You are probably referring to some examples in the tutorial when stating
> there is only 1 output stream name.
>
> But you can actually specify several output stream names in the Spring
> configuration, you just need to adapt the way you specify them. Then from
> your code in the PE, use something like:
> "dispatcher.dispatchEvent(**streamName1, newEvent);"
> "dispatcher.dispatchEvent(**streamName2, newEvent);"
>
> You could even inject different dispatchers with different partitioning
> schemes if needed.
>
> Hope this helps,
>
> Matthieu
>

Mime
View raw message