当前位置: 首页>>代码示例>>Java>>正文


Java PullStatus.OFFSET_ILLEGAL属性代码示例

本文整理汇总了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());
}
 
开发者ID:y123456yz,项目名称:reading-and-annotate-rocketmq-3.4.6,代码行数:26,代码来源:MQClientAPIImpl.java

示例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());
}
 
开发者ID:medusar,项目名称:rocketmq-commet,代码行数:26,代码来源:MQClientAPIImpl.java

示例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());
}
 
开发者ID:diwayou,项目名称:rocketmq-all-trans,代码行数:29,代码来源:MQClientAPIImpl.java

示例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());
}
 
开发者ID:brucechan0921,项目名称:RocketMQ-3.0.8,代码行数:29,代码来源:MQClientAPIImpl.java

示例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;
}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:47,代码来源:MetaSimpleClient.java


注:本文中的com.alibaba.rocketmq.client.consumer.PullStatus.OFFSET_ILLEGAL属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。