Documentation Home

Key Concepts

Key Interfaces

Creating custom jobs and events requires understanding of a few key interfaces in addition to a general understanding of the Terminology and Data Model.

Interface Description
SystemEventConsumer Responsible for performing an action in response to an event.
SystemEventFactory When the system needs to run a scheduled job, it will use a system event factory to convert the job and job details into a SystemEvent

Note, implementations of SystemEventConsumer and SystemEventFactory are automatically registered with the system through the SystemEventBeanPostProcessor. You just need to ensure that your custom implementations are being scanned as part of your Spring configuration.

Key Components

Component Description
blSystemEventSender Once a system event is constructed, call the void sendEvents(List<SystemEvent> events); method on the SystemEventSender component to start the process.

See the menu sections on creating sample jobs for more information on how to create a custom job or event.

Understanding Nodes

Node Types

By default, Broadleaf has ADMIN and SITE node types. It is is often useful to send an event to both types of nodes in which case, the SystemEvent.workerType can be set to "ALL". To target just SITE or ADMIN nodes, the workerType can be set to SITE or ADMIN.

Node Initialization

On startup, nodes will register themselves in the BLC_NODE_REGISTRATION table. Each node will also check to see if a "Master Node" has been established. If not, the node will attempt to become the master.

Heartbeat

All nodes will periodically (default every 10 seconds) perform a heatbeat routine. In this routine, they communicate that they are still up and processing events as well as check the status of the master node to see if they should take over that responsbilitiy. This allows one of the other nodes to take over the master nodes responsbilities if the master node is shutdown or non-responsive.

Master Node

The master node is responsible for ...

  • Executing jobs when they are scheduled to be run
  • Cleanup routines to groom the jobs, event, and node data

The master node utilizes the Quartz framework to "fire" a notificaiton that a job needs to be run. It is the Master Node's responsibility to keep the in-memory quartz configuration synchronized with changes that are made to the BLC_SCHEDULED_JOB data tables. It does this as part of its heartbeat routine.

When quartz triggers a Job, the master node consumes it and then converts it to an Event which will be executed on the appropriate nodes (possibly including the master node).