Skip to content

Commit

Permalink
#743 revise reconsume api
Browse files Browse the repository at this point in the history
  • Loading branch information
kino.lu committed Apr 28, 2021
1 parent 2440ac0 commit bc865cd
Showing 1 changed file with 9 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@ public void reconsumeLater(SaturnDelayedLevel delayLevel) {
prop.put(SaturnJobReturn.DELAY_LEVEL_WHEN_RECONSUME_PROP_KEY, String.valueOf(delayLevel.getValue()));
}

public void setDelayLevel(SaturnDelayedLevel delayLevel) {
prop.put(SaturnJobReturn.DELAY_LEVEL_WHEN_RECONSUME_PROP_KEY, String.valueOf(delayLevel.getValue()));
}

/**
* only use for single consume
*/
Expand Down Expand Up @@ -247,19 +251,8 @@ public List<String> getCompleteOffsets() {
* only use for batch consume
*/
public void reconsumeSome(List<MsgHolder> msgHolders) {
reconsumeSome(msgHolders, null);
}

/**
* only use for batch consume
*/
public void reconsumeSome(List<MsgHolder> msgHolders, SaturnDelayedLevel delayLevel) {
String finalOffsets = mergeOffsets(prop.get(MSG_BATCH_CONSUME_DELAY_OFFSETS), msgHolders);
prop.put(MSG_BATCH_CONSUME_DELAY_OFFSETS, finalOffsets);
if (delayLevel != null) {
prop.put(SaturnJobReturn.DELAY_LEVEL_WHEN_RECONSUME_PROP_KEY, String.valueOf(delayLevel.getValue()));
}

}

/**
Expand Down Expand Up @@ -407,6 +400,11 @@ public SaturnJobReturnBuilder errorGroup(int errorGroup) {
return this;
}

public SaturnJobReturnBuilder deleyLevel(SaturnDelayedLevel delayedLevel) {
saturnJobReturn.setDelayLevel(delayedLevel);
return this;
}

/**
* only use for single consume
*/
Expand Down Expand Up @@ -463,14 +461,6 @@ public SaturnJobReturnBuilder reconsumeSome(List<MsgHolder> msgHolders) {
return this;
}

/**
* only use for batch consume
*/
public SaturnJobReturnBuilder reconsumeSome(List<MsgHolder> msgHolders, SaturnDelayedLevel delayLevel) {
saturnJobReturn.reconsumeSome(msgHolders, delayLevel);
return this;
}

/**
* only use for batch consume
*/
Expand Down

0 comments on commit bc865cd

Please sign in to comment.