Annotation Type Filter


@Target({METHOD,ANNOTATION_TYPE})
@Retention(RUNTIME)
@Documented
public @interface Filter
Indicates that a method is capable of playing the role of a Message Filter.

A method annotated with @Filter may accept a parameter of type Message or of the expected Message payload's type. Any type conversion supported by default or any Converters registered with the "integrationConversionService" bean will be applied to the Message payload if necessary. Header values can also be passed as Message parameters by using the @Header parameter annotation.

The return type of the annotated method must be a boolean (or Boolean).

Since:
2.0
  • Optional Element Summary

    Optional Elements 
    Modifier and Type Optional Element Description
    java.lang.String[] adviceChain
    Specify a "chain" of Advice beans that will "wrap" the message handler.
    java.lang.String autoStartup
    The SmartLifecycle autoStartup option.
    java.lang.String discardChannel
    Specify the channel to which this filter will send messages that do no pass the selector.
    java.lang.String discardWithinAdvice
    When true (default) any discard action (and exception thrown) will occur within the scope of the advice class(es) in the chain.
    java.lang.String inputChannel
    Specify the channel from which this filter will consume messages.
    java.lang.String outputChannel
    Specify the channel to which this filter will send messages that pass the selector.
    java.lang.String phase
    Specify a SmartLifecycle phase option.
    Poller[] poller  
    Reactive reactive  
    java.lang.String sendTimeout
    Specify the maximum amount of time in milliseconds to wait when sending a reply Message to the outputChannel().
    java.lang.String throwExceptionOnRejection
    Throw an exception if the filter rejects the message.
  • Element Details

    • inputChannel

      java.lang.String inputChannel
      Specify the channel from which this filter will consume messages. If the channel does not exist, a DirectChannel with this name will be registered in the application context.
      Returns:
      The channel name.
      Default:
      ""
    • outputChannel

      java.lang.String outputChannel
      Specify the channel to which this filter will send messages that pass the selector.
      Returns:
      The channel name.
      Default:
      ""
    • discardChannel

      java.lang.String discardChannel
      Specify the channel to which this filter will send messages that do no pass the selector.
      Returns:
      The channel name.
      Default:
      ""
    • throwExceptionOnRejection

      java.lang.String throwExceptionOnRejection
      Throw an exception if the filter rejects the message. Defaults to false. Can be specified as 'property placeholder', e.g. ${spring.integration.throwExceptionOnRejection}.
      Returns:
      the throw Exception on rejection flag.
      Default:
      ""
    • adviceChain

      java.lang.String[] adviceChain
      Specify a "chain" of Advice beans that will "wrap" the message handler. Only the handler is advised, not the downstream flow.
      Returns:
      the advice chain.
      Default:
      {}
    • discardWithinAdvice

      java.lang.String discardWithinAdvice
      When true (default) any discard action (and exception thrown) will occur within the scope of the advice class(es) in the chain. Otherwise, these actions will occur after the advice chain returns. Can be specified as 'property placeholder', e.g. ${spring.integration.discardWithinAdvice}.
      Returns:
      the discard within advice flag.
      Default:
      ""
    • sendTimeout

      java.lang.String sendTimeout
      Specify the maximum amount of time in milliseconds to wait when sending a reply Message to the outputChannel(). Defaults to -1 - blocking indefinitely. It is applied only if the output channel has some 'sending' limitations, e.g. QueueChannel with fixed a 'capacity'. In this case a MessageDeliveryException is thrown. The 'sendTimeout' is ignored in case of AbstractSubscribableChannel implementations. Can be specified as 'property placeholder', e.g. ${spring.integration.sendTimeout}.
      Returns:
      The timeout for sending results to the reply target (in milliseconds)
      Default:
      ""
    • autoStartup

      java.lang.String autoStartup
      The SmartLifecycle autoStartup option. Can be specified as 'property placeholder', e.g. ${foo.autoStartup}. Defaults to true.
      Returns:
      the auto startup boolean flag.
      Default:
      ""
    • phase

      java.lang.String phase
      Specify a SmartLifecycle phase option. Defaults Integer.MAX_VALUE / 2 for PollingConsumer and Integer.MIN_VALUE for EventDrivenConsumer. Can be specified as 'property placeholder', e.g. ${foo.phase}.
      Returns:
      the SmartLifecycle phase.
      Default:
      ""
    • poller

      Poller[] poller
      Returns:
      the Poller options for a polled endpoint (PollerMetadata). This attribute is an array just to allow an empty default (no poller). Mutually exclusive with reactive().
      Default:
      {}
    • reactive

      Reactive reactive
      Returns:
      the Reactive marker for a consumer endpoint. Mutually exclusive with poller().
      Since:
      5.5
      Default:
      @org.springframework.integration.annotation.Reactive("\n\t\t\n\t\t\n\ue000\ue001\ue002\n\t\t\t\t\n")