本文整理汇总了Java中com.alibaba.rocketmq.client.consumer.PullStatus类的典型用法代码示例。如果您正苦于以下问题:Java PullStatus类的具体用法?Java PullStatus怎么用?Java PullStatus使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PullStatus类属于com.alibaba.rocketmq.client.consumer包,在下文中一共展示了PullStatus类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: processPullResponse
import com.alibaba.rocketmq.client.consumer.PullStatus; //导入依赖的package包/类
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());
}
开发者ID:y123456yz,项目名称:reading-and-annotate-rocketmq-3.4.6,代码行数:27,代码来源:MQClientAPIImpl.java
示例2: processPullResponse
import com.alibaba.rocketmq.client.consumer.PullStatus; //导入依赖的package包/类
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());
}
开发者ID:medusar,项目名称:rocketmq-commet,代码行数:27,代码来源:MQClientAPIImpl.java
示例3: processPullResponse
import com.alibaba.rocketmq.client.consumer.PullStatus; //导入依赖的package包/类
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());
}
开发者ID:diwayou,项目名称:rocketmq-all-trans,代码行数:30,代码来源:MQClientAPIImpl.java
示例4: processPullResponse
import com.alibaba.rocketmq.client.consumer.PullStatus; //导入依赖的package包/类
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());
}
开发者ID:brucechan0921,项目名称:RocketMQ-3.0.8,代码行数:30,代码来源:MQClientAPIImpl.java
示例5: PullResultExt
import com.alibaba.rocketmq.client.consumer.PullStatus; //导入依赖的package包/类
public PullResultExt(PullStatus pullStatus, long nextBeginOffset, long minOffset, long maxOffset,
List<MessageExt> msgFoundList, final long suggestWhichBrokerId, final byte[] messageBinary) {
super(pullStatus, nextBeginOffset, minOffset, maxOffset, msgFoundList);
this.suggestWhichBrokerId = suggestWhichBrokerId;
this.messageBinary = messageBinary;
}
开发者ID:y123456yz,项目名称:reading-and-annotate-rocketmq-3.4.6,代码行数:7,代码来源:PullResultExt.java
示例6: fetchOneBatch
import com.alibaba.rocketmq.client.consumer.PullStatus; //导入依赖的package包/类
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;
}
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:48,代码来源:MetaSimpleClient.java
注:本文中的com.alibaba.rocketmq.client.consumer.PullStatus类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论