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:
AmqpTemplate,MessageListener,PublisherCallbackChannel.Listener,RabbitOperations,ChannelAwareMessageListener,ListenerContainerAware,Aware,BeanFactoryAware,BeanNameAware,DisposableBean,InitializingBean,Lifecycle
A
RabbitTemplate that permits batching individual messages into a larger
message. All send() methods (except
send(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
- Author:
- Gary Russell
-
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.amqp.rabbit.core.RabbitTemplate
RabbitTemplate.ConfirmCallback, RabbitTemplate.ReturnCallback, RabbitTemplate.ReturnsCallback, RabbitTemplate.TemplateConsumerNested 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
ConstructorsConstructorDescriptionBatchingRabbitTemplate(BatchingStrategy batchingStrategy, TaskScheduler scheduler) Create an instance with the supplied parameters.BatchingRabbitTemplate(ConnectionFactory connectionFactory, BatchingStrategy batchingStrategy, TaskScheduler scheduler) Create an instance with the supplied parameters. -
Method Summary
Modifier and TypeMethodDescriptionvoiddoStart()Perform additional start actions.voiddoStop()Perform additional stop actions.voidflush()Flush any partial in-progress batches.booleanvoidsend(String exchange, String routingKey, 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, 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, waitForConfirmsOrDieMethods inherited from class org.springframework.amqp.rabbit.connection.RabbitAccessor
afterPropertiesSet, convertRabbitAccessException, createConnection, getChannel, getConnection, getConnectionFactory, getTransactionalResourceHolder, isChannelTransacted, setChannelTransactedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.amqp.rabbit.listener.api.ChannelAwareMessageListener
onMessageBatchMethods inherited from interface org.springframework.amqp.core.MessageListener
containerAckMode, isAsyncReplies, onMessageBatchMethods inherited from interface org.springframework.amqp.rabbit.core.RabbitOperations
convertSendAndReceiveAsType, getConnectionFactory, invoke
-
Constructor Details
-
BatchingRabbitTemplate
Create an instance with the supplied parameters.- Parameters:
batchingStrategy- the batching strategy.scheduler- the scheduler.
-
BatchingRabbitTemplate
public BatchingRabbitTemplate(ConnectionFactory connectionFactory, BatchingStrategy batchingStrategy, 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 Details
-
send
public void send(String exchange, String routingKey, Message message, CorrelationData correlationData) throws AmqpException Description 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:
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 interfaceLifecycle- Specified by:
isRunningin interfaceRabbitOperations- Overrides:
isRunningin classRabbitTemplate
-