@API(status=INTERNAL)
public abstract class AbstractActivity<E,C extends ActivityContext<E>>
extends java.lang.Object
Constructor and Description |
---|
AbstractActivity() |
Modifier and Type | Method and Description |
---|---|
protected void |
beforeMatcher(C context)
This callback can be used to prepare
ActivityContext before actually processing the
ActivityMatcher.matches(ActivityContext) method. |
protected abstract void |
bindToRealTimeEventsSource(java.util.function.Consumer<RealTimeEventListener> realTimeEventsSource)
Bind an Activity to its real-time event.
|
protected C |
createContextInstance(V4Initiator initiator,
E event) |
ActivityInfo |
getInfo()
Retrieve activity details.
|
protected abstract ActivityInfo |
info()
Build activity info.
|
protected abstract ActivityMatcher<C> |
matcher()
Any kind of activity must provide an
ActivityMatcher in order to detect if it can be applied to a certain
user input. |
protected abstract void |
onActivity(C context)
Contain the activity business logic.
|
protected void |
processEvent(V4Initiator initiator,
E event) |
protected abstract ActivityMatcher<C> matcher() throws EventException
ActivityMatcher
in order to detect if it can be applied to a certain
user input.ActivityMatcher
implementation.EventException
- Throw this exception if this method should fail the current events processing
and re-queue the events in datafeed. Other exceptions will be caught silently.protected abstract void onActivity(C context) throws EventException
ActivityMatcher.matches(ActivityContext)
returned
a true value.context
- The activity context object.EventException
- Throw this exception if this method should fail the current events processing
and re-queue the events in datafeed. Other exceptions will be caught silently.protected abstract void bindToRealTimeEventsSource(java.util.function.Consumer<RealTimeEventListener> realTimeEventsSource)
realTimeEventsSource
- The real-time events source, issued from the DatafeedLoop
.protected abstract ActivityInfo info()
public ActivityInfo getInfo()
protected void beforeMatcher(C context) throws EventException
ActivityContext
before actually processing the
ActivityMatcher.matches(ActivityContext)
method.EventException
- Throw this exception if this method should fail the current events processing
and re-queue the events in datafeed. Other exceptions will be caught silently.protected void processEvent(V4Initiator initiator, E event) throws EventException
EventException
protected C createContextInstance(V4Initiator initiator, E event)