Class MethodRabbitListenerEndpoint
java.lang.Object
org.springframework.amqp.rabbit.listener.AbstractRabbitListenerEndpoint
org.springframework.amqp.rabbit.listener.MethodRabbitListenerEndpoint
- All Implemented Interfaces:
RabbitListenerEndpoint
,Aware
,BeanFactoryAware
- Direct Known Subclasses:
MultiMethodRabbitListenerEndpoint
A
RabbitListenerEndpoint
providing the method to invoke to process
an incoming message for this endpoint.- Since:
- 1.4
- Author:
- Stephane Nicoll, Artem Bilan, Gary Russell
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Provider of listener adapters. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected HandlerAdapter
configureListenerAdapter
(MessagingMessageListenerAdapter messageListener) Create aHandlerAdapter
for this listener adapter.protected MessagingMessageListenerAdapter
createMessageListener
(MessageListenerContainer container) Create aMessageListener
that is able to serve this endpoint for the specified container.protected MessagingMessageListenerAdapter
Create an emptyMessagingMessageListenerAdapter
instance.getBean()
protected StringBuilder
protected MessageHandlerMethodFactory
void
setAdapterProvider
(MethodRabbitListenerEndpoint.AdapterProvider adapterProvider) Set a provider to create adapter instances.void
Set the object instance that should manage this endpoint.void
setErrorHandler
(RabbitListenerErrorHandler errorHandler) Set theRabbitListenerErrorHandler
to invoke if the listener method throws an exception.void
setMessageHandlerMethodFactory
(MessageHandlerMethodFactory messageHandlerMethodFactory) Set theMessageHandlerMethodFactory
to use to build theInvocableHandlerMethod
responsible to manage the invocation of this endpoint.void
Set the method to invoke to process a message managed by this endpoint.void
setReturnExceptions
(boolean returnExceptions) Set whether exceptions thrown by the listener should be returned to the sender using the normalreplyTo/@SendTo
semantics.Methods inherited from class org.springframework.amqp.rabbit.listener.AbstractRabbitListenerEndpoint
getAckMode, getAdmin, getAutoStartup, getBatchingStrategy, getBatchListener, getBeanExpressionContext, getBeanFactory, getBeanResolver, getConcurrency, getGroup, getId, getMessageConverter, getPriority, getQueueNames, getQueues, getReplyContentType, getReplyPostProcessor, getResolver, getTaskExecutor, isBatchListener, isConverterWinsContentType, isExclusive, setAckMode, setAdmin, setAutoStartup, setBatchingStrategy, setBatchListener, setBeanFactory, setConcurrency, setConverterWinsContentType, setExclusive, setGroup, setId, setMessageConverter, setPriority, setQueueNames, setQueues, setReplyContentType, setReplyPostProcessor, setTaskExecutor, setupListenerContainer, toString
-
Constructor Details
-
MethodRabbitListenerEndpoint
public MethodRabbitListenerEndpoint()
-
-
Method Details
-
setBean
Set the object instance that should manage this endpoint.- Parameters:
bean
- the target bean instance.
-
getBean
-
setMethod
Set the method to invoke to process a message managed by this endpoint.- Parameters:
method
- the target method for thebean
.
-
getMethod
-
setMessageHandlerMethodFactory
Set theMessageHandlerMethodFactory
to use to build theInvocableHandlerMethod
responsible to manage the invocation of this endpoint.- Parameters:
messageHandlerMethodFactory
- theMessageHandlerMethodFactory
instance.
-
setReturnExceptions
public void setReturnExceptions(boolean returnExceptions) Set whether exceptions thrown by the listener should be returned to the sender using the normalreplyTo/@SendTo
semantics.- Parameters:
returnExceptions
- true to return exceptions.- Since:
- 2.0
-
setErrorHandler
Set theRabbitListenerErrorHandler
to invoke if the listener method throws an exception.- Parameters:
errorHandler
- the error handler.- Since:
- 2.0
-
getMessageHandlerMethodFactory
- Returns:
- the messageHandlerMethodFactory
-
setAdapterProvider
Set a provider to create adapter instances.- Parameters:
adapterProvider
- the provider.
-
createMessageListener
Description copied from class:AbstractRabbitListenerEndpoint
Create aMessageListener
that is able to serve this endpoint for the specified container.- Specified by:
createMessageListener
in classAbstractRabbitListenerEndpoint
- Parameters:
container
- theMessageListenerContainer
to create aMessageListener
.- Returns:
- a a
MessageListener
instance.
-
configureListenerAdapter
Create aHandlerAdapter
for this listener adapter.- Parameters:
messageListener
- the listener adapter.- Returns:
- the handler adapter.
-
createMessageListenerInstance
Create an emptyMessagingMessageListenerAdapter
instance.- Parameters:
batch
- whether this endpoint is for a batch listener.- Returns:
- the
MessagingMessageListenerAdapter
instance.
-
getEndpointDescription
- Overrides:
getEndpointDescription
in classAbstractRabbitListenerEndpoint
- Returns:
- a description for this endpoint.
Available to subclasses, for inclusion in their
toString()
result.
-