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


Java ConsumeConcurrentlyStatus.RECONSUME_LATER属性代码示例

本文整理汇总了Java中com.alibaba.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus.RECONSUME_LATER属性的典型用法代码示例。如果您正苦于以下问题:Java ConsumeConcurrentlyStatus.RECONSUME_LATER属性的具体用法?Java ConsumeConcurrentlyStatus.RECONSUME_LATER怎么用?Java ConsumeConcurrentlyStatus.RECONSUME_LATER使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.alibaba.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus的用法示例。


在下文中一共展示了ConsumeConcurrentlyStatus.RECONSUME_LATER属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: consumeMessage

@Override
public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> msgs,
		ConsumeConcurrentlyContext context) {
	// TODO Auto-generated method stub
	for (MessageExt msg : msgs) {  
           byte[] body = msg.getBody();  
           if (body.length == 2 && body[0] == 0 && body[1] == 0) {  
                 
               LOG.error("Young:Got the end signal");  
               _collector.emit("stop",new Values("stop"));  
               continue;  
           }  
           if (msg.getTopic().equals(RaceConfig.MqPayTopic)) {  
               return doPayTopic(body);  
           }else if (msg.getTopic().equals(RaceConfig.MqTaobaoTradeTopic)) {  
               putTaobaoTradeToTair(body);  
               return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;  
           } else if (msg.getTopic().equals(RaceConfig.MqTmallTradeTopic)) {  
               putTmallTradeToTair(body);  
               return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;  
           }else {  
               return ConsumeConcurrentlyStatus.RECONSUME_LATER;  
           }  
       }  
       return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;  
}
 
开发者ID:yangliguang,项目名称:preliminary.demo,代码行数:26,代码来源:RaceSentenceSpout.java

示例2: consumeMessage

@Override
public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> msgs, ConsumeConcurrentlyContext context) {
	for (MessageExt msg : msgs) {  
           byte[] body = msg.getBody();  
           if (body.length == 2 && body[0] == 0 && body[1] == 0) {  
                 
               LOG.error("Young:Got the end signal");  
               _collector.emit("stop",new Values("stop"));  
               continue;  
           }  
           if (msg.getTopic().equals(RaceConfig.MqPayTopic)) {  
               return doPayTopic(body);  
           }else if (msg.getTopic().equals(RaceConfig.MqTaobaoTradeTopic)) {  
               putTaobaoTradeToTair(body);  
               return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;  
           } else if (msg.getTopic().equals(RaceConfig.MqTmallTradeTopic)) {  
               putTmallTradeToTair(body);  
               return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;  
           }else {  
               return ConsumeConcurrentlyStatus.RECONSUME_LATER;  
           }  
       }  
       return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;  
}
 
开发者ID:yangliguang,项目名称:preliminary.demo,代码行数:24,代码来源:SpoutLocal.java

示例3: sendMqTags

/**
 *    验证规则 并按照规则将数据 转发到对应的 队列中
 */
private ConsumeConcurrentlyStatus sendMqTags(Map<String, String> matchingMap, String MqTags,
		String Mqbody)
{
	// 验证是否有空值
	String[] keys =
	{ "Tag", "body", "Topic", "Tags" };

	try
	{
		ForwardedHelp.outStr(matchingMap, keys);
	}
	catch (Exception e)
	{
		LOGGER.error(e.getMessage());
		return ConsumeConcurrentlyStatus.RECONSUME_LATER;
	}

	return equalsTag(matchingMap, MqTags, Mqbody);

}
 
开发者ID:atliwen,项目名称:rocketMqCurrency,代码行数:23,代码来源:ForwardedMessageListConsumer.java

示例4: sendMq

/**
 *  将数据发送给MQ 
 * @param matchingMap   注入的配置数据
 * @param Mqbody	当前消息的 实体
 * @param Topic		转发的队列名称
 */
private ConsumeConcurrentlyStatus sendMq(Map<String, String> matchingMap, String Mqbody,
		String[] Topic)
{
	for (String topicval : Topic)
	{
		try
		{
			if (producer.send(topicval, matchingMap.get("Tags"), Mqbody) == null) { return ConsumeConcurrentlyStatus.RECONSUME_LATER; }
			return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
		}
		catch (UnsupportedEncodingException e)
		{
			LOGGER.error(" 异常 转发消息到MQ  失败  Tag= " + matchingMap.get("Topic") + " body= "
					+ Mqbody, e);
			return ConsumeConcurrentlyStatus.RECONSUME_LATER;
		}
	}
	return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
}
 
开发者ID:atliwen,项目名称:rocketMqCurrency,代码行数:25,代码来源:ForwardedMessageListConsumer.java

示例5: sendMqTags

/**
 *    验证规则 并按照规则将数据 转发到对应的 队列中
 */
public static ConsumeConcurrentlyStatus sendMqTags(Map<String, String> matchingMap,
		String MqTags, Map<String, String> params)
{
	// 验证是否有空值
	String[] keys =
	{ "url" };
	try
	{
		ForwardedHelp.outStr(matchingMap, keys);
	}
	catch (Exception e)
	{
		LOGGER.error(e.getMessage());
		return ConsumeConcurrentlyStatus.RECONSUME_LATER;
	}
	return equalsTag(matchingMap, MqTags, params);
}
 
开发者ID:atliwen,项目名称:rocketMqCurrency,代码行数:20,代码来源:ExternalCallConcurrentlyStatus.java

示例6: createMessageListener

private MessageListener createMessageListener() {
    return new MessageListenerConcurrently() {
        AtomicLong consumeTimes = new AtomicLong(0);


        @Override
        public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> msgs,
                ConsumeConcurrentlyContext context) {

            this.consumeTimes.incrementAndGet();
            if ((this.consumeTimes.get() % 11) == 0) {
                System.out.println("Delay 0========Receive New Messages: " + msgs);
                return ConsumeConcurrentlyStatus.RECONSUME_LATER;
            }
            else if ((this.consumeTimes.get() % 22) == 0) {
                System.out.println(Thread.currentThread().getName()
                        + "Delay 5========Receive New Messages: " + msgs);
                context.setDelayLevelWhenNextConsume(5);
                return ConsumeConcurrentlyStatus.RECONSUME_LATER;
            }
            System.out.println("No Delay========Receive New Messages: " + msgs);
            return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
        }
    };
}
 
开发者ID:diwayou,项目名称:rocketmq-all-trans,代码行数:25,代码来源:PushConsumerTest.java

示例7: consumeMessage

@Override
public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> msgs, ConsumeConcurrentlyContext context) {
    Message msg = msgs.get(0);
    String body = null;
    try {
        body = new String(msg.getBody(), "utf-8");
        if("test".equals(msg.getTopic())){
            logger.info(body);
        }
    } catch (Exception e) {
        logger.error("consumeMessage error, msg=" + msg.toString(), e);
        return ConsumeConcurrentlyStatus.RECONSUME_LATER;
    }
    return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
}
 
开发者ID:cairenjie1985,项目名称:springBoot-demo,代码行数:15,代码来源:MessageListener.java

示例8: sendMq

/**
 * @param matchingMap
 * @param mqbody
 * @param url
 * @return
 */
private static ConsumeConcurrentlyStatus sendMq(Map<String, String> matchingMap, String url,
		Map<String, String> params)
{

	HttpResponse resp = HttpRequest.sendPostMessage(url, params, "UTF-8");
	if (resp == null || resp.getState() != 200) { return ConsumeConcurrentlyStatus.RECONSUME_LATER; }
	return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
}
 
开发者ID:atliwen,项目名称:rocketMqCurrency,代码行数:14,代码来源:ExternalCallConcurrentlyStatus.java

示例9: consumeMessage

@Override
public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> msgs,
		ConsumeConcurrentlyContext context) {
	try {
		MetaTuple metaTuple = new MetaTuple(msgs, context.getMessageQueue());

		if (flowControl) {
			sendingQueue.offer(metaTuple);
		} else {
			sendTuple(metaTuple);
		}

		if (autoAck) {
			return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
		} else {
			metaTuple.waitFinish();
			if (metaTuple.isSuccess() == true) {
				return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
			} else {
				return ConsumeConcurrentlyStatus.RECONSUME_LATER;
			}
		}

	} catch (Exception e) {
		LOG.error("Failed to emit " + id, e);
		return ConsumeConcurrentlyStatus.RECONSUME_LATER;
	}

}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:29,代码来源:MetaSpout.java

示例10: consumeMessage

@Override
public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> msgs,
                                                ConsumeConcurrentlyContext context) {
    try {
        MetaTuple metaTuple = new MetaTuple(msgs, context.getMessageQueue());

        if (flowControl) {
            sendingQueue.offer(metaTuple);
        } else {
            sendTuple(metaTuple);
        }

        if (autoAck) {
            return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
        } else {
            if (!conf.get(LoadConfig.TOPOLOGY_TYPE).equals("Trident")) {
                metaTuple.waitFinish();
            }
            if (metaTuple.isSuccess()) {
                return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
            } else {
                return ConsumeConcurrentlyStatus.RECONSUME_LATER;
            }
        }

    } catch (Exception e) {
        LOG.error("Failed to emit " + id, e);
        return ConsumeConcurrentlyStatus.RECONSUME_LATER;
    }

}
 
开发者ID:alibaba,项目名称:jstorm,代码行数:31,代码来源:MetaSpout.java


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