Class AbstractActivity<E,C extends ActivityContext<E>>

java.lang.Object
com.symphony.bdk.core.activity.AbstractActivity<E,C>
Direct Known Subclasses:
CommandActivity, FormReplyActivity, UserJoinedRoomActivity

@API(status=INTERNAL) public abstract class AbstractActivity<E,C extends ActivityContext<E>> extends Object
Base abstract class for activities provided by the BDK. Provides a generic flow to process an incoming chat event.
  • Constructor Details

    • AbstractActivity

      public AbstractActivity()
  • Method Details

    • matcher

      protected abstract ActivityMatcher<C> matcher() throws EventException
      Any kind of activity must provide an ActivityMatcher in order to detect if it can be applied to a certain user input.
      Returns:
      an ActivityMatcher implementation.
      Throws:
      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.
    • onActivity

      protected abstract void onActivity(C context) throws EventException
      Contain the activity business logic. Executed only if the ActivityMatcher.matches(ActivityContext) returned a true value.
      Parameters:
      context - The activity context object.
      Throws:
      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.
    • bindToRealTimeEventsSource

      protected abstract void bindToRealTimeEventsSource(Consumer<RealTimeEventListener> realTimeEventsSource)
      Bind an Activity to its real-time event.
      Parameters:
      realTimeEventsSource - The real-time events source, issued from the DatafeedLoop.
    • info

      protected abstract ActivityInfo info()
      Build activity info.
    • getInfo

      public ActivityInfo getInfo()
      Retrieve activity details. Can be used for metrics, reporting or help generation.
      Returns:
      activity info
    • isAsynchronous

      protected boolean isAsynchronous()
    • beforeMatcher

      protected void beforeMatcher(C context) throws EventException
      This callback can be used to prepare ActivityContext before actually processing the ActivityMatcher.matches(ActivityContext) method.
      Throws:
      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.
    • processEvent

      protected void processEvent(V4Initiator initiator, E event) throws EventException
      Throws:
      EventException
    • createContextInstance

      protected C createContextInstance(V4Initiator initiator, E event)