本文整理汇总了Java中com.alibaba.rocketmq.client.consumer.PullStatus.OFFSET_ILLEGAL属性的典型用法代码示例。如果您正苦于以下问题:Java PullStatus.OFFSET_ILLEGAL属性的具体用法?Java PullStatus.OFFSET_ILLEGAL怎么用?Java PullStatus.OFFSET_ILLEGAL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.alibaba.rocketmq.client.consumer.PullStatus
的用法示例。
在下文中一共展示了PullStatus.OFFSET_ILLEGAL属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processPullResponse
private PullResult processPullResponse(final RemotingCommand response) throws MQBrokerException, RemotingCommandException {
PullStatus pullStatus = PullStatus.NO_NEW_MSG;
switch (response.getCode()) {
case ResponseCode.SUCCESS:
pullStatus = PullStatus.FOUND;
break;
case ResponseCode.PULL_NOT_FOUND:
pullStatus = PullStatus.NO_NEW_MSG;
break;
case ResponseCode.PULL_RETRY_IMMEDIATELY:
pullStatus = PullStatus.NO_MATCHED_MSG;
break;
case ResponseCode.PULL_OFFSET_MOVED:
pullStatus = PullStatus.OFFSET_ILLEGAL;
break;
default:
throw new MQBrokerException(response.getCode(), response.getRemark());
}
PullMessageResponseHeader responseHeader =
(PullMessageResponseHeader) response.decodeCommandCustomHeader(PullMessageResponseHeader.class);
return new PullResultExt(pullStatus, responseHeader.getNextBeginOffset(), responseHeader.getMinOffset(),
responseHeader.getMaxOffset(), null, responseHeader.getSuggestWhichBrokerId(), response.getBody());
}
示例2: processPullResponse
private PullResult processPullResponse(final RemotingCommand response) throws MQBrokerException, RemotingCommandException {
PullStatus pullStatus = PullStatus.NO_NEW_MSG;
switch (response.getCode()) {
case ResponseCode.SUCCESS:
pullStatus = PullStatus.FOUND;
break;
case ResponseCode.PULL_NOT_FOUND:
pullStatus = PullStatus.NO_NEW_MSG;
break;
case ResponseCode.PULL_RETRY_IMMEDIATELY:
pullStatus = PullStatus.NO_MATCHED_MSG;
break;
case ResponseCode.PULL_OFFSET_MOVED:
pullStatus = PullStatus.OFFSET_ILLEGAL;
break;
default:
throw new MQBrokerException(response.getCode(), response.getRemark());
}
PullMessageResponseHeader responseHeader =
(PullMessageResponseHeader) response.decodeCommandCustomHeader(PullMessageResponseHeader.class);
return new PullResultExt(pullStatus, responseHeader.getNextBeginOffset(), responseHeader.getMinOffset(),
responseHeader.getMaxOffset(), null, responseHeader.getSuggestWhichBrokerId(), response.getBody());
}
示例3: processPullResponse
private PullResult processPullResponse(final RemotingCommand response) throws MQBrokerException,
RemotingCommandException {
PullStatus pullStatus = PullStatus.NO_NEW_MSG;
switch (response.getCode()) {
case ResponseCode.SUCCESS:
pullStatus = PullStatus.FOUND;
break;
case ResponseCode.PULL_NOT_FOUND:
pullStatus = PullStatus.NO_NEW_MSG;
break;
case ResponseCode.PULL_RETRY_IMMEDIATELY:
pullStatus = PullStatus.NO_MATCHED_MSG;
break;
case ResponseCode.PULL_OFFSET_MOVED:
pullStatus = PullStatus.OFFSET_ILLEGAL;
break;
default:
throw new MQBrokerException(response.getCode(), response.getRemark());
}
PullMessageResponseHeader responseHeader =
(PullMessageResponseHeader) response
.decodeCommandCustomHeader(PullMessageResponseHeader.class);
return new PullResultExt(pullStatus, responseHeader.getNextBeginOffset(),
responseHeader.getMinOffset(), responseHeader.getMaxOffset(), null,
responseHeader.getSuggestWhichBrokerId(), response.getBody());
}
示例4: processPullResponse
private PullResult processPullResponse(final RemotingCommand response) throws MQBrokerException,
RemotingCommandException {
PullStatus pullStatus = PullStatus.NO_NEW_MSG;
switch (response.getCode()) {
case ResponseCode.SUCCESS_VALUE:
pullStatus = PullStatus.FOUND;
break;
case MQResponseCode.PULL_NOT_FOUND_VALUE:
pullStatus = PullStatus.NO_NEW_MSG;
break;
case MQResponseCode.PULL_RETRY_IMMEDIATELY_VALUE:
pullStatus = PullStatus.NO_MATCHED_MSG;
break;
case MQResponseCode.PULL_OFFSET_MOVED_VALUE:
pullStatus = PullStatus.OFFSET_ILLEGAL;
break;
default:
throw new MQBrokerException(response.getCode(), response.getRemark());
}
PullMessageResponseHeader responseHeader =
(PullMessageResponseHeader) response
.decodeCommandCustomHeader(PullMessageResponseHeader.class);
return new PullResultExt(pullStatus, responseHeader.getNextBeginOffset(),
responseHeader.getMinOffset(), responseHeader.getMaxOffset(), null,
responseHeader.getSuggestWhichBrokerId(), response.getBody());
}
示例5: fetchOneBatch
public List<MessageExt> fetchOneBatch() {
List<MessageExt> ret = new ArrayList<MessageExt>();
String subexpress = metaSpoutConfig.getSubExpress();
for(Entry<MessageQueue, Long>entry : currentOffsets.entrySet()) {
MessageQueue mq = entry.getKey();
Long offset = entry.getValue();
int fetchSize = 0;
int oneFetchSize = Math.min(oneQueueFetchSize, 32);
while(fetchSize < oneQueueFetchSize) {
PullResult pullResult = null;
try {
pullResult = consumer.pullBlockIfNotFound(mq, subexpress, offset, oneFetchSize);
offset = pullResult.getNextBeginOffset();
PullStatus status = pullResult.getPullStatus();
if (status == PullStatus.FOUND) {
List<MessageExt> msgList = pullResult.getMsgFoundList();
ret.addAll(msgList);
fetchSize += msgList.size();
continue;
}else if (status == PullStatus.NO_MATCHED_MSG) {
continue;
}else if (status == PullStatus.NO_NEW_MSG ) {
break;
}else if (status == PullStatus.OFFSET_ILLEGAL) {
break;
}else {
break;
}
}
catch (Exception e) {
LOG.warn("Failed to fetch messages of " + mq + ":" + offset, e);
break;
}
}
backendOffset.put(mq, offset);
}
return ret;
}