@Test public void testSendMessageSync_WithBodyCompressed() throws RemotingException, InterruptedException, MQBrokerException, MQClientException { when(mQClientAPIImpl.getTopicRouteInfoFromNameServer(anyString(), anyLong())).thenReturn(createTopicRoute()); SendResult sendResult = producer.send(bigMessage); assertThat(sendResult.getSendStatus()).isEqualTo(SendStatus.SEND_OK); assertThat(sendResult.getOffsetMsgId()).isEqualTo("123"); assertThat(sendResult.getQueueOffset()).isEqualTo(456L); }
@Override public SendResult send( Message msg) throws MQClientException, RemotingException, MQBrokerException, InterruptedException { Validators.checkMessage(msg, this); msg.setTopic(withNamespace(msg.getTopic())); return this.defaultMQProducerImpl.send(msg); }
DefaultMQProducer extends ClientConfig implements MQProducer { @Override public SendResult send( Message msg) throws MQClientException, RemotingException, MQBrokerException, InterruptedException { Validators.checkMessage(msg, this); msg.setTopic(withNamespace(msg.getTopic())); return this.defaultMQProducerImpl.send(msg); } }
DefaultMQProducer extends ClientConfig implements MQProducer { @Override public SendResult send( Message msg) throws MQClientException, RemotingException, MQBrokerException, InterruptedException { Validators.checkMessage(msg, this); msg.setTopic(withNamespace(msg.getTopic())); return this.defaultMQProducerImpl.send(msg); } DefaultMQProducer();  DefaultMQProducer(RPCHook rpcHook);  DefaultMQProducer(final String producerGroup);  DefaultMQProducer(final String producerGroup, RPCHook rpcHook, boolean enableMsgTrace,
        final String customizedTraceTopic);  DefaultMQProducer(final String namespace, final String producerGroup);  DefaultMQProducer(final String producerGroup, RPCHook rpcHook);  DefaultMQProducer(final String namespace, final String producerGroup, RPCHook rpcHook);  DefaultMQProducer(final String producerGroup, boolean enableMsgTrace);  DefaultMQProducer(final String producerGroup, boolean enableMsgTrace, final String customizedTraceTopic);  DefaultMQProducer(final String namespace, final String producerGroup, RPCHook rpcHook,
        boolean enableMsgTrace, final String customizedTraceTopic); }
DefaultMQProducer extends ClientConfig implements MQProducer { @Override public SendResult send( Message msg) throws MQClientException, RemotingException, MQBrokerException, InterruptedException { Validators.checkMessage(msg, this); msg.setTopic(withNamespace(msg.getTopic())); return this.defaultMQProducerImpl.send(msg); } DefaultMQProducer();  DefaultMQProducer(RPCHook rpcHook);  DefaultMQProducer(final String producerGroup);  DefaultMQProducer(final String producerGroup, RPCHook rpcHook, boolean enableMsgTrace,
        final String customizedTraceTopic);  DefaultMQProducer(final String namespace, final String producerGroup);  DefaultMQProducer(final String producerGroup, RPCHook rpcHook);  DefaultMQProducer(final String namespace, final String producerGroup, RPCHook rpcHook);  DefaultMQProducer(final String producerGroup, boolean enableMsgTrace);  DefaultMQProducer(final String producerGroup, boolean enableMsgTrace, final String customizedTraceTopic);  DefaultMQProducer(final String namespace, final String producerGroup, RPCHook rpcHook,
        boolean enableMsgTrace, final String customizedTraceTopic); @Override void start(); @Override void shutdown(); @Override List<MessageQueue> fetchPublishMessageQueues(String topic); @Override SendResult send(
        Message msg); @Override SendResult send(Message msg,
        long timeout); @Override void send(Message msg,
        SendCallback sendCallback); @Override void send(Message msg, SendCallback sendCallback, long timeout); @Override void sendOneway(Message msg); @Override SendResult send(Message msg, MessageQueue mq); @Override SendResult send(Message msg, MessageQueue mq, long timeout); @Override void send(Message msg, MessageQueue mq, SendCallback sendCallback); @Override void send(Message msg, MessageQueue mq, SendCallback sendCallback, long timeout); @Override void sendOneway(Message msg,
        MessageQueue mq); @Override SendResult send(Message msg, MessageQueueSelector selector, Object arg); @Override SendResult send(Message msg, MessageQueueSelector selector, Object arg, long timeout); @Override void send(Message msg, MessageQueueSelector selector, Object arg, SendCallback sendCallback); @Override void send(Message msg, MessageQueueSelector selector, Object arg, SendCallback sendCallback, long timeout); @Override Message request(final Message msg, final long timeout); @Override void request(final Message msg, final RequestCallback requestCallback, final long timeout); @Override Message request(final Message msg, final MessageQueueSelector selector, final Object arg,
        final long timeout); @Override void request(final Message msg, final MessageQueueSelector selector, final Object arg,
        final RequestCallback requestCallback, final long timeout); @Override Message request(final Message msg, final MessageQueue mq, final long timeout); @Override void request(final Message msg, final MessageQueue mq, final RequestCallback requestCallback, long timeout); @Override void sendOneway(Message msg, MessageQueueSelector selector, Object arg); @Override TransactionSendResult sendMessageInTransaction(Message msg, LocalTransactionExecuter tranExecuter,
        final Object arg); @Override TransactionSendResult sendMessageInTransaction(Message msg,
        Object arg); @Deprecated @Override void createTopic(String key, String newTopic, int queueNum); @Deprecated @Override void createTopic(String key, String newTopic, int queueNum, int topicSysFlag); @Override long searchOffset(MessageQueue mq, long timestamp); @Deprecated @Override long maxOffset(MessageQueue mq); @Deprecated @Override long minOffset(MessageQueue mq); @Deprecated @Override long earliestMsgStoreTime(MessageQueue mq); @Deprecated @Override MessageExt viewMessage(
        String offsetMsgId); @Deprecated @Override QueryResult queryMessage(String topic, String key, int maxNum, long begin, long end); @Deprecated @Override MessageExt viewMessage(String topic,
        String msgId); @Override SendResult send(
        Collection<Message> msgs); @Override SendResult send(Collection<Message> msgs,
        long timeout); @Override SendResult send(Collection<Message> msgs,
        MessageQueue messageQueue); @Override SendResult send(Collection<Message> msgs, MessageQueue messageQueue,
        long timeout); void setCallbackExecutor(final ExecutorService callbackExecutor); void setAsyncSenderExecutor(final ExecutorService asyncSenderExecutor); String getProducerGroup(); void setProducerGroup(String producerGroup); String getCreateTopicKey(); void setCreateTopicKey(String createTopicKey); int getSendMsgTimeout(); void setSendMsgTimeout(int sendMsgTimeout); int getCompressMsgBodyOverHowmuch(); void setCompressMsgBodyOverHowmuch(int compressMsgBodyOverHowmuch); @Deprecated DefaultMQProducerImpl getDefaultMQProducerImpl(); boolean isRetryAnotherBrokerWhenNotStoreOK(); void setRetryAnotherBrokerWhenNotStoreOK(boolean retryAnotherBrokerWhenNotStoreOK); int getMaxMessageSize(); void setMaxMessageSize(int maxMessageSize); int getDefaultTopicQueueNums(); void setDefaultTopicQueueNums(int defaultTopicQueueNums); int getRetryTimesWhenSendFailed(); void setRetryTimesWhenSendFailed(int retryTimesWhenSendFailed); boolean isSendMessageWithVIPChannel(); void setSendMessageWithVIPChannel(final boolean sendMessageWithVIPChannel); long[] getNotAvailableDuration(); void setNotAvailableDuration(final long[] notAvailableDuration); long[] getLatencyMax(); void setLatencyMax(final long[] latencyMax); boolean isSendLatencyFaultEnable(); void setSendLatencyFaultEnable(final boolean sendLatencyFaultEnable); int getRetryTimesWhenSendAsyncFailed(); void setRetryTimesWhenSendAsyncFailed(final int retryTimesWhenSendAsyncFailed); TraceDispatcher getTraceDispatcher(); }
DefaultMQProducer extends ClientConfig implements MQProducer { @Override public SendResult send( Message msg) throws MQClientException, RemotingException, MQBrokerException, InterruptedException { Validators.checkMessage(msg, this); msg.setTopic(withNamespace(msg.getTopic())); return this.defaultMQProducerImpl.send(msg); } DefaultMQProducer();  DefaultMQProducer(RPCHook rpcHook);  DefaultMQProducer(final String producerGroup);  DefaultMQProducer(final String producerGroup, RPCHook rpcHook, boolean enableMsgTrace,
        final String customizedTraceTopic);  DefaultMQProducer(final String namespace, final String producerGroup);  DefaultMQProducer(final String producerGroup, RPCHook rpcHook);  DefaultMQProducer(final String namespace, final String producerGroup, RPCHook rpcHook);  DefaultMQProducer(final String producerGroup, boolean enableMsgTrace);  DefaultMQProducer(final String producerGroup, boolean enableMsgTrace, final String customizedTraceTopic);  DefaultMQProducer(final String namespace, final String producerGroup, RPCHook rpcHook,
        boolean enableMsgTrace, final String customizedTraceTopic); @Override void start(); @Override void shutdown(); @Override List<MessageQueue> fetchPublishMessageQueues(String topic); @Override SendResult send(
        Message msg); @Override SendResult send(Message msg,
        long timeout); @Override void send(Message msg,
        SendCallback sendCallback); @Override void send(Message msg, SendCallback sendCallback, long timeout); @Override void sendOneway(Message msg); @Override SendResult send(Message msg, MessageQueue mq); @Override SendResult send(Message msg, MessageQueue mq, long timeout); @Override void send(Message msg, MessageQueue mq, SendCallback sendCallback); @Override void send(Message msg, MessageQueue mq, SendCallback sendCallback, long timeout); @Override void sendOneway(Message msg,
        MessageQueue mq); @Override SendResult send(Message msg, MessageQueueSelector selector, Object arg); @Override SendResult send(Message msg, MessageQueueSelector selector, Object arg, long timeout); @Override void send(Message msg, MessageQueueSelector selector, Object arg, SendCallback sendCallback); @Override void send(Message msg, MessageQueueSelector selector, Object arg, SendCallback sendCallback, long timeout); @Override Message request(final Message msg, final long timeout); @Override void request(final Message msg, final RequestCallback requestCallback, final long timeout); @Override Message request(final Message msg, final MessageQueueSelector selector, final Object arg,
        final long timeout); @Override void request(final Message msg, final MessageQueueSelector selector, final Object arg,
        final RequestCallback requestCallback, final long timeout); @Override Message request(final Message msg, final MessageQueue mq, final long timeout); @Override void request(final Message msg, final MessageQueue mq, final RequestCallback requestCallback, long timeout); @Override void sendOneway(Message msg, MessageQueueSelector selector, Object arg); @Override TransactionSendResult sendMessageInTransaction(Message msg, LocalTransactionExecuter tranExecuter,
        final Object arg); @Override TransactionSendResult sendMessageInTransaction(Message msg,
        Object arg); @Deprecated @Override void createTopic(String key, String newTopic, int queueNum); @Deprecated @Override void createTopic(String key, String newTopic, int queueNum, int topicSysFlag); @Override long searchOffset(MessageQueue mq, long timestamp); @Deprecated @Override long maxOffset(MessageQueue mq); @Deprecated @Override long minOffset(MessageQueue mq); @Deprecated @Override long earliestMsgStoreTime(MessageQueue mq); @Deprecated @Override MessageExt viewMessage(
        String offsetMsgId); @Deprecated @Override QueryResult queryMessage(String topic, String key, int maxNum, long begin, long end); @Deprecated @Override MessageExt viewMessage(String topic,
        String msgId); @Override SendResult send(
        Collection<Message> msgs); @Override SendResult send(Collection<Message> msgs,
        long timeout); @Override SendResult send(Collection<Message> msgs,
        MessageQueue messageQueue); @Override SendResult send(Collection<Message> msgs, MessageQueue messageQueue,
        long timeout); void setCallbackExecutor(final ExecutorService callbackExecutor); void setAsyncSenderExecutor(final ExecutorService asyncSenderExecutor); String getProducerGroup(); void setProducerGroup(String producerGroup); String getCreateTopicKey(); void setCreateTopicKey(String createTopicKey); int getSendMsgTimeout(); void setSendMsgTimeout(int sendMsgTimeout); int getCompressMsgBodyOverHowmuch(); void setCompressMsgBodyOverHowmuch(int compressMsgBodyOverHowmuch); @Deprecated DefaultMQProducerImpl getDefaultMQProducerImpl(); boolean isRetryAnotherBrokerWhenNotStoreOK(); void setRetryAnotherBrokerWhenNotStoreOK(boolean retryAnotherBrokerWhenNotStoreOK); int getMaxMessageSize(); void setMaxMessageSize(int maxMessageSize); int getDefaultTopicQueueNums(); void setDefaultTopicQueueNums(int defaultTopicQueueNums); int getRetryTimesWhenSendFailed(); void setRetryTimesWhenSendFailed(int retryTimesWhenSendFailed); boolean isSendMessageWithVIPChannel(); void setSendMessageWithVIPChannel(final boolean sendMessageWithVIPChannel); long[] getNotAvailableDuration(); void setNotAvailableDuration(final long[] notAvailableDuration); long[] getLatencyMax(); void setLatencyMax(final long[] latencyMax); boolean isSendLatencyFaultEnable(); void setSendLatencyFaultEnable(final boolean sendLatencyFaultEnable); int getRetryTimesWhenSendAsyncFailed(); void setRetryTimesWhenSendAsyncFailed(final int retryTimesWhenSendAsyncFailed); TraceDispatcher getTraceDispatcher();  }