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 - the Message's payload type to be consumed by the AbstractMessageListenerContainer.
C - the type of AbstractMessageListenerContainer instances 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 Details

    • AbstractMessageListenerContainerFactory

      protected AbstractMessageListenerContainerFactory(O containerOptions)
  • Method Details

    • setErrorHandler

      public void setErrorHandler(ErrorHandler<T> errorHandler)
      Set the ErrorHandler instance to be used by containers created with this factory. The component will be adapted to an AsyncErrorHandler.
      Parameters:
      errorHandler - the error handler instance.
      See Also:
    • setErrorHandler

      public void setErrorHandler(AsyncErrorHandler<T> errorHandler)
      Set the AsyncErrorHandler instance to be used by containers created with this factory.
      Parameters:
      errorHandler - the error handler instance.
    • addMessageInterceptor

      public void addMessageInterceptor(MessageInterceptor<T> messageInterceptor)
      Add a MessageInterceptor to be used by containers created with this factory. Interceptors will be applied just before method invocation. The component will be adapted to an AsyncMessageInterceptor.
      Parameters:
      messageInterceptor - the message interceptor instance.
      See Also:
    • addMessageInterceptor

      public void addMessageInterceptor(AsyncMessageInterceptor<T> messageInterceptor)
      Add a AsyncMessageInterceptor to be used by containers created with this factory. Interceptors will be applied just before method invocation.
      Parameters:
      messageInterceptor - the message interceptor instance.
    • setMessageListener

      public void setMessageListener(MessageListener<T> messageListener)
      Set the MessageListener instance 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 an AsyncMessageListener.
      Parameters:
      messageListener - the message listener instance.
      See Also:
    • setAsyncMessageListener

      public void setAsyncMessageListener(AsyncMessageListener<T> messageListener)
      Set the AsyncMessageListener instance 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 the AsyncAcknowledgementResultCallback instance to be used by containers created by this factory.
      Parameters:
      acknowledgementResultCallback - the instance.
    • setAcknowledgementResultCallback

      public void setAcknowledgementResultCallback(AcknowledgementResultCallback<T> acknowledgementResultCallback)
      Set the AcknowledgementResultCallback instance to be used by containers created by this factory.
      Parameters:
      acknowledgementResultCallback - the instance.
    • setContainerComponentFactories

      public void setContainerComponentFactories(Collection<ContainerComponentFactory<T,O>> containerComponentFactories)
      Set the ContainerComponentFactory instances that will be used to create components for listener containers created by this factory.
      Parameters:
      containerComponentFactories - the factory instances.
    • configure

      public void configure(Consumer<B> options)
      Allows configuring this factories' ContainerOptionsBuilder.
    • createContainer

      public C createContainer(Endpoint endpoint)
      Description copied from interface: MessageListenerContainerFactory
      Create a container instance for the given Endpoint.
      Specified by:
      createContainer in interface MessageListenerContainerFactory<T>
      Parameters:
      endpoint - the endpoint.
      Returns:
      the container instance.
    • configureContainerOptions

      protected void configureContainerOptions(Endpoint endpoint, B containerOptions)
    • createContainer

      public C createContainer(String... logicalEndpointNames)
      Description copied from interface: MessageListenerContainerFactory
      Create a container instance for the given endpoint names.
      Specified by:
      createContainer in interface MessageListenerContainerFactory<T>
      Parameters:
      logicalEndpointNames - the names.
      Returns:
      the container instance.
    • configureContainer

      protected void configureContainer(C container, Endpoint endpoint)
    • configureAbstractContainer

      protected void configureAbstractContainer(AbstractMessageListenerContainer<T,O,B> container, Endpoint endpoint)
    • createContainerInstance

      protected abstract C createContainerInstance(Endpoint endpoint, O containerOptions)