Annotation Type RabbitListener

      • containerFactory

        String containerFactory
        The bean name of the RabbitListenerContainerFactory to use to create the message listener container responsible to serve this endpoint.

        If not specified, the default container factory is used, if any. If a SpEL expression is provided (#{...}), the expression can either evaluate to a container factory instance or a bean name.

        Returns:
        the RabbitListenerContainerFactory bean name.
        Default:
        ""
      • queues

        String[] queues
        The queues for this listener. The entries can be 'queue name', 'property-placeholder keys' or 'expressions'. Expression must be resolved to the queue name or Queue object. The queue(s) must exist, or be otherwise defined elsewhere as a bean(s) with a RabbitAdmin in the application context. Mutually exclusive with bindings() and queuesToDeclare().
        Returns:
        the queue names or expressions (SpEL) to listen to from target
        See Also:
        MessageListenerContainer
        Default:
        {}
      • queuesToDeclare

        Queue[] queuesToDeclare
        The queues for this listener. If there is a RabbitAdmin in the application context, the queue will be declared on the broker with default binding (default exchange with the queue name as the routing key). Mutually exclusive with bindings() and queues(). NOTE: Broker-named queues cannot be declared this way, they must be defined as beans (with an empty string for the name).
        Returns:
        the queue(s) to declare.
        Since:
        2.0
        See Also:
        MessageListenerContainer
        Default:
        {}
      • exclusive

        boolean exclusive
        When true, a single consumer in the container will have exclusive use of the queues(), preventing other consumers from receiving messages from the queues. When true, requires a concurrency of 1. Default false.
        Returns:
        the exclusive boolean flag.
        Default:
        false
      • priority

        String priority
        The priority of this endpoint. Requires RabbitMQ 3.2 or higher. Does not change the container priority by default. Larger numbers indicate higher priority, and both positive and negative numbers can be used.
        Returns:
        the priority for the endpoint.
        Default:
        ""
      • admin

        String admin
        Reference to a AmqpAdmin. Required if the listener is using auto-delete queues and those queues are configured for conditional declaration. This is the admin that will (re)declare those queues when the container is (re)started. See the reference documentation for more information. If a SpEL expression is provided (#{...}) the expression can evaluate to an AmqpAdmin instance or bean name.
        Returns:
        the AmqpAdmin bean name.
        Default:
        ""
      • bindings

        QueueBinding[] bindings
        Array of QueueBindings providing the listener's queue names, together with the exchange and optional binding information. Mutually exclusive with queues() and queuesToDeclare(). NOTE: Broker-named queues cannot be declared this way, they must be defined as beans (with an empty string for the name).
        Returns:
        the bindings.
        Since:
        1.5
        See Also:
        MessageListenerContainer
        Default:
        {}
      • group

        String group
        If provided, the listener container for this listener will be added to a bean with this value as its name, of type Collection<MessageListenerContainer>. This allows, for example, iteration over the collection to start/stop a subset of containers.
        Returns:
        the bean name for the group.
        Since:
        1.5
        Default:
        ""
      • returnExceptions

        String returnExceptions
        Set to "true" to cause exceptions thrown by the listener to be sent to the sender using normal replyTo/@SendTo semantics. When false, the exception is thrown to the listener container and normal retry/DLQ processing is performed.
        Returns:
        true to return exceptions. If the client side uses a RemoteInvocationAwareMessageConverterAdapter the exception will be re-thrown. Otherwise, the sender will receive a RemoteInvocationResult wrapping the exception.
        Since:
        2.0
        Default:
        ""
      • errorHandler

        String errorHandler
        Set an RabbitListenerErrorHandler to invoke if the listener method throws an exception. A simple String representing the bean name. If a Spel expression (#{...}) is provided, the expression must evaluate to a bean name or a RabbitListenerErrorHandler instance.
        Returns:
        the error handler.
        Since:
        2.0
        Default:
        ""
      • concurrency

        String concurrency
        Set the concurrency of the listener container for this listener. Overrides the default set by the listener container factory. Maps to the concurrency setting of the container type.

        For a SimpleMessageListenerContainer if this value is a simple integer, it sets a fixed number of consumers in the concurrentConsumers property. If it is a string with the form "m-n", the concurrentConsumers is set to m and the maxConcurrentConsumers is set to n.

        For a DirectMessageListenerContainer it sets the consumersPerQueue property.

        Returns:
        the concurrency.
        Since:
        2.0
        Default:
        ""
      • autoStartup

        String autoStartup
        Set to true or false, to override the default setting in the container factory.
        Returns:
        true to auto start, false to not auto start.
        Since:
        2.0
        Default:
        ""
      • executor

        String executor
        Set the task executor bean name to use for this listener's container; overrides any executor set on the container factory. If a SpEL expression is provided (#{...}), the expression can either evaluate to a executor instance or a bean name.
        Returns:
        the executor bean name.
        Since:
        2.2
        Default:
        ""
      • ackMode

        String ackMode
        Override the container factory AcknowledgeMode property. Must be one of the valid enumerations. If a SpEL expression is provided, it must evaluate to a String or AcknowledgeMode.
        Returns:
        the acknowledgement mode.
        Since:
        2.2
        Default:
        ""
      • messageConverter

        String messageConverter
        Override the container factory's message converter used for this listener.
        Returns:
        the message converter bean name. If a SpEL expression is provided (#{...}), the expression can either evaluate to a converter instance or a bean name.
        Since:
        2.3
        Default:
        ""
      • replyContentType

        String replyContentType
        Used to set the content type of a reply message. Useful when used in conjunction with message converters that can handle multiple content types, such as the ContentTypeDelegatingMessageConverter. SpEL expressions and property placeholders are supported. Also useful if you wish to control the final content type property when used with certain converters. This does not apply when the return type is Message or Message; set the content type message property or header respectively, in those cases.
        Returns:
        the content type.
        Since:
        2.3
        See Also:
        converterWinsContentType()
        Default:
        ""
      • converterWinsContentType

        String converterWinsContentType
        Set to 'false' to override any content type headers set by the message converter with the value of the 'replyContentType' property. Some converters, such as the SimpleMessageConverter use the payload type and set the content type header appropriately. For example, if you set the 'replyContentType' to "application/json" and use the simple message converter when returning a String containing JSON, the converter will overwrite the content type to 'text/plain'. Set this to false, to prevent that action. This does not apply when the return type is Message because there is no conversion involved. When returning a Message, set the content type message header and AmqpHeaders.CONTENT_TYPE_CONVERTER_WINS to false.
        Returns:
        false to use the replyContentType.
        Since:
        2.3
        See Also:
        replyContentType()
        Default:
        "true"