@Test public void testSendAndReceive_NullMessage() { try { String response = rocketMQTemplate.sendAndReceive(stringRequestTopic, new Message<String>() { @Override public String getPayload() { return null; } @Override public MessageHeaders getHeaders() { return null; } }, String.class); } catch (IllegalArgumentException e) { assertThat(e).hasMessageContaining("`message` and `message.payload` cannot be null"); } try { String response = rocketMQTemplate.sendAndReceive(stringRequestTopic, (Object) null, String.class); } catch (IllegalArgumentException e) { assertThat(e).hasMessageContaining("Payload must not be null"); } }
public <T> T sendAndReceive(String destination, Message<?> message, Type type) { return sendAndReceive(destination, message, type, null, producer.getSendMsgTimeout(), 0); }
RocketMQTemplate extends AbstractMessageSendingTemplate<String> implements InitializingBean, DisposableBean { public <T> T sendAndReceive(String destination, Message<?> message, Type type) { return sendAndReceive(destination, message, type, null, producer.getSendMsgTimeout(), 0); } }
RocketMQTemplate extends AbstractMessageSendingTemplate<String> implements InitializingBean, DisposableBean { public <T> T sendAndReceive(String destination, Message<?> message, Type type) { return sendAndReceive(destination, message, type, null, producer.getSendMsgTimeout(), 0); }  }
RocketMQTemplate extends AbstractMessageSendingTemplate<String> implements InitializingBean, DisposableBean { public <T> T sendAndReceive(String destination, Message<?> message, Type type) { return sendAndReceive(destination, message, type, null, producer.getSendMsgTimeout(), 0); }  DefaultMQProducer getProducer(); void setProducer(DefaultMQProducer producer); String getCharset(); void setCharset(String charset); MessageQueueSelector getMessageQueueSelector(); void setMessageQueueSelector(MessageQueueSelector messageQueueSelector); void setAsyncSenderExecutor(ExecutorService asyncSenderExecutor); T sendAndReceive(String destination, Message<?> message, Type type); T sendAndReceive(String destination, Object payload, Type type); T sendAndReceive(String destination, Message<?> message, Type type, long timeout); T sendAndReceive(String destination, Object payload, Type type, long timeout); T sendAndReceive(String destination, Message<?> message, Type type, long timeout, int delayLevel); T sendAndReceive(String destination, Object payload, Type type, long timeout, int delayLevel); T sendAndReceive(String destination, Message<?> message, Type type, String hashKey); T sendAndReceive(String destination, Object payload, Type type, String hashKey); T sendAndReceive(String destination, Message<?> message, Type type, String hashKey, long timeout); T sendAndReceive(String destination, Object payload, Type type, String hashKey, long timeout); T sendAndReceive(String destination, Message<?> message, Type type, String hashKey,
        long timeout, int delayLevel); T sendAndReceive(String destination, Object payload, Type type, String hashKey,
        long timeout, int delayLevel); void sendAndReceive(String destination, Message<?> message,
        RocketMQLocalRequestCallback rocketMQLocalRequestCallback); void sendAndReceive(String destination, Object payload,
        RocketMQLocalRequestCallback rocketMQLocalRequestCallback); void sendAndReceive(String destination, Message<?> message,
        RocketMQLocalRequestCallback rocketMQLocalRequestCallback, long timeout); void sendAndReceive(String destination, Object payload,
        RocketMQLocalRequestCallback rocketMQLocalRequestCallback, long timeout); void sendAndReceive(String destination, Message<?> message,
        RocketMQLocalRequestCallback rocketMQLocalRequestCallback, long timeout, int delayLevel); void sendAndReceive(String destination, Object payload,
        RocketMQLocalRequestCallback rocketMQLocalRequestCallback, String hashKey); void sendAndReceive(String destination, Message<?> message,
        RocketMQLocalRequestCallback rocketMQLocalRequestCallback, String hashKey, long timeout); void sendAndReceive(String destination, Object payload,
        RocketMQLocalRequestCallback rocketMQLocalRequestCallback, String hashKey, long timeout); void sendAndReceive(String destination, Message<?> message,
        RocketMQLocalRequestCallback rocketMQLocalRequestCallback, String hashKey); void sendAndReceive(String destination, Object payload,
        RocketMQLocalRequestCallback rocketMQLocalRequestCallback, long timeout, int delayLevel); void sendAndReceive(String destination, Object payload,
        RocketMQLocalRequestCallback rocketMQLocalRequestCallback, String hashKey, long timeout, int delayLevel); void sendAndReceive(String destination, Message<?> message,
        RocketMQLocalRequestCallback rocketMQLocalRequestCallback, String hashKey, long timeout, int delayLevel); SendResult syncSend(String destination, Message<?> message); SendResult syncSend(String destination, Message<?> message, long timeout); SendResult syncSend(String destination, Collection<T> messages); SendResult syncSend(String destination, Collection<T> messages, long timeout); SendResult syncSend(String destination, Message<?> message, long timeout, int delayLevel); SendResult syncSend(String destination, Object payload); SendResult syncSend(String destination, Object payload, long timeout); SendResult syncSendOrderly(String destination, Message<?> message, String hashKey); SendResult syncSendOrderly(String destination, Message<?> message, String hashKey, long timeout); SendResult syncSendOrderly(String destination, Object payload, String hashKey); SendResult syncSendOrderly(String destination, Object payload, String hashKey, long timeout); void asyncSend(String destination, Message<?> message, SendCallback sendCallback, long timeout,
        int delayLevel); void asyncSend(String destination, Message<?> message, SendCallback sendCallback, long timeout); void asyncSend(String destination, Message<?> message, SendCallback sendCallback); void asyncSend(String destination, Object payload, SendCallback sendCallback, long timeout); void asyncSend(String destination, Object payload, SendCallback sendCallback); void asyncSendOrderly(String destination, Message<?> message, String hashKey, SendCallback sendCallback,
        long timeout); void asyncSendOrderly(String destination, Message<?> message, String hashKey, SendCallback sendCallback); void asyncSendOrderly(String destination, Object payload, String hashKey, SendCallback sendCallback); void asyncSendOrderly(String destination, Object payload, String hashKey, SendCallback sendCallback,
        long timeout); void sendOneWay(String destination, Message<?> message); void sendOneWay(String destination, Object payload); void sendOneWayOrderly(String destination, Message<?> message, String hashKey); void sendOneWayOrderly(String destination, Object payload, String hashKey); @Override void afterPropertiesSet(); @Override void destroy(); TransactionSendResult sendMessageInTransaction(final String destination,
        final Message<?> message, final Object arg); }
RocketMQTemplate extends AbstractMessageSendingTemplate<String> implements InitializingBean, DisposableBean { public <T> T sendAndReceive(String destination, Message<?> message, Type type) { return sendAndReceive(destination, message, type, null, producer.getSendMsgTimeout(), 0); }  DefaultMQProducer getProducer(); void setProducer(DefaultMQProducer producer); String getCharset(); void setCharset(String charset); MessageQueueSelector getMessageQueueSelector(); void setMessageQueueSelector(MessageQueueSelector messageQueueSelector); void setAsyncSenderExecutor(ExecutorService asyncSenderExecutor); T sendAndReceive(String destination, Message<?> message, Type type); T sendAndReceive(String destination, Object payload, Type type); T sendAndReceive(String destination, Message<?> message, Type type, long timeout); T sendAndReceive(String destination, Object payload, Type type, long timeout); T sendAndReceive(String destination, Message<?> message, Type type, long timeout, int delayLevel); T sendAndReceive(String destination, Object payload, Type type, long timeout, int delayLevel); T sendAndReceive(String destination, Message<?> message, Type type, String hashKey); T sendAndReceive(String destination, Object payload, Type type, String hashKey); T sendAndReceive(String destination, Message<?> message, Type type, String hashKey, long timeout); T sendAndReceive(String destination, Object payload, Type type, String hashKey, long timeout); T sendAndReceive(String destination, Message<?> message, Type type, String hashKey,
        long timeout, int delayLevel); T sendAndReceive(String destination, Object payload, Type type, String hashKey,
        long timeout, int delayLevel); void sendAndReceive(String destination, Message<?> message,
        RocketMQLocalRequestCallback rocketMQLocalRequestCallback); void sendAndReceive(String destination, Object payload,
        RocketMQLocalRequestCallback rocketMQLocalRequestCallback); void sendAndReceive(String destination, Message<?> message,
        RocketMQLocalRequestCallback rocketMQLocalRequestCallback, long timeout); void sendAndReceive(String destination, Object payload,
        RocketMQLocalRequestCallback rocketMQLocalRequestCallback, long timeout); void sendAndReceive(String destination, Message<?> message,
        RocketMQLocalRequestCallback rocketMQLocalRequestCallback, long timeout, int delayLevel); void sendAndReceive(String destination, Object payload,
        RocketMQLocalRequestCallback rocketMQLocalRequestCallback, String hashKey); void sendAndReceive(String destination, Message<?> message,
        RocketMQLocalRequestCallback rocketMQLocalRequestCallback, String hashKey, long timeout); void sendAndReceive(String destination, Object payload,
        RocketMQLocalRequestCallback rocketMQLocalRequestCallback, String hashKey, long timeout); void sendAndReceive(String destination, Message<?> message,
        RocketMQLocalRequestCallback rocketMQLocalRequestCallback, String hashKey); void sendAndReceive(String destination, Object payload,
        RocketMQLocalRequestCallback rocketMQLocalRequestCallback, long timeout, int delayLevel); void sendAndReceive(String destination, Object payload,
        RocketMQLocalRequestCallback rocketMQLocalRequestCallback, String hashKey, long timeout, int delayLevel); void sendAndReceive(String destination, Message<?> message,
        RocketMQLocalRequestCallback rocketMQLocalRequestCallback, String hashKey, long timeout, int delayLevel); SendResult syncSend(String destination, Message<?> message); SendResult syncSend(String destination, Message<?> message, long timeout); SendResult syncSend(String destination, Collection<T> messages); SendResult syncSend(String destination, Collection<T> messages, long timeout); SendResult syncSend(String destination, Message<?> message, long timeout, int delayLevel); SendResult syncSend(String destination, Object payload); SendResult syncSend(String destination, Object payload, long timeout); SendResult syncSendOrderly(String destination, Message<?> message, String hashKey); SendResult syncSendOrderly(String destination, Message<?> message, String hashKey, long timeout); SendResult syncSendOrderly(String destination, Object payload, String hashKey); SendResult syncSendOrderly(String destination, Object payload, String hashKey, long timeout); void asyncSend(String destination, Message<?> message, SendCallback sendCallback, long timeout,
        int delayLevel); void asyncSend(String destination, Message<?> message, SendCallback sendCallback, long timeout); void asyncSend(String destination, Message<?> message, SendCallback sendCallback); void asyncSend(String destination, Object payload, SendCallback sendCallback, long timeout); void asyncSend(String destination, Object payload, SendCallback sendCallback); void asyncSendOrderly(String destination, Message<?> message, String hashKey, SendCallback sendCallback,
        long timeout); void asyncSendOrderly(String destination, Message<?> message, String hashKey, SendCallback sendCallback); void asyncSendOrderly(String destination, Object payload, String hashKey, SendCallback sendCallback); void asyncSendOrderly(String destination, Object payload, String hashKey, SendCallback sendCallback,
        long timeout); void sendOneWay(String destination, Message<?> message); void sendOneWay(String destination, Object payload); void sendOneWayOrderly(String destination, Message<?> message, String hashKey); void sendOneWayOrderly(String destination, Object payload, String hashKey); @Override void afterPropertiesSet(); @Override void destroy(); TransactionSendResult sendMessageInTransaction(final String destination,
        final Message<?> message, final Object arg);  }