BBJSP Pipeline Engine (Deprecated)

The BBJSP system is deprecated. For new development, use BBxServlet.

Description

In BBj 16.0 and higher, BBJSP framework provides a work-flow processor that executes one or more components or BBjspPipelineStage objects.

These objects are executed in sequence to perform some complex business task and each component can cause a branching to other components in the pipeline.

Pipelines control the business processes that are executed server-side when the user interacts with the site. Each element in the pipeline is executed sequentially and depending on the result of the execution, the control mechanism will branch to the appropriate next-stage in the pipeline. A Pipeline can be executed from a BBjspCommand or BBJSP Page. A Pipeline does not have access to the BBjspWebSession data but does have access to the BBjspSessionData object.

Each stage of the pipeline is executed before the pipeline moves to the next stage. A stage can branch within the pipeline, that is to say it can move to a specific stage.

What is a Pipeline?

A pipeline is a set of BBj programs, called stages, that are defined in the XML configuration file. Pipelines work with the BBjspSessionData which is accessible in your web application. Each stage retrieves the session data, performs some business logic to modify/validate the data and exits. After each stage, the pipeline engine moves to the next stage in the pipeline unless a branch condition is detected in which case the pipeline will jump to that stage.

Code

Pipeline components or stages are BBJ programs which will be executed by the BBJSP framework when required. They only need to declare

METHOD PUBLIC BBjString execute (BBjspSessionData)

and return an outcome which the framework will use to decide how to proceed

Pipeline stages should

  • interact with the BBjspSession

  • return a BBjString containing a meaningful result

Let the BBJSP framework do the rest

Configure

Pipeline configuration is through an XML file that defined each of the stage components and identified the possible outcomes which will dictate what acrtion needs to follow

You might want to use a pipeline in a web-store and the payment process may need to have a set of stages similar to this:

  • RESERVE - reserves the stock

  • AUTHORIZE - authorize the credit-card payment

  • FAIL - release the stock

  • SUCCESS - allocate stock for shipping

There may be many more stages in that process but by breaking the process into small chunks you can easily build a reusable code-base.

Execute

The BBJSP framework will handle all the decision making for you, each of the stages is executed and following the rules defined in the configuration file the execution flows through the appropriate staged.

What about BBjspSession?

Rather like a BBjspWebSession, the BBjspSessionData is used to store data related to the current user. Unlike the BBjspWebSession however, the BBjspSessionData persists across multiple visits to your site so if a user goes away from their browser and returns 31 minutes later, any data stored in the BBjspWebSession will be reset but data in the BBjspSessionData session will remain.

See Also

BBJSP

BBjspSessionData

BBjspPipelineStage