You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@storm.apache.org by Michail Toutoudakis <mi...@gmail.com> on 2015/05/29 14:28:43 UTC

Newbie Question: Can two different bolts subscribe to each other??

I would like to ask if it is possible two different bolts to subscribe to each other to specific streams. I would like to do this for sync purposes. 

For example suppose we have bolt1 that inistialized class one and runs in 4 instances. 
When each of bolt1 instance finishes its task it sents an ack to bolt2
When bolt2 receives number of acks equal to the number of bolt1 insances it then sents to all of bolt1 instances a tupple with message “RESET”
so that all data in bolt1 instances are cleared and new data is generated. 

Re: Newbie Question: Can two different bolts subscribe to each other??

Posted by Andrew Xor <an...@gmail.com>.
Another way would be to create a direct stream between the two that would
accomplish what you suggest, if you elect to not use Trident which
simplifies a lot of stuff, then you need to look for inspiration on the
implementation of CoordinatedBolt
<https://github.com/apache/storm/blob/b2a8a77c3b307137527c706d0cd7635a6afe25bf/storm-core/src/jvm/backtype/storm/coordination/CoordinatedBolt.java>.
To be honest, it's actually not that complicated but the code would be much
less elegant.

Hope this helps.


On Fri, May 29, 2015 at 3:38 PM, Nathan Leung <nc...@gmail.com> wrote:

> This is possible but if you need to do this on a per tuple basis I would
> consider doing it in the spout ack method. If you are doing batches I would
> consider using trident.
> On May 29, 2015 8:28 AM, "Michail Toutoudakis" <mi...@gmail.com> wrote:
>
>> I would like to ask if it is possible two different bolts to subscribe to
>> each other to specific streams. I would like to do this for sync purposes.
>>
>> For example suppose we have bolt1 that inistialized class one and runs in
>> 4 instances.
>> When each of bolt1 instance finishes its task it sents an ack to bolt2
>> When bolt2 receives number of acks equal to the number of bolt1 insances
>> it then sents to all of bolt1 instances a tupple with message “RESET”
>> so that all data in bolt1 instances are cleared and new data is
>> generated.
>
>

Re: Newbie Question: Can two different bolts subscribe to each other??

Posted by Nathan Leung <nc...@gmail.com>.
This is possible but if you need to do this on a per tuple basis I would
consider doing it in the spout ack method. If you are doing batches I would
consider using trident.
On May 29, 2015 8:28 AM, "Michail Toutoudakis" <mi...@gmail.com> wrote:

> I would like to ask if it is possible two different bolts to subscribe to
> each other to specific streams. I would like to do this for sync purposes.
>
> For example suppose we have bolt1 that inistialized class one and runs in
> 4 instances.
> When each of bolt1 instance finishes its task it sents an ack to bolt2
> When bolt2 receives number of acks equal to the number of bolt1 insances
> it then sents to all of bolt1 instances a tupple with message “RESET”
> so that all data in bolt1 instances are cleared and new data is generated.