本文整理了Java中org.apache.rocketmq.common.message.Message.getTags()
方法的一些代码示例,展示了Message.getTags()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.getTags()
方法的具体详情如下:
包路径:org.apache.rocketmq.common.message.Message
类名称:Message
方法名:getTags
暂无
代码示例来源:origin: apache/rocketmq
@Override
public void sendMessageBefore(SendMessageContext context) {
//if it is message trace data,then it doesn't recorded
if (context == null || context.getMessage().getTopic().startsWith(((AsyncTraceDispatcher) localDispatcher).getTraceTopicName())) {
return;
}
//build the context content of TuxeTraceContext
TraceContext tuxeContext = new TraceContext();
tuxeContext.setTraceBeans(new ArrayList<TraceBean>(1));
context.setMqTraceContext(tuxeContext);
tuxeContext.setTraceType(TraceType.Pub);
tuxeContext.setGroupName(context.getProducerGroup());
//build the data bean object of message trace
TraceBean traceBean = new TraceBean();
traceBean.setTopic(context.getMessage().getTopic());
traceBean.setTags(context.getMessage().getTags());
traceBean.setKeys(context.getMessage().getKeys());
traceBean.setStoreHost(context.getBrokerAddr());
traceBean.setBodyLength(context.getMessage().getBody().length);
traceBean.setMsgType(context.getMsgType());
tuxeContext.getTraceBeans().add(traceBean);
}
代码示例来源:origin: apache/rocketmq
private MessageExtBrokerInner makeOpMessageInner(Message message, MessageQueue messageQueue) {
MessageExtBrokerInner msgInner = new MessageExtBrokerInner();
msgInner.setTopic(message.getTopic());
msgInner.setBody(message.getBody());
msgInner.setQueueId(messageQueue.getQueueId());
msgInner.setTags(message.getTags());
msgInner.setTagsCode(MessageExtBrokerInner.tagsString2tagsCode(msgInner.getTags()));
msgInner.setSysFlag(0);
MessageAccessor.setProperties(msgInner, message.getProperties());
msgInner.setPropertiesString(MessageDecoder.messageProperties2String(message.getProperties()));
msgInner.setBornTimestamp(System.currentTimeMillis());
msgInner.setBornHost(this.storeHost);
msgInner.setStoreHost(this.storeHost);
msgInner.setWaitStoreMsgOK(false);
MessageClientIDSetter.setUniqID(msgInner);
return msgInner;
}
代码示例来源:origin: apache/rocketmq
Assert.assertEquals(message.getKeys(), messageByMsgId.getKeys());
Assert.assertEquals(message.getTags(), messageByOffset.getTags());
Assert.assertEquals(message.getTags(), messageByMsgId.getTags());
代码示例来源:origin: didi/DDMQ
Assert.assertEquals(message.getKeys(), messageByMsgId.getKeys());
Assert.assertEquals(message.getTags(), messageByOffset.getTags());
Assert.assertEquals(message.getTags(), messageByMsgId.getTags());
代码示例来源:origin: rstyro/Springboot
public LocalTransactionState executeLocalTransactionBranch(Message msg, Object arg) {
try {
//Message Body
Object plan = JSON.parseObject(new String(msg.getBody(), "utf-8"), Object.class);
//Transaction MapArgs
Map<String, Object> mapArgs = (Map<String, Object>) arg;
// --------------------IN PUT---------------------- //
System.out.println("message plan = " + plan);
System.out.println("message mapArgs = " + mapArgs);
System.out.println("message tag = " + msg.getTags());
// --------------------IN PUT---------------------- //
// accountPlanService.save(plan);
//成功通知MQ消息变更 该消息变为:<确认发送>
return LocalTransactionState.COMMIT_MESSAGE;
//return LocalTransactionState.UNKNOW;
} catch (Exception e) {
e.printStackTrace();
//失败则不通知MQ 该消息一直处于:<暂缓发送>
return LocalTransactionState.ROLLBACK_MESSAGE;
}
}
}
代码示例来源:origin: org.apache.rocketmq/rocketmq-spring-boot
public static org.springframework.messaging.Message convertToSpringMessage(
org.apache.rocketmq.common.message.Message message) {
org.springframework.messaging.Message retMessage =
MessageBuilder.withPayload(message.getBody()).
setHeader(RocketMQHeaders.KEYS, message.getKeys()).
setHeader(RocketMQHeaders.TAGS, message.getTags()).
setHeader(RocketMQHeaders.TOPIC, message.getTopic()).
setHeader(RocketMQHeaders.FLAG, message.getFlag()).
setHeader(RocketMQHeaders.TRANSACTION_ID, message.getTransactionId()).
setHeader(RocketMQHeaders.PROPERTIES, message.getProperties()).
build();
return retMessage;
}
代码示例来源:origin: org.apache.rocketmq/rocketmq-client
@Override
public void sendMessageBefore(SendMessageContext context) {
//if it is message trace data,then it doesn't recorded
if (context == null || context.getMessage().getTopic().startsWith(((AsyncTraceDispatcher) localDispatcher).getTraceTopicName())) {
return;
}
//build the context content of TuxeTraceContext
TraceContext tuxeContext = new TraceContext();
tuxeContext.setTraceBeans(new ArrayList<TraceBean>(1));
context.setMqTraceContext(tuxeContext);
tuxeContext.setTraceType(TraceType.Pub);
tuxeContext.setGroupName(context.getProducerGroup());
//build the data bean object of message trace
TraceBean traceBean = new TraceBean();
traceBean.setTopic(context.getMessage().getTopic());
traceBean.setTags(context.getMessage().getTags());
traceBean.setKeys(context.getMessage().getKeys());
traceBean.setStoreHost(context.getBrokerAddr());
traceBean.setBodyLength(context.getMessage().getBody().length);
traceBean.setMsgType(context.getMsgType());
tuxeContext.getTraceBeans().add(traceBean);
}
代码示例来源:origin: org.apache.rocketmq/rocketmq-broker
private MessageExtBrokerInner makeOpMessageInner(Message message, MessageQueue messageQueue) {
MessageExtBrokerInner msgInner = new MessageExtBrokerInner();
msgInner.setTopic(message.getTopic());
msgInner.setBody(message.getBody());
msgInner.setQueueId(messageQueue.getQueueId());
msgInner.setTags(message.getTags());
msgInner.setTagsCode(MessageExtBrokerInner.tagsString2tagsCode(msgInner.getTags()));
msgInner.setSysFlag(0);
MessageAccessor.setProperties(msgInner, message.getProperties());
msgInner.setPropertiesString(MessageDecoder.messageProperties2String(message.getProperties()));
msgInner.setBornTimestamp(System.currentTimeMillis());
msgInner.setBornHost(this.storeHost);
msgInner.setStoreHost(this.storeHost);
msgInner.setWaitStoreMsgOK(false);
MessageClientIDSetter.setUniqID(msgInner);
return msgInner;
}
内容来源于网络,如有侵权,请联系作者删除!