コード例 #1
0
ファイル: KafkaSpout.java プロジェクト: toughhou/tutorials
 /* (non-Javadoc)
  * @see backtype.storm.topology.base.BaseRichSpout#ack(java.lang.Object)
  */
 @Override
 public void ack(Object msgId) {
   KafkaMessageId id = (KafkaMessageId) msgId;
   PartitionManager pm = this._pmKeeper.getManagers(id.getPartitionId());
   if (null != pm) {
     /*
      * remove pending offset
      * done emit and no need to commit
      */
     pm.ack(id.getOffset());
   }
 }
コード例 #2
0
ファイル: KafkaSpout.java プロジェクト: toughhou/tutorials
 /* (non-Javadoc)
  * @see backtype.storm.topology.base.BaseRichSpout#fail(java.lang.Object)
  */
 @Override
 public void fail(Object msgId) {
   /*
    * collector.emit(tup, new KafkaMessageId(this._id, toEmitMsg.getOffset()));
    * so i can get from here
    */
   KafkaMessageId id = (KafkaMessageId) msgId;
   PartitionManager pm = this._pmKeeper.getManagers(id.getPartitionId());
   if (null != pm) {
     // rollback to recommit
     pm.fail(id.getOffset());
   }
 }