You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@storm.apache.org by Leonardo Aniello <an...@dis.uniroma1.it> on 2014/10/03 18:16:20 UTC

spout hooks

Hello everybody,

I've noticed that the ITaskHook interface doesn't provide any method to
hook to spout's open() and nextTuple() methods.

Why? Are there alternative ways to hook to these methods?

Thanks and Best Regards,Leonardo Aniello

Re: spout hooks

Posted by Leonardo Aniello <an...@dis.uniroma1.it>.
Hi Lorenz and thanks for your reply.
I've just checked your suggestions and indeed the prepare() method gets 
invoked for both spouts and bolts.
Furthermore, it seems that the emit() method gets invoked when either a 
bolt or a spout emits a tuple.

Best,
Leonardo

On 13/10/2014 11:49, Lorenz Fischer wrote:
> Hi Leonardo
>
> I was confused by this as well. I did some testing and saw that the 
> ITaskHook.emit(EmitInfo) method gets called when you call the 
> SpoutOutputCollector.emit() method and the Storm daemon calls the 
> ITaskHook.prepare(Map,TopologyContext) for both types of tasks (spout 
> and bolt). You can figure out which component the hook is being 
> initialized for by calling context.getThisComponentId().
>
> Cheers,
> Lorenz
>
>
>
> On Fri, Oct 3, 2014 at 6:16 PM, Leonardo Aniello 
> <aniello@dis.uniroma1.it <ma...@dis.uniroma1.it>> wrote:
>
>     Hello everybody,
>
>     I've noticed that the ITaskHook interface doesn't provide any
>     method to hook to spout's open() and nextTuple() methods.
>
>     Why? Are there alternative ways to hook to these methods?
>
>     Thanks and Best Regards,Leonardo Aniello
>
>


Re: spout hooks

Posted by Lorenz Fischer <lo...@gmail.com>.
Hi Leonardo

I was confused by this as well. I did some testing and saw that the
ITaskHook.emit(EmitInfo) method gets called when you call the
SpoutOutputCollector.emit() method and the Storm daemon calls the
ITaskHook.prepare(Map,TopologyContext) for both types of tasks (spout and
bolt). You can figure out which component the hook is being initialized for
by calling context.getThisComponentId().

Cheers,
Lorenz



On Fri, Oct 3, 2014 at 6:16 PM, Leonardo Aniello <an...@dis.uniroma1.it>
wrote:

> Hello everybody,
>
> I've noticed that the ITaskHook interface doesn't provide any method to
> hook to spout's open() and nextTuple() methods.
>
> Why? Are there alternative ways to hook to these methods?
>
> Thanks and Best Regards,Leonardo Aniello
>