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
public class MethodRabbitListenerEndpoint extends AbstractRabbitListenerEndpoint
ARabbitListenerEndpoint
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
Nested Classes Modifier and Type Class Description static interface
MethodRabbitListenerEndpoint.AdapterProvider
Provider of listener adapters.
-
Constructor Summary
Constructors Constructor Description MethodRabbitListenerEndpoint()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected 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
createMessageListenerInstance()
Create an emptyMessagingMessageListenerAdapter
instance.Object
getBean()
protected StringBuilder
getEndpointDescription()
protected MessageHandlerMethodFactory
getMessageHandlerMethodFactory()
Method
getMethod()
void
setAdapterProvider(MethodRabbitListenerEndpoint.AdapterProvider adapterProvider)
Set a provider to create adapter instances.void
setBean(Object bean)
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
setMethod(Method method)
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, 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
-
-
-
-
Method Detail
-
setBean
public void setBean(Object bean)
Set the object instance that should manage this endpoint.- Parameters:
bean
- the target bean instance.
-
getBean
public Object getBean()
-
setMethod
public void setMethod(Method method)
Set the method to invoke to process a message managed by this endpoint.- Parameters:
method
- the target method for thebean
.
-
getMethod
public Method getMethod()
-
setMessageHandlerMethodFactory
public void setMessageHandlerMethodFactory(MessageHandlerMethodFactory messageHandlerMethodFactory)
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
public void setErrorHandler(RabbitListenerErrorHandler errorHandler)
Set theRabbitListenerErrorHandler
to invoke if the listener method throws an exception.- Parameters:
errorHandler
- the error handler.- Since:
- 2.0
-
getMessageHandlerMethodFactory
protected MessageHandlerMethodFactory getMessageHandlerMethodFactory()
- Returns:
- the messageHandlerMethodFactory
-
setAdapterProvider
public void setAdapterProvider(MethodRabbitListenerEndpoint.AdapterProvider adapterProvider)
Set a provider to create adapter instances.- Parameters:
adapterProvider
- the provider.
-
createMessageListener
protected MessagingMessageListenerAdapter createMessageListener(MessageListenerContainer container)
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
protected HandlerAdapter configureListenerAdapter(MessagingMessageListenerAdapter messageListener)
Create aHandlerAdapter
for this listener adapter.- Parameters:
messageListener
- the listener adapter.- Returns:
- the handler adapter.
-
createMessageListenerInstance
protected MessagingMessageListenerAdapter createMessageListenerInstance()
Create an emptyMessagingMessageListenerAdapter
instance.- Returns:
- the
MessagingMessageListenerAdapter
instance.
-
getEndpointDescription
protected StringBuilder getEndpointDescription()
- Overrides:
getEndpointDescription
in classAbstractRabbitListenerEndpoint
- Returns:
- a description for this endpoint.
Available to subclasses, for inclusion in their
toString()
result.
-
-