类 RocketMQTemplate

  • 所有已实现的接口:
    org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, org.springframework.messaging.core.MessageSendingOperations<String>

    public class RocketMQTemplate
    extends org.springframework.messaging.core.AbstractMessageSendingTemplate<String>
    implements org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean
    • 构造器详细资料

      • RocketMQTemplate

        public RocketMQTemplate()
    • 方法详细资料

      • getProducer

        public org.apache.rocketmq.client.producer.DefaultMQProducer getProducer()
      • setProducer

        public void setProducer​(org.apache.rocketmq.client.producer.DefaultMQProducer producer)
      • getConsumer

        public org.apache.rocketmq.client.consumer.DefaultLitePullConsumer getConsumer()
      • setConsumer

        public void setConsumer​(org.apache.rocketmq.client.consumer.DefaultLitePullConsumer consumer)
      • getCharset

        public String getCharset()
      • setCharset

        public void setCharset​(String charset)
      • getMessageQueueSelector

        public org.apache.rocketmq.client.producer.MessageQueueSelector getMessageQueueSelector()
      • setMessageQueueSelector

        public void setMessageQueueSelector​(org.apache.rocketmq.client.producer.MessageQueueSelector messageQueueSelector)
      • setAsyncSenderExecutor

        public void setAsyncSenderExecutor​(ExecutorService asyncSenderExecutor)
      • sendAndReceive

        public <T> T sendAndReceive​(String destination,
                                    org.springframework.messaging.Message<?> message,
                                    Type type)
        参数:
        destination - formats: `topicName:tags`
        message - Message the message to be sent.
        type - The type of T
        返回:
      • sendAndReceive

        public <T> T sendAndReceive​(String destination,
                                    Object payload,
                                    Type type)
        参数:
        destination - formats: `topicName:tags`
        payload - the payload to be sent.
        type - The type of T
        返回:
      • sendAndReceive

        public <T> T sendAndReceive​(String destination,
                                    org.springframework.messaging.Message<?> message,
                                    Type type,
                                    long timeout)
        参数:
        destination - formats: `topicName:tags`
        message - Message the message to be sent.
        type - The type of T
        timeout - send timeout in millis
        返回:
      • sendAndReceive

        public <T> T sendAndReceive​(String destination,
                                    Object payload,
                                    Type type,
                                    long timeout)
        参数:
        destination - formats: `topicName:tags`
        payload - the payload to be sent.
        type - The type of T
        timeout - send timeout in millis
        返回:
      • sendAndReceive

        public <T> T sendAndReceive​(String destination,
                                    org.springframework.messaging.Message<?> message,
                                    Type type,
                                    long timeout,
                                    int delayLevel)
        参数:
        destination - formats: `topicName:tags`
        message - Message the message to be sent.
        type - The type of T
        timeout - send timeout in millis
        delayLevel - message delay level(0 means no delay)
        返回:
      • sendAndReceive

        public <T> T sendAndReceive​(String destination,
                                    Object payload,
                                    Type type,
                                    long timeout,
                                    int delayLevel)
        参数:
        destination - formats: `topicName:tags`
        payload - the payload to be sent.
        type - The type of T
        timeout - send timeout in millis
        delayLevel - message delay level(0 means no delay)
        返回:
      • sendAndReceive

        public <T> T sendAndReceive​(String destination,
                                    org.springframework.messaging.Message<?> message,
                                    Type type,
                                    String hashKey)
        参数:
        destination - formats: `topicName:tags`
        message - Message the message to be sent.
        type - The type of T
        hashKey - needed when sending message orderly
        返回:
      • sendAndReceive

        public <T> T sendAndReceive​(String destination,
                                    Object payload,
                                    Type type,
                                    String hashKey)
        参数:
        destination - formats: `topicName:tags`
        payload - the payload to be sent.
        type - The type of T
        hashKey - needed when sending message orderly
        返回:
      • sendAndReceive

        public <T> T sendAndReceive​(String destination,
                                    org.springframework.messaging.Message<?> message,
                                    Type type,
                                    String hashKey,
                                    long timeout)
        参数:
        destination - formats: `topicName:tags`
        message - Message the message to be sent.
        type - The type of T
        hashKey - needed when sending message orderly
        timeout - send timeout in millis
        返回:
      • sendAndReceive

        public <T> T sendAndReceive​(String destination,
                                    Object payload,
                                    Type type,
                                    String hashKey,
                                    long timeout)
        参数:
        destination - formats: `topicName:tags`
        payload - the payload to be sent.
        type - The type of T
        hashKey -
        返回:
      • sendAndReceive

        public <T> T sendAndReceive​(String destination,
                                    org.springframework.messaging.Message<?> message,
                                    Type type,
                                    String hashKey,
                                    long timeout,
                                    int delayLevel)
        参数:
        destination - formats: `topicName:tags`
        message - Message the message to be sent.
        type - The type that receive
        hashKey - needed when sending message orderly
        timeout - send timeout in millis
        delayLevel - message delay level(0 means no delay)
        返回:
      • sendAndReceive

        public <T> T sendAndReceive​(String destination,
                                    Object payload,
                                    Type type,
                                    String hashKey,
                                    long timeout,
                                    int delayLevel)
        参数:
        destination - formats: `topicName:tags`
        payload - the payload to be sent.
        type - The type that receive
        hashKey - needed when sending message orderly
        timeout - send timeout in millis
        delayLevel - message delay level(0 means no delay)
        返回:
      • sendAndReceive

        public void sendAndReceive​(String destination,
                                   org.springframework.messaging.Message<?> message,
                                   RocketMQLocalRequestCallback rocketMQLocalRequestCallback)
        参数:
        destination - formats: `topicName:tags`
        message - Message the message to be sent.
        rocketMQLocalRequestCallback - callback that will be invoked when reply message received.
      • sendAndReceive

        public void sendAndReceive​(String destination,
                                   Object payload,
                                   RocketMQLocalRequestCallback rocketMQLocalRequestCallback)
        参数:
        destination - formats: `topicName:tags`
        payload - the payload to be sent.
        rocketMQLocalRequestCallback - callback that will be invoked when reply message received.
      • sendAndReceive

        public void sendAndReceive​(String destination,
                                   org.springframework.messaging.Message<?> message,
                                   RocketMQLocalRequestCallback rocketMQLocalRequestCallback,
                                   long timeout)
        参数:
        destination - formats: `topicName:tags`
        message - Message the message to be sent.
        rocketMQLocalRequestCallback - callback that will be invoked when reply message received.
        timeout - send timeout in millis
      • sendAndReceive

        public void sendAndReceive​(String destination,
                                   Object payload,
                                   RocketMQLocalRequestCallback rocketMQLocalRequestCallback,
                                   long timeout)
        参数:
        destination - formats: `topicName:tags`
        payload - the payload to be sent.
        rocketMQLocalRequestCallback - callback that will be invoked when reply message received.
        timeout - send timeout in millis
      • sendAndReceive

        public void sendAndReceive​(String destination,
                                   org.springframework.messaging.Message<?> message,
                                   RocketMQLocalRequestCallback rocketMQLocalRequestCallback,
                                   long timeout,
                                   int delayLevel)
        参数:
        destination - formats: `topicName:tags`
        message - Message the message to be sent.
        rocketMQLocalRequestCallback - callback that will be invoked when reply message received.
        timeout - send timeout in millis
        delayLevel - message delay level(0 means no delay)
      • sendAndReceive

        public void sendAndReceive​(String destination,
                                   Object payload,
                                   RocketMQLocalRequestCallback rocketMQLocalRequestCallback,
                                   String hashKey)
        参数:
        destination - formats: `topicName:tags`
        payload - the payload to be sent.
        rocketMQLocalRequestCallback - callback that will be invoked when reply message received.
        hashKey - needed when sending message orderly
      • sendAndReceive

        public void sendAndReceive​(String destination,
                                   org.springframework.messaging.Message<?> message,
                                   RocketMQLocalRequestCallback rocketMQLocalRequestCallback,
                                   String hashKey,
                                   long timeout)
        参数:
        destination - formats: `topicName:tags`
        message - Message the message to be sent.
        rocketMQLocalRequestCallback - callback that will be invoked when reply message received.
        hashKey - needed when sending message orderly
        timeout - send timeout in millis
      • sendAndReceive

        public void sendAndReceive​(String destination,
                                   Object payload,
                                   RocketMQLocalRequestCallback rocketMQLocalRequestCallback,
                                   String hashKey,
                                   long timeout)
        参数:
        destination - formats: `topicName:tags`
        payload - the payload to be sent.
        rocketMQLocalRequestCallback - callback that will be invoked when reply message received.
        hashKey - needed when sending message orderly
        timeout - send timeout in millis
      • sendAndReceive

        public void sendAndReceive​(String destination,
                                   org.springframework.messaging.Message<?> message,
                                   RocketMQLocalRequestCallback rocketMQLocalRequestCallback,
                                   String hashKey)
        参数:
        destination - formats: `topicName:tags`
        message - Message the message to be sent.
        rocketMQLocalRequestCallback - callback that will be invoked when reply message received.
        hashKey - needed when sending message orderly
      • sendAndReceive

        public void sendAndReceive​(String destination,
                                   Object payload,
                                   RocketMQLocalRequestCallback rocketMQLocalRequestCallback,
                                   long timeout,
                                   int delayLevel)
        参数:
        destination - formats: `topicName:tags`
        payload - the payload to be sent.
        rocketMQLocalRequestCallback - callback that will be invoked when reply message received.
        timeout - send timeout in millis
        delayLevel - message delay level(0 means no delay)
      • sendAndReceive

        public void sendAndReceive​(String destination,
                                   Object payload,
                                   RocketMQLocalRequestCallback rocketMQLocalRequestCallback,
                                   String hashKey,
                                   long timeout,
                                   int delayLevel)
        参数:
        destination - formats: `topicName:tags`
        payload - the payload to be sent.
        rocketMQLocalRequestCallback - callback that will be invoked when reply message received.
        hashKey - needed when sending message orderly
        timeout - send timeout in millis
        delayLevel - message delay level(0 means no delay)
      • sendAndReceive

        public void sendAndReceive​(String destination,
                                   org.springframework.messaging.Message<?> message,
                                   RocketMQLocalRequestCallback rocketMQLocalRequestCallback,
                                   String hashKey,
                                   long timeout,
                                   int delayLevel)
        Send request message in asynchronous mode.

        This method returns immediately. On receiving reply message, rocketMQLocalRequestCallback will be executed.

        参数:
        destination - formats: `topicName:tags`
        message - Message the message to be sent.
        rocketMQLocalRequestCallback - callback that will be invoked when reply message received.
        hashKey - needed when sending message orderly
        timeout - send timeout in millis
        delayLevel - message delay level(0 means no delay)
      • syncSend

        public org.apache.rocketmq.client.producer.SendResult syncSend​(String destination,
                                                                       org.springframework.messaging.Message<?> message)

        Send message in synchronous mode. This method returns only when the sending procedure totally completes. Reliable synchronous transmission is used in extensive scenes, such as important notification messages, SMS notification, SMS marketing system, etc..

        Warn: this method has internal retry-mechanism, that is, internal implementation will retry DefaultMQProducer.getRetryTimesWhenSendFailed() times before claiming failure. As a result, multiple messages may potentially delivered to broker(s). It's up to the application developers to resolve potential duplication issue.

        参数:
        destination - formats: `topicName:tags`
        message - Message
        返回:
        SendResult
      • syncSend

        public org.apache.rocketmq.client.producer.SendResult syncSend​(String destination,
                                                                       org.springframework.messaging.Message<?> message,
                                                                       long timeout)
        Same to syncSend(String, Message) with send timeout specified in addition.
        参数:
        destination - formats: `topicName:tags`
        message - Message
        timeout - send timeout with millis
        返回:
        SendResult
      • syncSend

        public <T extends org.springframework.messaging.Message> org.apache.rocketmq.client.producer.SendResult syncSend​(String destination,
                                                                                                                         Collection<T> messages)
        syncSend batch messages
        参数:
        destination - formats: `topicName:tags`
        messages - Collection of Message
        返回:
        SendResult
      • syncSend

        public <T extends org.springframework.messaging.Message> org.apache.rocketmq.client.producer.SendResult syncSend​(String destination,
                                                                                                                         Collection<T> messages,
                                                                                                                         long timeout)
        syncSend batch messages in a given timeout.
        参数:
        destination - formats: `topicName:tags`
        messages - Collection of Message
        timeout - send timeout with millis
        返回:
        SendResult
      • syncSendDelayTimeSeconds

        public org.apache.rocketmq.client.producer.SendResult syncSendDelayTimeSeconds​(String destination,
                                                                                       org.springframework.messaging.Message<?> message,
                                                                                       long delayTime)
        Same to syncSend(String, Message) with send delay time specified in addition. This function is only valid when the broker version is 5.0 or above
        参数:
        destination - formats: `topicName:tags`
        message - Message
        delayTime - delay time in seconds for message
        返回:
        SendResult
      • syncSendDelayTimeSeconds

        public org.apache.rocketmq.client.producer.SendResult syncSendDelayTimeSeconds​(String destination,
                                                                                       Object payload,
                                                                                       long delayTime)
        Same to syncSend(String, Object) with send delayTime specified in addition. This function is only valid when the broker version is 5.0 or above
        参数:
        destination - formats: `topicName:tags`
        payload - the Object to use as payload
        delayTime - delay time in seconds for message
        返回:
        SendResult
      • syncSendDelayTimeMills

        public org.apache.rocketmq.client.producer.SendResult syncSendDelayTimeMills​(String destination,
                                                                                     org.springframework.messaging.Message<?> message,
                                                                                     long delayTime)
        Same to syncSend(String, Message) with send delay time specified in addition. This function is only valid when the broker version is 5.0 or above
        参数:
        destination - formats: `topicName:tags`
        message - Message
        delayTime - delay time in millisecond for message
        返回:
        SendResult
      • syncSendDelayTimeMills

        public org.apache.rocketmq.client.producer.SendResult syncSendDelayTimeMills​(String destination,
                                                                                     Object payload,
                                                                                     long delayTime)
        Same to syncSend(String, Object) with send delayTime specified in addition. This function is only valid when the broker version is 5.0 or above
        参数:
        destination - formats: `topicName:tags`
        payload - the Object to use as payload
        delayTime - delay time in millisecond for message
        返回:
        SendResult
      • syncSendDeliverTimeMills

        public org.apache.rocketmq.client.producer.SendResult syncSendDeliverTimeMills​(String destination,
                                                                                       org.springframework.messaging.Message<?> message,
                                                                                       long deliverTimeMills)
        Same to syncSend(String, Message) with send in a delivered time. This function is only valid when the broker version is 5.0 or above
        参数:
        destination - formats: `topicName:tags`
        message - Message
        deliverTimeMills - delivered time in millisecond for message
        返回:
        SendResult
      • syncSendDeliverTimeMills

        public org.apache.rocketmq.client.producer.SendResult syncSendDeliverTimeMills​(String destination,
                                                                                       Object payload,
                                                                                       long deliverTimeMills)
        Same to syncSend(String, Object) with send in a delivered time. This function is only valid when the broker version is 5.0 or above
        参数:
        destination - formats: `topicName:tags`
        payload - the Object to use as payload
        deliverTimeMills - delivered time in millisecond for message
        返回:
        SendResult
      • syncSend

        public org.apache.rocketmq.client.producer.SendResult syncSend​(String destination,
                                                                       org.springframework.messaging.Message<?> message,
                                                                       long timeout,
                                                                       int delayLevel)
        Same to syncSend(String, Message) with send timeout specified in addition.
        参数:
        destination - formats: `topicName:tags`
        message - Message
        timeout - send timeout with millis
        delayLevel - level for the delay message
        返回:
        SendResult
      • syncSend

        public org.apache.rocketmq.client.producer.SendResult syncSend​(String destination,
                                                                       Object payload)
        参数:
        destination - formats: `topicName:tags`
        payload - the Object to use as payload
        返回:
        SendResult
      • syncSend

        public org.apache.rocketmq.client.producer.SendResult syncSend​(String destination,
                                                                       Object payload,
                                                                       long timeout)
        Same to syncSend(String, Object) with send timeout specified in addition.
        参数:
        destination - formats: `topicName:tags`
        payload - the Object to use as payload
        timeout - send timeout with millis
        返回:
        SendResult
      • syncSendOrderly

        public org.apache.rocketmq.client.producer.SendResult syncSendOrderly​(String destination,
                                                                              org.springframework.messaging.Message<?> message,
                                                                              String hashKey)
        Same to syncSend(String, Message) with send orderly with hashKey by specified.
        参数:
        destination - formats: `topicName:tags`
        message - Message
        hashKey - use this key to select queue. for example: orderId, productId ...
        返回:
        SendResult
      • syncSendOrderly

        public org.apache.rocketmq.client.producer.SendResult syncSendOrderly​(String destination,
                                                                              org.springframework.messaging.Message<?> message,
                                                                              String hashKey,
                                                                              long timeout)
        Same to syncSendOrderly(String, Message, String) with send timeout specified in addition.
        参数:
        destination - formats: `topicName:tags`
        message - Message
        hashKey - use this key to select queue. for example: orderId, productId ...
        timeout - send timeout with millis
        返回:
        SendResult
      • syncSendOrderly

        public org.apache.rocketmq.client.producer.SendResult syncSendOrderly​(String destination,
                                                                              org.springframework.messaging.Message<?> message,
                                                                              String hashKey,
                                                                              long timeout,
                                                                              int delayLevel)
        Same to syncSendOrderly(String, Message, String) with send timeout specified in addition.
        参数:
        destination - formats: `topicName:tags`
        message - Message
        hashKey - use this key to select queue. for example: orderId, productId ...
        timeout - send timeout with millis
        delayLevel - level for the delay message
        返回:
        SendResult
      • syncSendOrderly

        public org.apache.rocketmq.client.producer.SendResult syncSendOrderly​(String destination,
                                                                              Object payload,
                                                                              String hashKey)
        Same to syncSend(String, Object) with send orderly with hashKey by specified.
        参数:
        destination - formats: `topicName:tags`
        payload - the Object to use as payload
        hashKey - use this key to select queue. for example: orderId, productId ...
        返回:
        SendResult
      • syncSendOrderly

        public org.apache.rocketmq.client.producer.SendResult syncSendOrderly​(String destination,
                                                                              Object payload,
                                                                              String hashKey,
                                                                              long timeout)
        Same to syncSendOrderly(String, Object, String) with send timeout specified in addition.
        参数:
        destination - formats: `topicName:tags`
        payload - the Object to use as payload
        hashKey - use this key to select queue. for example: orderId, productId ...
        timeout - send timeout with millis
        返回:
        SendResult
      • syncSendOrderly

        public <T extends org.springframework.messaging.Message> org.apache.rocketmq.client.producer.SendResult syncSendOrderly​(String destination,
                                                                                                                                Collection<T> messages,
                                                                                                                                String hashKey)
        syncSend batch messages orderly.
        参数:
        destination - formats: `topicName:tags`
        messages - Collection of Message
        hashKey - use this key to select queue. for example: orderId, productId ...
        返回:
        SendResult
      • syncSendOrderly

        public <T extends org.springframework.messaging.Message> org.apache.rocketmq.client.producer.SendResult syncSendOrderly​(String destination,
                                                                                                                                Collection<T> messages,
                                                                                                                                String hashKey,
                                                                                                                                long timeout)
        Same to syncSendOrderly(String, Collection, String) with send timeout specified in addition.
        参数:
        destination - formats: `topicName:tags`
        messages - Collection of Message
        hashKey - use this key to select queue. for example: orderId, productId ...
        timeout - send timeout with millis
        返回:
        SendResult
      • asyncSend

        public void asyncSend​(String destination,
                              org.springframework.messaging.Message<?> message,
                              org.apache.rocketmq.client.producer.SendCallback sendCallback,
                              long timeout,
                              int delayLevel)
        Same to asyncSend(String, Message, SendCallback) with send timeout and delay level specified in addition.
        参数:
        destination - formats: `topicName:tags`
        message - Message
        sendCallback - SendCallback
        timeout - send timeout with millis
        delayLevel - level for the delay message
      • asyncSend

        public void asyncSend​(String destination,
                              org.springframework.messaging.Message<?> message,
                              org.apache.rocketmq.client.producer.SendCallback sendCallback,
                              long timeout)
        Same to asyncSend(String, Message, SendCallback) with send timeout specified in addition.
        参数:
        destination - formats: `topicName:tags`
        message - Message
        sendCallback - SendCallback
        timeout - send timeout with millis
      • asyncSend

        public void asyncSend​(String destination,
                              org.springframework.messaging.Message<?> message,
                              org.apache.rocketmq.client.producer.SendCallback sendCallback)

        Send message to broker asynchronously. asynchronous transmission is generally used in response time sensitive business scenarios.

        This method returns immediately. On sending completion, sendCallback will be executed.

        Similar to syncSend(String, Object), internal implementation would potentially retry up to DefaultMQProducer.getRetryTimesWhenSendAsyncFailed() times before claiming sending failure, which may yield message duplication and application developers are the one to resolve this potential issue.

        参数:
        destination - formats: `topicName:tags`
        message - Message
        sendCallback - SendCallback
      • asyncSend

        public void asyncSend​(String destination,
                              Object payload,
                              org.apache.rocketmq.client.producer.SendCallback sendCallback,
                              long timeout)
        Same to asyncSend(String, Object, SendCallback) with send timeout specified in addition.
        参数:
        destination - formats: `topicName:tags`
        payload - the Object to use as payload
        sendCallback - SendCallback
        timeout - send timeout with millis
      • asyncSend

        public void asyncSend​(String destination,
                              Object payload,
                              org.apache.rocketmq.client.producer.SendCallback sendCallback)
        参数:
        destination - formats: `topicName:tags`
        payload - the Object to use as payload
        sendCallback - SendCallback
      • asyncSend

        public <T extends org.springframework.messaging.Message> void asyncSend​(String destination,
                                                                                Collection<T> messages,
                                                                                org.apache.rocketmq.client.producer.SendCallback sendCallback)
        asyncSend batch messages
        参数:
        destination - formats: `topicName:tags`
        messages - Collection of Message
        sendCallback - SendCallback
      • asyncSend

        public <T extends org.springframework.messaging.Message> void asyncSend​(String destination,
                                                                                Collection<T> messages,
                                                                                org.apache.rocketmq.client.producer.SendCallback sendCallback,
                                                                                long timeout)
        asyncSend batch messages in a given timeout.
        参数:
        destination - formats: `topicName:tags`
        messages - Collection of Message
        sendCallback - SendCallback
        timeout - send timeout with millis
      • asyncSendOrderly

        public void asyncSendOrderly​(String destination,
                                     org.springframework.messaging.Message<?> message,
                                     String hashKey,
                                     org.apache.rocketmq.client.producer.SendCallback sendCallback,
                                     long timeout)
        Same to asyncSendOrderly(String, Message, String, SendCallback) with send timeout specified in addition.
        参数:
        destination - formats: `topicName:tags`
        message - Message
        hashKey - use this key to select queue. for example: orderId, productId ...
        sendCallback - SendCallback
        timeout - send timeout with millis
      • asyncSendOrderly

        public void asyncSendOrderly​(String destination,
                                     org.springframework.messaging.Message<?> message,
                                     String hashKey,
                                     org.apache.rocketmq.client.producer.SendCallback sendCallback,
                                     long timeout,
                                     int delayLevel)
        Same to asyncSendOrderly(String, Message, String, SendCallback) with send timeout specified in addition.
        参数:
        destination - formats: `topicName:tags`
        message - Message
        hashKey - use this key to select queue. for example: orderId, productId ...
        sendCallback - SendCallback
        timeout - send timeout with millis
        delayLevel - level for the delay message
      • asyncSendOrderly

        public void asyncSendOrderly​(String destination,
                                     org.springframework.messaging.Message<?> message,
                                     String hashKey,
                                     org.apache.rocketmq.client.producer.SendCallback sendCallback)
        Same to asyncSend(String, Message, SendCallback) with send orderly with hashKey by specified.
        参数:
        destination - formats: `topicName:tags`
        message - Message
        hashKey - use this key to select queue. for example: orderId, productId ...
        sendCallback - SendCallback
      • asyncSendOrderly

        public void asyncSendOrderly​(String destination,
                                     Object payload,
                                     String hashKey,
                                     org.apache.rocketmq.client.producer.SendCallback sendCallback)
        参数:
        destination - formats: `topicName:tags`
        payload - the Object to use as payload
        hashKey - use this key to select queue. for example: orderId, productId ...
        sendCallback - SendCallback
      • asyncSendOrderly

        public void asyncSendOrderly​(String destination,
                                     Object payload,
                                     String hashKey,
                                     org.apache.rocketmq.client.producer.SendCallback sendCallback,
                                     long timeout)
        Same to asyncSendOrderly(String, Object, String, SendCallback) with send timeout specified in addition.
        参数:
        destination - formats: `topicName:tags`
        payload - the Object to use as payload
        hashKey - use this key to select queue. for example: orderId, productId ...
        sendCallback - SendCallback
        timeout - send timeout with millis
      • sendOneWay

        public void sendOneWay​(String destination,
                               org.springframework.messaging.Message<?> message)
        Similar to UDP, this method won't wait for acknowledgement from broker before return. Obviously, it has maximums throughput yet potentials of message loss.

        One-way transmission is used for cases requiring moderate reliability, such as log collection.

        参数:
        destination - formats: `topicName:tags`
        message - Message
      • sendOneWay

        public void sendOneWay​(String destination,
                               Object payload)
        参数:
        destination - formats: `topicName:tags`
        payload - the Object to use as payload
      • sendOneWayOrderly

        public void sendOneWayOrderly​(String destination,
                                      org.springframework.messaging.Message<?> message,
                                      String hashKey)
        Same to sendOneWay(String, Message) with send orderly with hashKey by specified.
        参数:
        destination - formats: `topicName:tags`
        message - Message
        hashKey - use this key to select queue. for example: orderId, productId ...
      • afterPropertiesSet

        public void afterPropertiesSet()
                                throws Exception
        指定者:
        afterPropertiesSet 在接口中 org.springframework.beans.factory.InitializingBean
        抛出:
        Exception
      • doSend

        protected void doSend​(String destination,
                              org.springframework.messaging.Message<?> message)
        指定者:
        doSend 在类中 org.springframework.messaging.core.AbstractMessageSendingTemplate<String>
      • doConvert

        protected org.springframework.messaging.Message<?> doConvert​(Object payload,
                                                                     Map<String,​Object> headers,
                                                                     org.springframework.messaging.core.MessagePostProcessor postProcessor)
        覆盖:
        doConvert 在类中 org.springframework.messaging.core.AbstractMessageSendingTemplate<String>
      • destroy

        public void destroy()
        指定者:
        destroy 在接口中 org.springframework.beans.factory.DisposableBean
      • sendMessageInTransaction

        public org.apache.rocketmq.client.producer.TransactionSendResult sendMessageInTransaction​(String destination,
                                                                                                  org.springframework.messaging.Message<?> message,
                                                                                                  Object arg)
                                                                                           throws org.springframework.messaging.MessagingException
        Send Spring Message in Transaction
        参数:
        destination - destination formats: `topicName:tags`
        message - message Message
        arg - ext arg
        返回:
        TransactionSendResult
        抛出:
        org.springframework.messaging.MessagingException
      • receive

        public <T> List<T> receive​(Class<T> clazz)
        receive message in pull mode.
        类型参数:
        T -
        参数:
        clazz - message object type
        返回:
        message list
      • receive

        public <T> List<T> receive​(Class<T> clazz,
                                   long timeout)
        Same to #receive(Class) with receive timeout specified in addition.
        类型参数:
        T -
        参数:
        clazz - message object type
        timeout - receive timeout with millis
        返回:
        message list