Annotation Type Channel


@Qualifier @Retention(RUNTIME) @Target({METHOD,CONSTRUCTOR,FIELD,PARAMETER}) @Experimental("smallrye-only, added to the specification") public @interface Channel
This qualifier indicates which channel should be injected / populated.

This qualifier can be used to inject a Channel containing the items and signals propagated by the specified channel. For example, it can be used to @Inject a Publisher representing a channel managed by the Reactive Messaging implementation.

Can be injected:

  • Publisher<X> with X the payload type
  • Publisher<Message<X>> with X the payload type
  • PublisherBuilder<Message<X>> with X the payload type
  • PublisherBuilder<X> with X the payload type

When this qualifier is used on an Emitter, it indicates which channel received the emitted values / signals:

 
 @Inject @Channel("my-channel") Emitter<String> emitter;

 // ...
 emitter.send("a");
 
 
A subscriber for the above channel must be found by the time a message is emitted to the channel. Otherwise, IllegalStateException must be thrown.
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    The name of the channel (indicated in the @Outgoing annotation.
  • Element Details

    • value

      String value
      The name of the channel (indicated in the @Outgoing annotation.
      Returns:
      the channel name, mandatory, non-null and non-blank. It must matches one of the available channels.