You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@storm.apache.org by "肖康 (Kang Xiao)" <kx...@gmail.com> on 2014/08/09 17:42:06 UTC

Re: FW: How to acknowlege the spout

hi Bharathi

Your questions should belong to the storm user mail list
user@storm.incubator.apache.org

1.       How to acknowledge the spout from bolt?
just call _collector.ack(input) to ack the input tuple.

2.       If failure happens, whether the spout will automatically emit the
data once again, are we have to emit manually once again? If so please let
me know how to do it.
you should emit manually once again in your spout's fail() callback.

3.       How to  verify the fail acknowledgement from bolt?
​what you mean by "verify the fail acknowledgement from bolt"​?


On Fri, Aug 8, 2014 at 6:13 PM, Bharathi NS <bh...@happiestminds.com>
wrote:

>
> Hi,
>
> I am new to Apache Storm. I have a spout which emits the data to bolt.
> Form the bolt I need to acknowledge the data.
>
> Please find the sample code below.
>
> Spout code:
>
>        @Override
>        public void nextTuple() {
>               Status tweet = queue.poll();
>
>               if (tweet != null) {
>                      logger.info("Emitting out " + tweet);
>                                    collector.emit(new Values(tweet));
>               }
>        }
>
>        @Override
>        public void ack(Object msgId) {
>            //  msgId should be "ID 6"
>            System.out.println("[HelloWorldSpout] ack on msgId" + msgId);
>        }
>        @Override
>        public void fail(Object msgId){
>         System.out.println("[HelloWorldSpout] fail on msgId" + msgId);
>
>     }
>
>
> Bolt code:
>
> @Override
>        public void execute(Tuple input) {
>               Tuple test = null;
>               System.out.println("input-->"+input);
>               _collector.ack(test);
>
> }
>
>
> Question:
>
> 1.       How to acknowledge the spout from bolt?
>
> 2.       If failure happens, whether the spout will automatically emit the
> data once again, are we have to emit manually once again? If so please let
> me know how to do it.
>
> 3.       How to  verify the fail acknowledgement from bolt?
>
>
> Regards,
> N.S.Bharathi
> ________________________________
> Happiest Minds Disclaimer
>
> This message is for the sole use of the intended recipient(s) and may
> contain confidential, proprietary or legally privileged information. Any
> unauthorized review, use, disclosure or distribution is prohibited. If you
> are not the original intended recipient of the message, please contact the
> sender by reply email and destroy all copies of the original message.
>
> Happiest Minds Technologies <http://www.happiestminds.com>
>
> ________________________________
>



-- 
Best Regards!

Kang Xiao,<kx...@gmail.com>
Distributed Software Engineer