org.apache.rocketmq.common.protocol.header.SendMessageRequestHeaderV2 Java Examples
The following examples show how to use
org.apache.rocketmq.common.protocol.header.SendMessageRequestHeaderV2.
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: DeFiBusClientAPIImpl.java From DeFiBus with Apache License 2.0 | 5 votes |
@Override public SendResult sendMessage(// final String addr, // 1 final String brokerName, // 2 final Message msg, // 3 final SendMessageRequestHeader requestHeader, // 4 final long timeoutMillis, // 5 final CommunicationMode communicationMode, // 6 final SendCallback sendCallback, // 7 final TopicPublishInfo topicPublishInfo, // 8 final MQClientInstance instance, // 9 final int retryTimesWhenSendFailed, // 10 final SendMessageContext context, // 11 final DefaultMQProducerImpl producer // 12 ) throws RemotingException, MQBrokerException, InterruptedException { RemotingCommand request = null; if (DeFiBusConstant.REPLY.equals(msg.getProperties().get(DeFiBusConstant.KEY)) || DeFiBusConstant.DIRECT.equals(msg.getProperties().get(DeFiBusConstant.KEY))) { if (sendSmartMsg) { SendMessageRequestHeaderV2 requestHeaderV2 = SendMessageRequestHeaderV2.createSendMessageRequestHeaderV2(requestHeader); request = RemotingCommand.createRequestCommand(DeFiBusRequestCode.SEND_DIRECT_MESSAGE_V2, requestHeaderV2); } else { request = RemotingCommand.createRequestCommand(DeFiBusRequestCode.SEND_DIRECT_MESSAGE, requestHeader); } request.setBody(msg.getBody()); final AtomicInteger times = new AtomicInteger(); this.sendMessageAsync(addr, brokerName, msg, timeoutMillis, request, sendCallback, topicPublishInfo, instance, retryTimesWhenSendFailed, times, context, producer); return null; } else { return super.sendMessage(addr, brokerName, msg, requestHeader, timeoutMillis, communicationMode, sendCallback, topicPublishInfo, instance, retryTimesWhenSendFailed, context, producer); } }