类 RocketMQTemplate
- java.lang.Object
-
- org.springframework.messaging.core.AbstractMessageSendingTemplate<String>
-
- org.apache.rocketmq.spring.core.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()
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 voidafterPropertiesSet()voidasyncSend(String destination, Object payload, org.apache.rocketmq.client.producer.SendCallback sendCallback)voidasyncSend(String destination, Object payload, org.apache.rocketmq.client.producer.SendCallback sendCallback, long timeout)Same toasyncSend(String, Object, SendCallback)with send timeout specified in addition.<T extends org.springframework.messaging.Message>
voidasyncSend(String destination, Collection<T> messages, org.apache.rocketmq.client.producer.SendCallback sendCallback)asyncSend batch messages<T extends org.springframework.messaging.Message>
voidasyncSend(String destination, Collection<T> messages, org.apache.rocketmq.client.producer.SendCallback sendCallback, long timeout)asyncSend batch messages in a given timeout.voidasyncSend(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.voidasyncSend(String destination, org.springframework.messaging.Message<?> message, org.apache.rocketmq.client.producer.SendCallback sendCallback, long timeout)Same toasyncSend(String, Message, SendCallback)with send timeout specified in addition.voidasyncSend(String destination, org.springframework.messaging.Message<?> message, org.apache.rocketmq.client.producer.SendCallback sendCallback, long timeout, int delayLevel)Same toasyncSend(String, Message, SendCallback)with send timeout and delay level specified in addition.voidasyncSendOrderly(String destination, Object payload, String hashKey, org.apache.rocketmq.client.producer.SendCallback sendCallback)voidasyncSendOrderly(String destination, Object payload, String hashKey, org.apache.rocketmq.client.producer.SendCallback sendCallback, long timeout)Same toasyncSendOrderly(String, Object, String, SendCallback)with send timeout specified in addition.voidasyncSendOrderly(String destination, org.springframework.messaging.Message<?> message, String hashKey, org.apache.rocketmq.client.producer.SendCallback sendCallback)Same toasyncSend(String, Message, SendCallback)with send orderly with hashKey by specified.voidasyncSendOrderly(String destination, org.springframework.messaging.Message<?> message, String hashKey, org.apache.rocketmq.client.producer.SendCallback sendCallback, long timeout)Same toasyncSendOrderly(String, Message, String, SendCallback)with send timeout specified in addition.voidasyncSendOrderly(String destination, org.springframework.messaging.Message<?> message, String hashKey, org.apache.rocketmq.client.producer.SendCallback sendCallback, long timeout, int delayLevel)Same toasyncSendOrderly(String, Message, String, SendCallback)with send timeout specified in addition.voiddestroy()protected org.springframework.messaging.Message<?>doConvert(Object payload, Map<String,Object> headers, org.springframework.messaging.core.MessagePostProcessor postProcessor)protected voiddoSend(String destination, org.springframework.messaging.Message<?> message)StringgetCharset()org.apache.rocketmq.client.consumer.DefaultLitePullConsumergetConsumer()org.apache.rocketmq.client.producer.MessageQueueSelectorgetMessageQueueSelector()org.apache.rocketmq.client.producer.DefaultMQProducergetProducer()<T> List<T>receive(Class<T> clazz)receive message in pull mode.<T> List<T>receive(Class<T> clazz, long timeout)Same to#receive(Classwith receive timeout specified in addition.) <T> TsendAndReceive(String destination, Object payload, Type type)<T> TsendAndReceive(String destination, Object payload, Type type, long timeout)<T> TsendAndReceive(String destination, Object payload, Type type, long timeout, int delayLevel)<T> TsendAndReceive(String destination, Object payload, Type type, String hashKey)<T> TsendAndReceive(String destination, Object payload, Type type, String hashKey, long timeout)<T> TsendAndReceive(String destination, Object payload, Type type, String hashKey, long timeout, int delayLevel)voidsendAndReceive(String destination, Object payload, RocketMQLocalRequestCallback rocketMQLocalRequestCallback)voidsendAndReceive(String destination, Object payload, RocketMQLocalRequestCallback rocketMQLocalRequestCallback, long timeout)voidsendAndReceive(String destination, Object payload, RocketMQLocalRequestCallback rocketMQLocalRequestCallback, long timeout, int delayLevel)voidsendAndReceive(String destination, Object payload, RocketMQLocalRequestCallback rocketMQLocalRequestCallback, String hashKey)voidsendAndReceive(String destination, Object payload, RocketMQLocalRequestCallback rocketMQLocalRequestCallback, String hashKey, long timeout)voidsendAndReceive(String destination, Object payload, RocketMQLocalRequestCallback rocketMQLocalRequestCallback, String hashKey, long timeout, int delayLevel)<T> TsendAndReceive(String destination, org.springframework.messaging.Message<?> message, Type type)<T> TsendAndReceive(String destination, org.springframework.messaging.Message<?> message, Type type, long timeout)<T> TsendAndReceive(String destination, org.springframework.messaging.Message<?> message, Type type, long timeout, int delayLevel)<T> TsendAndReceive(String destination, org.springframework.messaging.Message<?> message, Type type, String hashKey)<T> TsendAndReceive(String destination, org.springframework.messaging.Message<?> message, Type type, String hashKey, long timeout)<T> TsendAndReceive(String destination, org.springframework.messaging.Message<?> message, Type type, String hashKey, long timeout, int delayLevel)voidsendAndReceive(String destination, org.springframework.messaging.Message<?> message, RocketMQLocalRequestCallback rocketMQLocalRequestCallback)voidsendAndReceive(String destination, org.springframework.messaging.Message<?> message, RocketMQLocalRequestCallback rocketMQLocalRequestCallback, long timeout)voidsendAndReceive(String destination, org.springframework.messaging.Message<?> message, RocketMQLocalRequestCallback rocketMQLocalRequestCallback, long timeout, int delayLevel)voidsendAndReceive(String destination, org.springframework.messaging.Message<?> message, RocketMQLocalRequestCallback rocketMQLocalRequestCallback, String hashKey)voidsendAndReceive(String destination, org.springframework.messaging.Message<?> message, RocketMQLocalRequestCallback rocketMQLocalRequestCallback, String hashKey, long timeout)voidsendAndReceive(String destination, org.springframework.messaging.Message<?> message, RocketMQLocalRequestCallback rocketMQLocalRequestCallback, String hashKey, long timeout, int delayLevel)Send request message in asynchronous mode.org.apache.rocketmq.client.producer.TransactionSendResultsendMessageInTransaction(String destination, org.springframework.messaging.Message<?> message, Object arg)Send Spring Message in TransactionvoidsendOneWay(String destination, Object payload)Same tosendOneWay(String, Message)voidsendOneWay(String destination, org.springframework.messaging.Message<?> message)Similar to UDP, this method won't wait for acknowledgement from broker before return.voidsendOneWayOrderly(String destination, Object payload, String hashKey)voidsendOneWayOrderly(String destination, org.springframework.messaging.Message<?> message, String hashKey)Same tosendOneWay(String, Message)with send orderly with hashKey by specified.voidsetAsyncSenderExecutor(ExecutorService asyncSenderExecutor)voidsetCharset(String charset)voidsetConsumer(org.apache.rocketmq.client.consumer.DefaultLitePullConsumer consumer)voidsetMessageQueueSelector(org.apache.rocketmq.client.producer.MessageQueueSelector messageQueueSelector)voidsetProducer(org.apache.rocketmq.client.producer.DefaultMQProducer producer)org.apache.rocketmq.client.producer.SendResultsyncSend(String destination, Object payload)Same tosyncSend(String, Message).org.apache.rocketmq.client.producer.SendResultsyncSend(String destination, Object payload, long timeout)Same tosyncSend(String, Object)with send timeout specified in addition.<T extends org.springframework.messaging.Message>
org.apache.rocketmq.client.producer.SendResultsyncSend(String destination, Collection<T> messages)syncSend batch messages<T extends org.springframework.messaging.Message>
org.apache.rocketmq.client.producer.SendResultsyncSend(String destination, Collection<T> messages, long timeout)syncSend batch messages in a given timeout.org.apache.rocketmq.client.producer.SendResultsyncSend(String destination, org.springframework.messaging.Message<?> message)Send message in synchronous mode.org.apache.rocketmq.client.producer.SendResultsyncSend(String destination, org.springframework.messaging.Message<?> message, long timeout)Same tosyncSend(String, Message)with send timeout specified in addition.org.apache.rocketmq.client.producer.SendResultsyncSend(String destination, org.springframework.messaging.Message<?> message, long timeout, int delayLevel)Same tosyncSend(String, Message)with send timeout specified in addition.org.apache.rocketmq.client.producer.SendResultsyncSendDelayTimeMills(String destination, Object payload, long delayTime)Same tosyncSend(String, Object)with send delayTime specified in addition.org.apache.rocketmq.client.producer.SendResultsyncSendDelayTimeMills(String destination, org.springframework.messaging.Message<?> message, long delayTime)Same tosyncSend(String, Message)with send delay time specified in addition.org.apache.rocketmq.client.producer.SendResultsyncSendDelayTimeSeconds(String destination, Object payload, long delayTime)Same tosyncSend(String, Object)with send delayTime specified in addition.org.apache.rocketmq.client.producer.SendResultsyncSendDelayTimeSeconds(String destination, org.springframework.messaging.Message<?> message, long delayTime)Same tosyncSend(String, Message)with send delay time specified in addition.org.apache.rocketmq.client.producer.SendResultsyncSendDeliverTimeMills(String destination, Object payload, long deliverTimeMills)Same tosyncSend(String, Object)with send in a delivered time.org.apache.rocketmq.client.producer.SendResultsyncSendDeliverTimeMills(String destination, org.springframework.messaging.Message<?> message, long deliverTimeMills)Same tosyncSend(String, Message)with send in a delivered time.org.apache.rocketmq.client.producer.SendResultsyncSendOrderly(String destination, Object payload, String hashKey)Same tosyncSend(String, Object)with send orderly with hashKey by specified.org.apache.rocketmq.client.producer.SendResultsyncSendOrderly(String destination, Object payload, String hashKey, long timeout)Same tosyncSendOrderly(String, Object, String)with send timeout specified in addition.<T extends org.springframework.messaging.Message>
org.apache.rocketmq.client.producer.SendResultsyncSendOrderly(String destination, Collection<T> messages, String hashKey)syncSend batch messages orderly.<T extends org.springframework.messaging.Message>
org.apache.rocketmq.client.producer.SendResultsyncSendOrderly(String destination, Collection<T> messages, String hashKey, long timeout)Same tosyncSendOrderly(String, Collection, String)with send timeout specified in addition.org.apache.rocketmq.client.producer.SendResultsyncSendOrderly(String destination, org.springframework.messaging.Message<?> message, String hashKey)Same tosyncSend(String, Message)with send orderly with hashKey by specified.org.apache.rocketmq.client.producer.SendResultsyncSendOrderly(String destination, org.springframework.messaging.Message<?> message, String hashKey, long timeout)Same tosyncSendOrderly(String, Message, String)with send timeout specified in addition.org.apache.rocketmq.client.producer.SendResultsyncSendOrderly(String destination, org.springframework.messaging.Message<?> message, String hashKey, long timeout, int delayLevel)Same tosyncSendOrderly(String, Message, String)with send timeout specified in addition.-
从类继承的方法 org.springframework.messaging.core.AbstractMessageSendingTemplate
convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, getDefaultDestination, getMessageConverter, getRequiredDefaultDestination, processHeadersToSend, send, send, setDefaultDestination, setMessageConverter
-
-
-
-
方法详细资料
-
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-Messagethe 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-Messagethe message to be sent.type- The type of Ttimeout- 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 Ttimeout- 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-Messagethe message to be sent.type- The type of Ttimeout- send timeout in millisdelayLevel- 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 Ttimeout- send timeout in millisdelayLevel- 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-Messagethe message to be sent.type- The type of ThashKey- 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 ThashKey- 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-Messagethe message to be sent.type- The type of ThashKey- needed when sending message orderlytimeout- 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 ThashKey-- 返回:
-
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-Messagethe message to be sent.type- The type that receivehashKey- needed when sending message orderlytimeout- send timeout in millisdelayLevel- 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 receivehashKey- needed when sending message orderlytimeout- send timeout in millisdelayLevel- 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-Messagethe 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-Messagethe 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-Messagethe message to be sent.rocketMQLocalRequestCallback- callback that will be invoked when reply message received.timeout- send timeout in millisdelayLevel- 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-Messagethe message to be sent.rocketMQLocalRequestCallback- callback that will be invoked when reply message received.hashKey- needed when sending message orderlytimeout- 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 orderlytimeout- send timeout in millis
-
sendAndReceive
public void sendAndReceive(String destination, org.springframework.messaging.Message<?> message, RocketMQLocalRequestCallback rocketMQLocalRequestCallback, String hashKey)
- 参数:
destination- formats: `topicName:tags`message-Messagethe 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 millisdelayLevel- 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 orderlytimeout- send timeout in millisdelayLevel- 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,rocketMQLocalRequestCallbackwill be executed.- 参数:
destination- formats: `topicName:tags`message-Messagethe message to be sent.rocketMQLocalRequestCallback- callback that will be invoked when reply message received.hashKey- needed when sending message orderlytimeout- send timeout in millisdelayLevel- 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 tosyncSend(String, Message)with send timeout specified in addition.- 参数:
destination- formats: `topicName:tags`message-Messagetimeout- 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 ofMessage- 返回:
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 ofMessagetimeout- send timeout with millis- 返回:
SendResult
-
syncSendDelayTimeSeconds
public org.apache.rocketmq.client.producer.SendResult syncSendDelayTimeSeconds(String destination, org.springframework.messaging.Message<?> message, long delayTime)
Same tosyncSend(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-MessagedelayTime- delay time in seconds for message- 返回:
SendResult
-
syncSendDelayTimeSeconds
public org.apache.rocketmq.client.producer.SendResult syncSendDelayTimeSeconds(String destination, Object payload, long delayTime)
Same tosyncSend(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 payloaddelayTime- 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 tosyncSend(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-MessagedelayTime- delay time in millisecond for message- 返回:
SendResult
-
syncSendDelayTimeMills
public org.apache.rocketmq.client.producer.SendResult syncSendDelayTimeMills(String destination, Object payload, long delayTime)
Same tosyncSend(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 payloaddelayTime- 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 tosyncSend(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-MessagedeliverTimeMills- delivered time in millisecond for message- 返回:
SendResult
-
syncSendDeliverTimeMills
public org.apache.rocketmq.client.producer.SendResult syncSendDeliverTimeMills(String destination, Object payload, long deliverTimeMills)
Same tosyncSend(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 payloaddeliverTimeMills- 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 tosyncSend(String, Message)with send timeout specified in addition.- 参数:
destination- formats: `topicName:tags`message-Messagetimeout- send timeout with millisdelayLevel- level for the delay message- 返回:
SendResult
-
syncSend
public org.apache.rocketmq.client.producer.SendResult syncSend(String destination, Object payload)
Same tosyncSend(String, Message).- 参数:
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 tosyncSend(String, Object)with send timeout specified in addition.- 参数:
destination- formats: `topicName:tags`payload- the Object to use as payloadtimeout- send timeout with millis- 返回:
SendResult
-
syncSendOrderly
public org.apache.rocketmq.client.producer.SendResult syncSendOrderly(String destination, org.springframework.messaging.Message<?> message, String hashKey)
Same tosyncSend(String, Message)with send orderly with hashKey by specified.- 参数:
destination- formats: `topicName:tags`message-MessagehashKey- 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 tosyncSendOrderly(String, Message, String)with send timeout specified in addition.- 参数:
destination- formats: `topicName:tags`message-MessagehashKey- 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 tosyncSendOrderly(String, Message, String)with send timeout specified in addition.- 参数:
destination- formats: `topicName:tags`message-MessagehashKey- use this key to select queue. for example: orderId, productId ...timeout- send timeout with millisdelayLevel- level for the delay message- 返回:
SendResult
-
syncSendOrderly
public org.apache.rocketmq.client.producer.SendResult syncSendOrderly(String destination, Object payload, String hashKey)
Same tosyncSend(String, Object)with send orderly with hashKey by specified.- 参数:
destination- formats: `topicName:tags`payload- the Object to use as payloadhashKey- 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 tosyncSendOrderly(String, Object, String)with send timeout specified in addition.- 参数:
destination- formats: `topicName:tags`payload- the Object to use as payloadhashKey- 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 ofMessagehashKey- 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 tosyncSendOrderly(String, Collection, String)with send timeout specified in addition.- 参数:
destination- formats: `topicName:tags`messages- Collection ofMessagehashKey- 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 toasyncSend(String, Message, SendCallback)with send timeout and delay level specified in addition.- 参数:
destination- formats: `topicName:tags`message-MessagesendCallback-SendCallbacktimeout- send timeout with millisdelayLevel- 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 toasyncSend(String, Message, SendCallback)with send timeout specified in addition.- 参数:
destination- formats: `topicName:tags`message-MessagesendCallback-SendCallbacktimeout- 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,
sendCallbackwill be executed.Similar to
syncSend(String, Object), internal implementation would potentially retry up toDefaultMQProducer.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-MessagesendCallback-SendCallback
-
asyncSend
public void asyncSend(String destination, Object payload, org.apache.rocketmq.client.producer.SendCallback sendCallback, long timeout)
Same toasyncSend(String, Object, SendCallback)with send timeout specified in addition.- 参数:
destination- formats: `topicName:tags`payload- the Object to use as payloadsendCallback-SendCallbacktimeout- 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 payloadsendCallback-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 ofMessagesendCallback-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 ofMessagesendCallback-SendCallbacktimeout- 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 toasyncSendOrderly(String, Message, String, SendCallback)with send timeout specified in addition.- 参数:
destination- formats: `topicName:tags`message-MessagehashKey- use this key to select queue. for example: orderId, productId ...sendCallback-SendCallbacktimeout- 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 toasyncSendOrderly(String, Message, String, SendCallback)with send timeout specified in addition.- 参数:
destination- formats: `topicName:tags`message-MessagehashKey- use this key to select queue. for example: orderId, productId ...sendCallback-SendCallbacktimeout- send timeout with millisdelayLevel- 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 toasyncSend(String, Message, SendCallback)with send orderly with hashKey by specified.- 参数:
destination- formats: `topicName:tags`message-MessagehashKey- 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 payloadhashKey- 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 toasyncSendOrderly(String, Object, String, SendCallback)with send timeout specified in addition.- 参数:
destination- formats: `topicName:tags`payload- the Object to use as payloadhashKey- use this key to select queue. for example: orderId, productId ...sendCallback-SendCallbacktimeout- 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)
Same tosendOneWay(String, Message)- 参数:
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 tosendOneWay(String, Message)with send orderly with hashKey by specified.- 参数:
destination- formats: `topicName:tags`message-MessagehashKey- use this key to select queue. for example: orderId, productId ...
-
sendOneWayOrderly
public void sendOneWayOrderly(String destination, Object payload, String hashKey)
- 参数:
destination- formats: `topicName:tags`payload- the Object to use as payload
-
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- messageMessagearg- 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
-
-