Example #1
0
 /* (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());
   }
 }
Example #2
0
 /* (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());
   }
 }
Example #3
0
 // update state to zk
 private void commit() {
   this._lastUpdateMs = System.currentTimeMillis();
   for (PartitionManager pm : this._pmKeeper.getPartitionManagers()) {
     pm.commit();
   }
 }