Annotation Interface Publisher


@Target({METHOD,TYPE}) @Retention(RUNTIME) public @interface Publisher
Annotation to indicate that a method, or all public methods if applied at class-level, should publish Messages.

By default, the Message will be constructed from the return value of the method invocation and sent to a channel specified by the channel() attribute. However, a combination of both @Payload and @Header annotations can be used to further manage the message structure. See the reference manual for examples.

Note: unlike @Gateway, this annotation is used to generate an AOP Advice for an existing service and its method implementation. The message sending is a side effect of the real method invocation and is invoked after the method returns. The advised method(s) are not aware of the messaging interaction.

The XML equivalent is <int:publishing-interceptor>

Since:
2.0
Author:
Mark Fisher, Jeff Maxwell
See Also:
  • Element Details

    • value

      @AliasFor("channel") String value
      Alias for the channel() attribute.
      Returns:
      The name of the Message Channel to which Messages will be published.
      Since:
      5.0.4
      Default:
      ""
    • channel

      @AliasFor("value") String channel
      Returns:
      The name of the Message Channel to which Messages will be published.
      Default:
      ""