Package io.awspring.cloud.sqs.config
Class AbstractMessageListenerContainerFactory<T,C extends MessageListenerContainer<T>,O extends ContainerOptions<O,B>,B extends ContainerOptionsBuilder<B,O>>
java.lang.Object
io.awspring.cloud.sqs.config.AbstractMessageListenerContainerFactory<T,C,O,B>
- Type Parameters:
T- theMessage's payload type to be consumed by theAbstractMessageListenerContainer.C- the type ofAbstractMessageListenerContainerinstances that will be created by this container.
- All Implemented Interfaces:
MessageListenerContainerFactory<C>
- Direct Known Subclasses:
SqsMessageListenerContainerFactory
public abstract class AbstractMessageListenerContainerFactory<T,C extends MessageListenerContainer<T>,O extends ContainerOptions<O,B>,B extends ContainerOptionsBuilder<B,O>>
extends Object
implements MessageListenerContainerFactory<C>
Base implementation for a
MessageListenerContainerFactory. Contains the components and
ContainerOptions that will be used as a template for MessageListenerContainer instances created by
this factory.- Since:
- 3.0
- Author:
- Tomaz Fernandes
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractMessageListenerContainerFactory(O containerOptions) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMessageInterceptor(AsyncMessageInterceptor<T> messageInterceptor) Add aAsyncMessageInterceptorto be used by containers created with this factory.voidaddMessageInterceptor(MessageInterceptor<T> messageInterceptor) Add aMessageInterceptorto be used by containers created with this factory.voidAllows configuring this factories'ContainerOptionsBuilder.protected voidconfigureAbstractContainer(AbstractMessageListenerContainer<T, O, B> container, Endpoint endpoint) protected voidconfigureContainer(C container, Endpoint endpoint) protected voidconfigureContainerOptions(Endpoint endpoint, B containerOptions) createContainer(Endpoint endpoint) Create a container instance for the givenEndpoint.createContainer(String... logicalEndpointNames) Create a container instance for the given endpoint names.protected abstract CcreateContainerInstance(Endpoint endpoint, O containerOptions) voidsetAcknowledgementResultCallback(AcknowledgementResultCallback<T> acknowledgementResultCallback) Set theAcknowledgementResultCallbackinstance to be used by containers created by this factory.voidsetAcknowledgementResultCallback(AsyncAcknowledgementResultCallback<T> acknowledgementResultCallback) Set theAsyncAcknowledgementResultCallbackinstance to be used by containers created by this factory.voidsetAsyncMessageListener(AsyncMessageListener<T> messageListener) Set theAsyncMessageListenerinstance to be used by containers created with this factory.voidsetContainerComponentFactories(Collection<ContainerComponentFactory<T, O>> containerComponentFactories) Set theContainerComponentFactoryinstances that will be used to create components for listener containers created by this factory.voidsetErrorHandler(AsyncErrorHandler<T> errorHandler) Set theAsyncErrorHandlerinstance to be used by containers created with this factory.voidsetErrorHandler(ErrorHandler<T> errorHandler) Set theErrorHandlerinstance to be used by containers created with this factory.voidsetMessageListener(MessageListener<T> messageListener) Set theMessageListenerinstance to be used by containers created with this factory.
-
Constructor Details
-
AbstractMessageListenerContainerFactory
-
-
Method Details
-
setErrorHandler
Set theErrorHandlerinstance to be used by containers created with this factory. The component will be adapted to anAsyncErrorHandler.- Parameters:
errorHandler- the error handler instance.- See Also:
-
setErrorHandler
Set theAsyncErrorHandlerinstance to be used by containers created with this factory.- Parameters:
errorHandler- the error handler instance.
-
addMessageInterceptor
Add aMessageInterceptorto be used by containers created with this factory. Interceptors will be applied just before method invocation. The component will be adapted to anAsyncMessageInterceptor.- Parameters:
messageInterceptor- the message interceptor instance.- See Also:
-
addMessageInterceptor
Add aAsyncMessageInterceptorto be used by containers created with this factory. Interceptors will be applied just before method invocation.- Parameters:
messageInterceptor- the message interceptor instance.
-
setMessageListener
Set theMessageListenerinstance to be used by containers created with this factory. If none is provided, a default one will be created according to the endpoint's configuration. The component will be adapted to anAsyncMessageListener.- Parameters:
messageListener- the message listener instance.- See Also:
-
setAsyncMessageListener
Set theAsyncMessageListenerinstance to be used by containers created with this factory. If none is provided, a default one will be created according to the endpoint's configuration.- Parameters:
messageListener- the message listener instance.
-
setAcknowledgementResultCallback
public void setAcknowledgementResultCallback(AsyncAcknowledgementResultCallback<T> acknowledgementResultCallback) Set theAsyncAcknowledgementResultCallbackinstance to be used by containers created by this factory.- Parameters:
acknowledgementResultCallback- the instance.
-
setAcknowledgementResultCallback
public void setAcknowledgementResultCallback(AcknowledgementResultCallback<T> acknowledgementResultCallback) Set theAcknowledgementResultCallbackinstance to be used by containers created by this factory.- Parameters:
acknowledgementResultCallback- the instance.
-
setContainerComponentFactories
public void setContainerComponentFactories(Collection<ContainerComponentFactory<T, O>> containerComponentFactories) Set theContainerComponentFactoryinstances that will be used to create components for listener containers created by this factory.- Parameters:
containerComponentFactories- the factory instances.
-
configure
Allows configuring this factories'ContainerOptionsBuilder. -
createContainer
Description copied from interface:MessageListenerContainerFactoryCreate a container instance for the givenEndpoint.- Specified by:
createContainerin interfaceMessageListenerContainerFactory<T>- Parameters:
endpoint- the endpoint.- Returns:
- the container instance.
-
configureContainerOptions
-
createContainer
Description copied from interface:MessageListenerContainerFactoryCreate a container instance for the given endpoint names.- Specified by:
createContainerin interfaceMessageListenerContainerFactory<T>- Parameters:
logicalEndpointNames- the names.- Returns:
- the container instance.
-
configureContainer
-
configureAbstractContainer
protected void configureAbstractContainer(AbstractMessageListenerContainer<T, O, B> container, Endpoint endpoint) -
createContainerInstance
-