Class UserCodeVerticle

java.lang.Object
io.vertx.core.AbstractVerticle
org.cristalise.kernel.process.UserCodeVerticle
All Implemented Interfaces:
io.vertx.core.Verticle

public class UserCodeVerticle extends io.vertx.core.AbstractVerticle
Provides a very basic automatic execution of Scripts associated with the Jobs (Activities). It listens to the proxyMessage channel for cluster storage updates of Jobs of the UseCode Agent. The processing of ProxyMessages assumes that a single message contains Jobs of the same Item.

Execution is based on the Default StateMachine, and it implements the following sequence:

 1. assessStartConditions()
 2. start()
 3. complete()
 4. in case of error/exception during complete() execute error transition (e.g. Suspend for default StateMachine)
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Defines the value (value:"USERCODE_IGNORE") to to be used in CRISTAL Property to ignore the Jobs of that Transition eg: UserCode.StateMachine.resumeTransition = USERCODE_IGNORE

    Fields inherited from class io.vertx.core.AbstractVerticle

    context, vertx
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor set up the user code
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Override this method to implement application specific evaluation of start condition.
    void
    complete(Job thisJob, Job erroJob)
    Method called to handle the Complete transition.
    protected void
    process(Job thisJob)
     
    void
    runUserCodeLogic(Job job, Job errorJob)
    Override this method to implement application specific (business) logic Default implementation - the agent execute any scripts, query or both defined
    void
    start(io.vertx.core.Promise<Void> startPromise)
     
    void
    start(Job thisJob)
    Method called to handle the Start transition.

    Methods inherited from class io.vertx.core.AbstractVerticle

    config, deploymentID, getVertx, init, processArgs, start, stop, stop

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • USERCODE_IGNORE

      public static final String USERCODE_IGNORE
      Defines the value (value:"USERCODE_IGNORE") to to be used in CRISTAL Property to ignore the Jobs of that Transition eg: UserCode.StateMachine.resumeTransition = USERCODE_IGNORE
      See Also:
  • Constructor Details

  • Method Details

    • start

      public void start(io.vertx.core.Promise<Void> startPromise) throws Exception
      Specified by:
      start in interface io.vertx.core.Verticle
      Overrides:
      start in class io.vertx.core.AbstractVerticle
      Throws:
      Exception
    • process

      protected void process(Job thisJob)
      Parameters:
      thisJob -
      errorJob -
    • start

      public void start(Job thisJob) throws CriseVertxException
      Method called to handle the Start transition. Override this method to implement application specific action for Jobs of Start Transition.
      Parameters:
      thisJob - the actual Job to be executed.
      Throws:
      CriseVertxException
    • complete

      public void complete(Job thisJob, Job erroJob) throws Exception
      Method called to handle the Complete transition. Override this method to implement application specific action for Jobs of Complete Transition.
      Parameters:
      thisJob - the actual Job to be executed.
      erroJob - the error Job to be executed in case of error
      Throws:
      Exception
    • assessStartConditions

      public boolean assessStartConditions(Job job)
      Override this method to implement application specific evaluation of start condition. Default implementation - returns always true, i.e. there were no start conditions.
      Parameters:
      job - the actual Job to be executed.
      Returns:
      true, if the start condition were met
    • runUserCodeLogic

      public void runUserCodeLogic(Job job, Job errorJob) throws CriseVertxException
      Override this method to implement application specific (business) logic Default implementation - the agent execute any scripts, query or both defined
      Parameters:
      job - the actual Job to be executed.
      errorJob - Job to be executed in case of an error
      Throws:
      CriseVertxException