Annotation Type EnableEventSource
@Target(TYPE) @Retention(RUNTIME) @Documented @Import(EventSourceBeanRegistrar.class) @Repeatable(EnableEventSources.class) @EnableEventSourcing public @interface EnableEventSource
event sources.
A Spring bean with type EventSource is registered at the ApplicationContext. The name of the
beans can be specified by name().
EventSources are created using a EventSourceBuilder that must be registered in the
ApplicationContext. The default builder is configured in
SynapseAutoConfiguration and will create instances of
DefaultEventSource.
Because the EventSourceBuilder is annotated as ConditionalOnMissingBean, it can be
replaced by other implementations by just registering a different bean.
The EventSource.getChannelName() is configured using channelName().
-
Required Element Summary
Required Elements Modifier and Type Required Element Description java.lang.StringchannelNameThe name of the message channel. -
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description java.lang.StringmessageLogReceiverEndpointThe name of theMessageLogReceiverEndpointbean that is used to create theEventSourcebean.java.lang.StringnameThe name of the registered EventSource bean.java.lang.Class<? extends MessageLog>selectorSelector used to select one of possibly multiple availableMessageLogReceiverEndpointFactoryinstances used to create theMessageLogReceiverEndpointof the EventSource.
-
Element Details
-
channelName
java.lang.String channelNameThe name of the message channel.Resolving placeholders like "${my.channel.name}" is supported for this property.
- Returns:
- channel name
-
-
-
name
java.lang.String nameThe name of the registered EventSource bean.If
#nameis not set, the name of the bean is derived from the name of the message channel. The name is constructed by tranforming hyphenated variable naming convention, e.g., "my-channel" into the Spring bean naming convention, e.g., "myChannel". After this conversion, the string "EventSource" is appended. A channel named "my-channel" will therefore result in a bean name "myChannelEventSource".- Returns:
- bean name
- Default:
- ""
-
messageLogReceiverEndpoint
java.lang.String messageLogReceiverEndpointThe name of theMessageLogReceiverEndpointbean that is used to create theEventSourcebean.If
messageLogReceiverEndpointis not set, the name of the bean is derived from the name of the message channel. The name is constructed by tranforming hyphenated variable naming convention, e.g., "my-channel" into the Spring bean naming convention, e.g., "myChannel". After this conversion, the string "MessageLogReceiverEndpoint" is appended. A channel named "my-channel" will therefore result in a bean name "myChannelMessageLogReceiverEndpoint".The
EventSourceBeanRegistraris responsible for creating theEventSourcesspecified by this annotation. The bean name, either specified or derived from thechannelName, will be used by theEventSourceBeanRegistraras the name of the registered message log bean. If a bean having this name already exists, aBeanCreationExceptionwill be thrown during startup.- Returns:
- bean name of the
MessageLogReceiverEndpoint
- Default:
- ""
-
selector
java.lang.Class<? extends MessageLog> selectorSelector used to select one of possibly multiple availableMessageLogReceiverEndpointFactoryinstances used to create theMessageLogReceiverEndpointof the EventSource.Example: the KafkaMessageLogReceiverEndpointFactory matches both
MessageLog.classand Kafka.class. The following usage of the annotation is selecting the KafkaMessageLogReceiverEndpointFactory using the more specific Kafka selector:@Configuration @EnableEventSource( channelName = "some-log", selector = Kafka.class) class MyExampleConfiguration { }- Returns:
- MessageLog selector class
- Default:
- de.otto.synapse.channel.selector.MessageLog.class
-