Class RuntimeStage<M>

java.lang.Object
com.lucidworks.apollo.pipeline.RuntimeStage<M>
Type Parameters:
M -
All Implemented Interfaces:
Configurable<com.lucidworks.apollo.pipeline.StageConfig>, Lifecycle, Processor<M>, Stage<M,com.lucidworks.apollo.pipeline.StageConfig>, StageOutput<M>

public class RuntimeStage<M> extends Object implements Stage<M,com.lucidworks.apollo.pipeline.StageConfig>, Lifecycle, StageOutput<M>
Decorates a Stage instance with some telemetry and bounds checking
  • Field Details

    • STAGE_SKIPPED_COUNTER

      public static final io.prometheus.client.Counter STAGE_SKIPPED_COUNTER
    • SIGNAL_COUNTER

      public static final io.prometheus.client.Counter SIGNAL_COUNTER
    • STAGE_ERRORS

      public static final io.prometheus.client.Counter STAGE_ERRORS
    • STAGE_DONE

      public static final io.prometheus.client.Counter STAGE_DONE
    • CONDITION_OUTCOME

      public static final io.prometheus.client.Counter CONDITION_OUTCOME
    • STAGE_EXECUTION_INFO

      public static final String STAGE_EXECUTION_INFO
      See Also:
  • Constructor Details

    • RuntimeStage

      public RuntimeStage(String pipelineId, Stage<M,C> delegate, C delegateConfig, Optional<RuntimeStage<M>> next, com.codahale.metrics.MetricRegistry metricRegistry)
  • Method Details

    • getDelegate

      public Stage<M,? extends com.lucidworks.apollo.pipeline.StageConfig> getDelegate()
    • getDelegateConfig

      public com.lucidworks.apollo.pipeline.StageConfig getDelegateConfig()
    • getNext

      public Optional<RuntimeStage<M>> getNext()
    • getStageType

      public String getStageType()
      Specified by:
      getStageType in interface Stage<M,com.lucidworks.apollo.pipeline.StageConfig>
    • process

      public void process(M message, com.lucidworks.apollo.pipeline.Context context, StageOutput<M> unused)
      Determine if the current stage should run, and if so run it

      Also collect some metrics and handle errors

      Specified by:
      process in interface Processor<M>
      Parameters:
      message -
      context -
      unused -
    • send

      public void send(M message, com.lucidworks.apollo.pipeline.Context context)
      Send a message to the next stage in the pipeline, if set
      Specified by:
      send in interface StageOutput<M>
      Parameters:
      message -
      context -
    • handleSignal

      public void handleSignal(String signal, String value, com.lucidworks.apollo.pipeline.Context context)
      Description copied from interface: Processor
      Handle a signal
      Specified by:
      handleSignal in interface Processor<M>
    • getContextFactory

      public com.lucidworks.apollo.pipeline.ContextFactory getContextFactory()
      Specified by:
      getContextFactory in interface Stage<M,com.lucidworks.apollo.pipeline.StageConfig>
    • getId

      public String getId()
      Specified by:
      getId in interface Stage<M,com.lucidworks.apollo.pipeline.StageConfig>
    • getMessageClass

      public Class<M> getMessageClass()
      Specified by:
      getMessageClass in interface Stage<M,com.lucidworks.apollo.pipeline.StageConfig>
    • getMetricRegistry

      public com.codahale.metrics.MetricRegistry getMetricRegistry()
      Specified by:
      getMetricRegistry in interface Stage<M,com.lucidworks.apollo.pipeline.StageConfig>
    • managedModeEnabled

      public boolean managedModeEnabled()
      Specified by:
      managedModeEnabled in interface Stage<M,com.lucidworks.apollo.pipeline.StageConfig>
    • getConfiguration

      public com.lucidworks.apollo.pipeline.StageConfig getConfiguration()
      Specified by:
      getConfiguration in interface Configurable<M>
    • initManagedModeEnabled

      public boolean initManagedModeEnabled()
    • init

      public void init()
      Specified by:
      init in interface Configurable<M>
    • getProperty

      public String getProperty(String key, String defaultValue)
      Specified by:
      getProperty in interface Configurable<M>
    • start

      public void start()
      Specified by:
      start in interface Lifecycle
    • stop

      public void stop()
      Specified by:
      stop in interface Lifecycle
    • getInflightMessageCount

      public int getInflightMessageCount()
    • getRecentErrors

      public Collection<RuntimeStage.ThrowableAndMessage<M>> getRecentErrors()
    • evaluateConditionalScript

      public boolean evaluateConditionalScript(M message, com.lucidworks.apollo.pipeline.Context context)