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
ARabbitListenerEndpointproviding 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 interfaceMethodRabbitListenerEndpoint.AdapterProviderProvider of listener adapters.
-
Constructor Summary
Constructors Constructor Description MethodRabbitListenerEndpoint()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected HandlerAdapterconfigureListenerAdapter(MessagingMessageListenerAdapter messageListener)Create aHandlerAdapterfor this listener adapter.protected MessagingMessageListenerAdaptercreateMessageListener(MessageListenerContainer container)Create aMessageListenerthat is able to serve this endpoint for the specified container.protected MessagingMessageListenerAdaptercreateMessageListenerInstance()Create an emptyMessagingMessageListenerAdapterinstance.ObjectgetBean()protected StringBuildergetEndpointDescription()protected MessageHandlerMethodFactorygetMessageHandlerMethodFactory()MethodgetMethod()voidsetAdapterProvider(MethodRabbitListenerEndpoint.AdapterProvider adapterProvider)Set a provider to create adapter instances.voidsetBean(Object bean)Set the object instance that should manage this endpoint.voidsetErrorHandler(RabbitListenerErrorHandler errorHandler)Set theRabbitListenerErrorHandlerto invoke if the listener method throws an exception.voidsetMessageHandlerMethodFactory(MessageHandlerMethodFactory messageHandlerMethodFactory)Set theMessageHandlerMethodFactoryto use to build theInvocableHandlerMethodresponsible to manage the invocation of this endpoint.voidsetMethod(Method method)Set the method to invoke to process a message managed by this endpoint.voidsetReturnExceptions(boolean returnExceptions)Set whether exceptions thrown by the listener should be returned to the sender using the normalreplyTo/@SendTosemantics.-
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 theMessageHandlerMethodFactoryto use to build theInvocableHandlerMethodresponsible to manage the invocation of this endpoint.- Parameters:
messageHandlerMethodFactory- theMessageHandlerMethodFactoryinstance.
-
setReturnExceptions
public void setReturnExceptions(boolean returnExceptions)
Set whether exceptions thrown by the listener should be returned to the sender using the normalreplyTo/@SendTosemantics.- Parameters:
returnExceptions- true to return exceptions.- Since:
- 2.0
-
setErrorHandler
public void setErrorHandler(RabbitListenerErrorHandler errorHandler)
Set theRabbitListenerErrorHandlerto 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:AbstractRabbitListenerEndpointCreate aMessageListenerthat is able to serve this endpoint for the specified container.- Specified by:
createMessageListenerin classAbstractRabbitListenerEndpoint- Parameters:
container- theMessageListenerContainerto create aMessageListener.- Returns:
- a a
MessageListenerinstance.
-
configureListenerAdapter
protected HandlerAdapter configureListenerAdapter(MessagingMessageListenerAdapter messageListener)
Create aHandlerAdapterfor this listener adapter.- Parameters:
messageListener- the listener adapter.- Returns:
- the handler adapter.
-
createMessageListenerInstance
protected MessagingMessageListenerAdapter createMessageListenerInstance()
Create an emptyMessagingMessageListenerAdapterinstance.- Returns:
- the
MessagingMessageListenerAdapterinstance.
-
getEndpointDescription
protected StringBuilder getEndpointDescription()
- Overrides:
getEndpointDescriptionin classAbstractRabbitListenerEndpoint- Returns:
- a description for this endpoint.
Available to subclasses, for inclusion in their
toString()result.
-
-