io.openmessaging.rocketmq.domain.BytesMessageImpl Java Examples
The following examples show how to use
io.openmessaging.rocketmq.domain.BytesMessageImpl.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractOMSProducer.java From DDMQ with Apache License 2.0 | 5 votes |
@Override public BytesMessage createBytesMessageToTopic(final String topic, final byte[] body) { BytesMessage bytesMessage = new BytesMessageImpl(); bytesMessage.setBody(body); bytesMessage.headers().put(MessageHeader.TOPIC, topic); return bytesMessage; }
Example #2
Source File: AbstractOMSProducer.java From DDMQ with Apache License 2.0 | 5 votes |
@Override public BytesMessage createBytesMessageToQueue(final String queue, final byte[] body) { BytesMessage bytesMessage = new BytesMessageImpl(); bytesMessage.setBody(body); bytesMessage.headers().put(MessageHeader.QUEUE, queue); return bytesMessage; }
Example #3
Source File: OMSUtil.java From DDMQ with Apache License 2.0 | 5 votes |
public static BytesMessage msgConvert(org.apache.rocketmq.common.message.MessageExt rmqMsg) { BytesMessage omsMsg = new BytesMessageImpl(); omsMsg.setBody(rmqMsg.getBody()); KeyValue headers = omsMsg.headers(); KeyValue properties = omsMsg.properties(); final Set<Map.Entry<String, String>> entries = rmqMsg.getProperties().entrySet(); for (final Map.Entry<String, String> entry : entries) { if (isOMSHeader(entry.getKey())) { headers.put(entry.getKey(), entry.getValue()); } else { properties.put(entry.getKey(), entry.getValue()); } } omsMsg.putHeaders(MessageHeader.MESSAGE_ID, rmqMsg.getMsgId()); if (!rmqMsg.getProperties().containsKey(NonStandardKeys.MESSAGE_DESTINATION) || rmqMsg.getProperties().get(NonStandardKeys.MESSAGE_DESTINATION).equals("TOPIC")) { omsMsg.putHeaders(MessageHeader.TOPIC, rmqMsg.getTopic()); } else { omsMsg.putHeaders(MessageHeader.QUEUE, rmqMsg.getTopic()); } omsMsg.putHeaders(MessageHeader.SEARCH_KEY, rmqMsg.getKeys()); omsMsg.putHeaders(MessageHeader.BORN_HOST, String.valueOf(rmqMsg.getBornHost())); omsMsg.putHeaders(MessageHeader.BORN_TIMESTAMP, rmqMsg.getBornTimestamp()); omsMsg.putHeaders(MessageHeader.STORE_HOST, String.valueOf(rmqMsg.getStoreHost())); omsMsg.putHeaders(MessageHeader.STORE_TIMESTAMP, rmqMsg.getStoreTimestamp()); return omsMsg; }
Example #4
Source File: AbstractOMSProducer.java From rocketmq-4.3.0 with Apache License 2.0 | 5 votes |
@Override public BytesMessage createBytesMessage(String queue, byte[] body) { BytesMessage message = new BytesMessageImpl(); message.setBody(body); message.sysHeaders().put(Message.BuiltinKeys.DESTINATION, queue); return message; }
Example #5
Source File: OMSUtil.java From rocketmq-4.3.0 with Apache License 2.0 | 5 votes |
public static BytesMessage msgConvert(org.apache.rocketmq.common.message.MessageExt rmqMsg) { BytesMessage omsMsg = new BytesMessageImpl(); omsMsg.setBody(rmqMsg.getBody()); KeyValue headers = omsMsg.sysHeaders(); KeyValue properties = omsMsg.userHeaders(); final Set<Map.Entry<String, String>> entries = rmqMsg.getProperties().entrySet(); for (final Map.Entry<String, String> entry : entries) { if (isOMSHeader(entry.getKey())) { headers.put(entry.getKey(), entry.getValue()); } else { properties.put(entry.getKey(), entry.getValue()); } } omsMsg.putSysHeaders(BuiltinKeys.MESSAGE_ID, rmqMsg.getMsgId()); omsMsg.putSysHeaders(BuiltinKeys.DESTINATION, rmqMsg.getTopic()); omsMsg.putSysHeaders(BuiltinKeys.SEARCH_KEYS, rmqMsg.getKeys()); omsMsg.putSysHeaders(BuiltinKeys.BORN_HOST, String.valueOf(rmqMsg.getBornHost())); omsMsg.putSysHeaders(BuiltinKeys.BORN_TIMESTAMP, rmqMsg.getBornTimestamp()); omsMsg.putSysHeaders(BuiltinKeys.STORE_HOST, String.valueOf(rmqMsg.getStoreHost())); omsMsg.putSysHeaders(BuiltinKeys.STORE_TIMESTAMP, rmqMsg.getStoreTimestamp()); return omsMsg; }
Example #6
Source File: AbstractOMSProducer.java From rocketmq-read with Apache License 2.0 | 5 votes |
@Override public BytesMessage createBytesMessage(String queue, byte[] body) { BytesMessage message = new BytesMessageImpl(); message.setBody(body); message.sysHeaders().put(Message.BuiltinKeys.DESTINATION, queue); return message; }
Example #7
Source File: OMSUtil.java From rocketmq-read with Apache License 2.0 | 5 votes |
public static BytesMessage msgConvert(org.apache.rocketmq.common.message.MessageExt rmqMsg) { BytesMessage omsMsg = new BytesMessageImpl(); omsMsg.setBody(rmqMsg.getBody()); KeyValue headers = omsMsg.sysHeaders(); KeyValue properties = omsMsg.userHeaders(); final Set<Map.Entry<String, String>> entries = rmqMsg.getProperties().entrySet(); for (final Map.Entry<String, String> entry : entries) { if (isOMSHeader(entry.getKey())) { headers.put(entry.getKey(), entry.getValue()); } else { properties.put(entry.getKey(), entry.getValue()); } } omsMsg.putSysHeaders(BuiltinKeys.MESSAGE_ID, rmqMsg.getMsgId()); omsMsg.putSysHeaders(BuiltinKeys.DESTINATION, rmqMsg.getTopic()); omsMsg.putSysHeaders(BuiltinKeys.SEARCH_KEYS, rmqMsg.getKeys()); omsMsg.putSysHeaders(BuiltinKeys.BORN_HOST, String.valueOf(rmqMsg.getBornHost())); omsMsg.putSysHeaders(BuiltinKeys.BORN_TIMESTAMP, rmqMsg.getBornTimestamp()); omsMsg.putSysHeaders(BuiltinKeys.STORE_HOST, String.valueOf(rmqMsg.getStoreHost())); omsMsg.putSysHeaders(BuiltinKeys.STORE_TIMESTAMP, rmqMsg.getStoreTimestamp()); return omsMsg; }
Example #8
Source File: AbstractOMSProducer.java From DDMQ with Apache License 2.0 | 5 votes |
@Override public BytesMessage createBytesMessageToTopic(final String topic, final byte[] body) { BytesMessage bytesMessage = new BytesMessageImpl(); bytesMessage.setBody(body); bytesMessage.headers().put(MessageHeader.TOPIC, topic); return bytesMessage; }
Example #9
Source File: AbstractOMSProducer.java From DDMQ with Apache License 2.0 | 5 votes |
@Override public BytesMessage createBytesMessageToQueue(final String queue, final byte[] body) { BytesMessage bytesMessage = new BytesMessageImpl(); bytesMessage.setBody(body); bytesMessage.headers().put(MessageHeader.QUEUE, queue); return bytesMessage; }
Example #10
Source File: OMSUtil.java From DDMQ with Apache License 2.0 | 5 votes |
public static BytesMessage msgConvert(org.apache.rocketmq.common.message.MessageExt rmqMsg) { BytesMessage omsMsg = new BytesMessageImpl(); omsMsg.setBody(rmqMsg.getBody()); KeyValue headers = omsMsg.headers(); KeyValue properties = omsMsg.properties(); final Set<Map.Entry<String, String>> entries = rmqMsg.getProperties().entrySet(); for (final Map.Entry<String, String> entry : entries) { if (isOMSHeader(entry.getKey())) { headers.put(entry.getKey(), entry.getValue()); } else { properties.put(entry.getKey(), entry.getValue()); } } omsMsg.putHeaders(MessageHeader.MESSAGE_ID, rmqMsg.getMsgId()); if (!rmqMsg.getProperties().containsKey(NonStandardKeys.MESSAGE_DESTINATION) || rmqMsg.getProperties().get(NonStandardKeys.MESSAGE_DESTINATION).equals("TOPIC")) { omsMsg.putHeaders(MessageHeader.TOPIC, rmqMsg.getTopic()); } else { omsMsg.putHeaders(MessageHeader.QUEUE, rmqMsg.getTopic()); } omsMsg.putHeaders(MessageHeader.SEARCH_KEY, rmqMsg.getKeys()); omsMsg.putHeaders(MessageHeader.BORN_HOST, String.valueOf(rmqMsg.getBornHost())); omsMsg.putHeaders(MessageHeader.BORN_TIMESTAMP, rmqMsg.getBornTimestamp()); omsMsg.putHeaders(MessageHeader.STORE_HOST, String.valueOf(rmqMsg.getStoreHost())); omsMsg.putHeaders(MessageHeader.STORE_TIMESTAMP, rmqMsg.getStoreTimestamp()); return omsMsg; }
Example #11
Source File: AbstractOMSProducer.java From rocketmq-all-4.1.0-incubating with Apache License 2.0 | 5 votes |
@Override public BytesMessage createBytesMessageToTopic(final String topic, final byte[] body) { BytesMessage bytesMessage = new BytesMessageImpl(); bytesMessage.setBody(body); bytesMessage.headers().put(MessageHeader.TOPIC, topic); return bytesMessage; }
Example #12
Source File: AbstractOMSProducer.java From rocketmq-all-4.1.0-incubating with Apache License 2.0 | 5 votes |
@Override public BytesMessage createBytesMessageToQueue(final String queue, final byte[] body) { BytesMessage bytesMessage = new BytesMessageImpl(); bytesMessage.setBody(body); bytesMessage.headers().put(MessageHeader.QUEUE, queue); return bytesMessage; }
Example #13
Source File: OMSUtil.java From rocketmq-all-4.1.0-incubating with Apache License 2.0 | 5 votes |
public static BytesMessage msgConvert(org.apache.rocketmq.common.message.MessageExt rmqMsg) { BytesMessage omsMsg = new BytesMessageImpl(); omsMsg.setBody(rmqMsg.getBody()); KeyValue headers = omsMsg.headers(); KeyValue properties = omsMsg.properties(); final Set<Map.Entry<String, String>> entries = rmqMsg.getProperties().entrySet(); for (final Map.Entry<String, String> entry : entries) { if (isOMSHeader(entry.getKey())) { headers.put(entry.getKey(), entry.getValue()); } else { properties.put(entry.getKey(), entry.getValue()); } } omsMsg.putHeaders(MessageHeader.MESSAGE_ID, rmqMsg.getMsgId()); if (!rmqMsg.getProperties().containsKey(NonStandardKeys.MESSAGE_DESTINATION) || rmqMsg.getProperties().get(NonStandardKeys.MESSAGE_DESTINATION).equals("TOPIC")) { omsMsg.putHeaders(MessageHeader.TOPIC, rmqMsg.getTopic()); } else { omsMsg.putHeaders(MessageHeader.QUEUE, rmqMsg.getTopic()); } omsMsg.putHeaders(MessageHeader.SEARCH_KEY, rmqMsg.getKeys()); omsMsg.putHeaders(MessageHeader.BORN_HOST, String.valueOf(rmqMsg.getBornHost())); omsMsg.putHeaders(MessageHeader.BORN_TIMESTAMP, rmqMsg.getBornTimestamp()); omsMsg.putHeaders(MessageHeader.STORE_HOST, String.valueOf(rmqMsg.getStoreHost())); omsMsg.putHeaders(MessageHeader.STORE_TIMESTAMP, rmqMsg.getStoreTimestamp()); return omsMsg; }
Example #14
Source File: AbstractOMSProducer.java From rocketmq with Apache License 2.0 | 5 votes |
@Override public BytesMessage createBytesMessage(String queue, byte[] body) { BytesMessage message = new BytesMessageImpl(); message.setBody(body); message.sysHeaders().put(Message.BuiltinKeys.DESTINATION, queue); return message; }
Example #15
Source File: OMSUtil.java From rocketmq with Apache License 2.0 | 5 votes |
public static BytesMessage msgConvert(org.apache.rocketmq.common.message.MessageExt rmqMsg) { BytesMessage omsMsg = new BytesMessageImpl(); omsMsg.setBody(rmqMsg.getBody()); KeyValue headers = omsMsg.sysHeaders(); KeyValue properties = omsMsg.userHeaders(); final Set<Map.Entry<String, String>> entries = rmqMsg.getProperties().entrySet(); for (final Map.Entry<String, String> entry : entries) { if (isOMSHeader(entry.getKey())) { headers.put(entry.getKey(), entry.getValue()); } else { properties.put(entry.getKey(), entry.getValue()); } } omsMsg.putSysHeaders(BuiltinKeys.MESSAGE_ID, rmqMsg.getMsgId()); omsMsg.putSysHeaders(BuiltinKeys.DESTINATION, rmqMsg.getTopic()); omsMsg.putSysHeaders(BuiltinKeys.SEARCH_KEYS, rmqMsg.getKeys()); omsMsg.putSysHeaders(BuiltinKeys.BORN_HOST, String.valueOf(rmqMsg.getBornHost())); omsMsg.putSysHeaders(BuiltinKeys.BORN_TIMESTAMP, rmqMsg.getBornTimestamp()); omsMsg.putSysHeaders(BuiltinKeys.STORE_HOST, String.valueOf(rmqMsg.getStoreHost())); omsMsg.putSysHeaders(BuiltinKeys.STORE_TIMESTAMP, rmqMsg.getStoreTimestamp()); return omsMsg; }