本文整理汇总了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;
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
};
}
示例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;
}
示例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;
}
示例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;
}
}
示例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;
}
}