Package de.otto.synapse.eventsource
Class AbstractEventSource
- java.lang.Object
-
- de.otto.synapse.eventsource.AbstractEventSource
-
- All Implemented Interfaces:
EventSource
- Direct Known Subclasses:
DefaultEventSource
public abstract class AbstractEventSource extends java.lang.Object implements EventSource
-
-
Constructor Summary
Constructors Constructor Description AbstractEventSource(MessageLogReceiverEndpoint messageLog)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetChannelName()Returns the name of the EventSource.MessageDispatchergetMessageDispatcher()Returns the MessageDispatcher used to registerconsumersat the EventSource.MessageLogReceiverEndpointgetMessageLogReceiverEndpoint()Returns the MessageLogReceiverEndpoint used by theEventSourceto consume events.booleanisStopping()voidregister(MessageConsumer<?> messageConsumer)Registers a new EventConsumer at the EventSource.voidstop()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.otto.synapse.eventsource.EventSource
consume, consumeUntil
-
-
-
-
Constructor Detail
-
AbstractEventSource
public AbstractEventSource(MessageLogReceiverEndpoint messageLog)
-
-
Method Detail
-
getChannelName
public java.lang.String getChannelName()
Description copied from interface:EventSourceReturns the name of the EventSource.For streaming event-sources, this is the name of the event stream.
- Specified by:
getChannelNamein interfaceEventSource- Returns:
- name
-
stop
public void stop()
- Specified by:
stopin interfaceEventSource
-
isStopping
public boolean isStopping()
- Specified by:
isStoppingin interfaceEventSource
-
register
public void register(MessageConsumer<?> messageConsumer)
Registers a new EventConsumer at the EventSource.consumershave to be thread safe as it may be called from multiple threads (e.g. for kinesis streams there is one thread per shard)- Specified by:
registerin interfaceEventSource- Parameters:
messageConsumer- the EventConsumer that is registered at the EventSource
-
getMessageDispatcher
@Nonnull public MessageDispatcher getMessageDispatcher()
Returns the MessageDispatcher used to registerconsumersat the EventSource.- Specified by:
getMessageDispatcherin interfaceEventSource- Returns:
- MessageDispatcher
-
getMessageLogReceiverEndpoint
@Nonnull public MessageLogReceiverEndpoint getMessageLogReceiverEndpoint()
Description copied from interface:EventSourceReturns the MessageLogReceiverEndpoint used by theEventSourceto consume events.- Specified by:
getMessageLogReceiverEndpointin interfaceEventSource- Returns:
- MessageLogReceiverEndpoint
-
-