Class BatchingRabbitTemplate
- java.lang.Object
-
- org.springframework.amqp.rabbit.connection.RabbitAccessor
-
- org.springframework.amqp.rabbit.core.RabbitTemplate
-
- org.springframework.amqp.rabbit.core.BatchingRabbitTemplate
-
- All Implemented Interfaces:
org.springframework.amqp.core.AmqpTemplate,org.springframework.amqp.core.MessageListener,PublisherCallbackChannel.Listener,RabbitOperations,ChannelAwareMessageListener,ListenerContainerAware,org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanFactoryAware,org.springframework.beans.factory.BeanNameAware,org.springframework.beans.factory.DisposableBean,org.springframework.beans.factory.InitializingBean,org.springframework.context.Lifecycle
public class BatchingRabbitTemplate extends RabbitTemplate
ARabbitTemplatethat permits batching individual messages into a larger message. Allsend()methods (exceptsend(String, String, org.springframework.amqp.core.Message, org.springframework.amqp.rabbit.connection.CorrelationData)) are eligible for batching.Experimental - APIs may change.
- Since:
- 1.4.1
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.springframework.amqp.rabbit.core.RabbitTemplate
RabbitTemplate.ConfirmCallback, RabbitTemplate.ReturnCallback, RabbitTemplate.ReturnsCallback, RabbitTemplate.TemplateConsumer
-
Nested classes/interfaces inherited from interface org.springframework.amqp.rabbit.core.RabbitOperations
RabbitOperations.OperationsCallback<T>
-
-
Field Summary
-
Fields inherited from class org.springframework.amqp.rabbit.connection.RabbitAccessor
logger
-
-
Constructor Summary
Constructors Constructor Description BatchingRabbitTemplate(BatchingStrategy batchingStrategy, org.springframework.scheduling.TaskScheduler scheduler)Create an instance with the supplied parameters.BatchingRabbitTemplate(ConnectionFactory connectionFactory, BatchingStrategy batchingStrategy, org.springframework.scheduling.TaskScheduler scheduler)Create an instance with the supplied parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddoStart()Perform additional start actions.voiddoStop()Perform additional stop actions.voidflush()Flush any partial in-progress batches.booleanisRunning()voidsend(java.lang.String exchange, java.lang.String routingKey, org.springframework.amqp.core.Message message, CorrelationData correlationData)Send a message to a specific exchange with a specific routing key.-
Methods inherited from class org.springframework.amqp.rabbit.core.RabbitTemplate
addAfterReceivePostProcessors, addBeforePublishPostProcessors, addListener, convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertMessageIfNecessary, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceiveAsType, convertSendAndReceiveAsType, convertSendAndReceiveAsType, convertSendAndReceiveAsType, convertSendAndReceiveAsType, convertSendAndReceiveAsType, convertSendAndReceiveAsType, convertSendAndReceiveAsType, convertSendAndReceiveAsType, convertSendAndReceiveAsType, convertSendAndReceiveAsType, convertSendAndReceiveRaw, correlationConvertAndSend, destroy, doReceiveNoWait, doSend, doSendAndReceive, doSendAndReceiveWithFixed, doSendAndReceiveWithTemporary, execute, expectedQueueNames, getAfterReceivePostProcessors, getDefaultReceiveQueue, getEncoding, getExchange, getMessageConverter, getMessagePropertiesConverter, getRoutingKey, getUnconfirmed, getUnconfirmedCount, getUUID, handleConfirm, handleReturn, handleReturn, initDefaultStrategies, invoke, isChannelLocallyTransacted, isConfirmListener, isMandatoryFor, isReturnListener, isUsePublisherConnection, logReceived, nullSafeExchange, nullSafeRoutingKey, onMessage, onMessage, receive, receive, receive, receive, receiveAndConvert, receiveAndConvert, receiveAndConvert, receiveAndConvert, receiveAndConvert, receiveAndConvert, receiveAndConvert, receiveAndConvert, receiveAndReply, receiveAndReply, receiveAndReply, receiveAndReply, receiveAndReply, receiveAndReply, removeAfterReceivePostProcessor, removeBeforePublishPostProcessor, replyTimedOut, revoke, send, send, send, send, sendAndReceive, sendAndReceive, sendAndReceive, sendAndReceive, sendAndReceive, sendAndReceive, sendToRabbit, setAfterReceivePostProcessors, setBeanFactory, setBeanName, setBeforePublishPostProcessors, setConfirmCallback, setConnectionFactory, setCorrelationDataPostProcessor, setCorrelationKey, setDefaultReceiveQueue, setEncoding, setExchange, setMandatory, setMandatoryExpression, setMandatoryExpressionString, setMessageConverter, setMessagePropertiesConverter, setNoLocalReplyConsumer, setReceiveConnectionFactorySelectorExpression, setReceiveTimeout, setRecoveryCallback, setReplyAddress, setReplyErrorHandler, setReplyTimeout, setRetryTemplate, setReturnCallback, setReturnsCallback, setRoutingKey, setSendConnectionFactorySelectorExpression, setTaskExecutor, setUseChannelForCorrelation, setUseDirectReplyToContainer, setUsePublisherConnection, setUserCorrelationId, setUserIdExpression, setUserIdExpressionString, setUseTemporaryReplyQueues, start, stop, useDirectReplyTo, waitForConfirms, waitForConfirmsOrDie
-
Methods inherited from class org.springframework.amqp.rabbit.connection.RabbitAccessor
afterPropertiesSet, convertRabbitAccessException, createConnection, getChannel, getConnection, getConnectionFactory, getTransactionalResourceHolder, isChannelTransacted, setChannelTransacted
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.springframework.amqp.rabbit.listener.api.ChannelAwareMessageListener
onMessageBatch
-
Methods inherited from interface org.springframework.amqp.core.MessageListener
containerAckMode, isAsyncReplies, onMessageBatch
-
Methods inherited from interface org.springframework.amqp.rabbit.core.RabbitOperations
convertSendAndReceiveAsType, getConnectionFactory, invoke
-
-
-
-
Constructor Detail
-
BatchingRabbitTemplate
public BatchingRabbitTemplate(BatchingStrategy batchingStrategy, org.springframework.scheduling.TaskScheduler scheduler)
Create an instance with the supplied parameters.- Parameters:
batchingStrategy- the batching strategy.scheduler- the scheduler.
-
BatchingRabbitTemplate
public BatchingRabbitTemplate(ConnectionFactory connectionFactory, BatchingStrategy batchingStrategy, org.springframework.scheduling.TaskScheduler scheduler)
Create an instance with the supplied parameters.- Parameters:
connectionFactory- the connection factory.batchingStrategy- the batching strategy.scheduler- the scheduler.- Since:
- 2.2
-
-
Method Detail
-
send
public void send(java.lang.String exchange, java.lang.String routingKey, org.springframework.amqp.core.Message message, CorrelationData correlationData) throws org.springframework.amqp.AmqpExceptionDescription copied from interface:RabbitOperationsSend a message to a specific exchange with a specific routing key.- Specified by:
sendin interfaceRabbitOperations- Overrides:
sendin classRabbitTemplate- Parameters:
exchange- the name of the exchangeroutingKey- the routing keymessage- a message to sendcorrelationData- data to correlate publisher confirms.- Throws:
org.springframework.amqp.AmqpException- if there is a problem
-
flush
public void flush()
Flush any partial in-progress batches.
-
doStart
public void doStart()
Description copied from class:RabbitTemplatePerform additional start actions.- Overrides:
doStartin classRabbitTemplate
-
doStop
public void doStop()
Description copied from class:RabbitTemplatePerform additional stop actions.- Overrides:
doStopin classRabbitTemplate
-
isRunning
public boolean isRunning()
- Specified by:
isRunningin interfaceorg.springframework.context.Lifecycle- Specified by:
isRunningin interfaceRabbitOperations- Overrides:
isRunningin classRabbitTemplate
-
-