Package io.hekate.spring.boot.messaging
Annotation Type InjectChannel
-
@Autowired @Qualifier @Documented @Retention(RUNTIME) @Target({METHOD,FIELD,PARAMETER,ANNOTATION_TYPE}) public @interface InjectChannel
Provides support forMessagingChannel
s autowiring.This annotation can be placed on any
autowire
-capable elements (fields, properties, parameters, etc) of application beans in order to injectMessagingChannel
by itsname
.Below is the example of how this annotation can be used.
1) Define a bean that will use
InjectChannel
annotation to injectMessagingChannel
into its field.@Component public class MyBean { @InjectChannel("my-channel") private MessagingChannel<Object> channel; // ... other fields and methods... }
@EnableHekate @SpringBootApplication public class MyApp { @Bean public MessagingChannelConfig<Object> messagingChannelConfig() { return MessagingChannelConfig.unchecked() .withName("my-channel") .withReceiver(msg -> System.out.println("Got message " + msg) ); } // ... other beans and methods... }
- See Also:
HekateMessagingServiceConfigurer
-
-
Required Element Summary
Required Elements Modifier and Type Required Element Description String
value
Specifies thename
of aMessagingChannel
that should be injected (seeMessagingService.channel(String)
).
-
-
-
Element Detail
-
value
String value
Specifies thename
of aMessagingChannel
that should be injected (seeMessagingService.channel(String)
).- Returns:
- Name of a
MessagingChannel
.
-
-