Annotation Interface ServiceActivator


Indicates that a method is capable of handling a message or message payload.

A method annotated with @ServiceActivator may accept a parameter of type Message or of the expected Message payload's type. Any type conversion supported by SimpleTypeConverter will be applied to the Message payload if necessary. Header values can also be passed as Message parameters by using the @Header parameter annotation.

Return values from the annotated method may be of any type. If the return value is not a Message, a reply Message will be created with that object as its payload.

Author:
Mark Fisher, Gary Russell, Artem Bilan, Yilin Wei, Chris Bono
  • Element Details

    • inputChannel

      String inputChannel
      Specify the channel from which this service activator 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

      String outputChannel
      Specify the channel to which this service activator will send any replies.
      Returns:
      The channel name.
      Default:
      ""
    • requiresReply

      String requiresReply
      Specify whether the service method must return a non-null value. This value is false by default, but if set to true, a ReplyRequiredException will is thrown when the underlying service method (or expression) returns a null value. Can be specified as 'property placeholder', e.g. ${spring.integration.requiresReply}.
      Returns:
      the requires reply flag.
      Default:
      ""
    • adviceChain

      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:
      {}
    • sendTimeout

      String sendTimeout
      Specify the maximum amount of time in milliseconds to wait when sending a reply Message to the outputChannel. Defaults to 30 seconds. 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

      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

      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:
      ""
    • async

      String async
      Specify whether the service method is async. This value is false by default.
      Returns:
      the async flag.
      Default:
      ""
    • poller

      Poller poller
      Returns:
      the Poller options for a polled endpoint (PollerMetadata). Mutually exclusive with reactive().
      Default:
      @org.springframework.integration.annotation.Poller("\n\t\t\n\t\t\n\ue000\ue001\ue002\n\t\t\t\t\n")
    • 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")