Extension points and when they fire
An extension point is a named moment at which Hop calls every plugin listening for it. How to write such a plugin is on the Execution and observability page. This page is about the moments themselves: when each one fires, in which order, on which engine, and what it hands over.
The names are the constants of two enums:
-
HopExtensionPointinorg.apache.hop.core.extension(core): runs, files, metadata, the command line tools and most of Hop GUI. -
HopGuiExtensionPointinorg.apache.hop.ui.hopgui(ui): file dialogs, the explorer and a few Hop GUI updates.
A listener names the moment in extensionPointId; the generic type of IExtensionPoint<T> is the object Hop hands over.
Extension points run on the thread that fires them, one listener after the other, so a slow listener slows down the run.
A pipeline run on the local engine
The local engine (Pipeline, LocalPipelineEngine) fires the full set, in this order:
| Extension point | Object | When |
|---|---|---|
|
|
|
|
|
For every transform copy, right before its |
|
|
For every transform copy, once its init thread is done. All copies initialize at the same time, so the order between copies is not fixed. |
|
|
A transform copy failed to initialize. The pipeline does not start. |
|
|
|
|
|
For every transform copy, right before its thread starts. |
|
|
All transform threads were started. Rows may already be flowing. |
|
|
A transform copy finished. Fired from the copy’s finished listener, ahead of the pipeline’s own detection of the end of the run. |
|
|
A transform copy failed while processing rows: it threw an exception, or it finished with errors. |
|
|
The last transform copy finished. This is the first execution finished listener: the others run after it. |
|
|
The run failed: after all execution finished listeners, before |
|
|
Everything is done: the result, the status and the failures are final. |
PipelineMetaLoaded fires earlier, whenever a PipelineMeta is read from a file, also when nothing runs it.
The single-threaded pipeline type runs the transforms one at a time in an executor, without threads of their own.
It fires the same extension points; TransformBeforeStart comes for every copy before PipelineStart, and TransformFinished when the executor disposes the copies at the end of the run.
Which engine fires what
| Extension point | Local | Remote (Hop Server) | Beam | Native Spark |
|---|---|---|---|---|
|
yes |
no |
yes |
yes |
|
yes |
no |
yes |
yes |
|
yes |
yes |
yes |
yes |
|
yes |
yes |
yes |
yes |
|
yes |
yes |
yes |
yes |
|
yes |
no |
no |
no |
|
yes |
no |
no |
no |
The remote engine sends the pipeline to a Hop Server. The server runs it on its own local engine, which fires the full set in the server’s JVM; the client only sees the start and the end.
The Beam and native Spark engines fire the pipeline-level points at the same moments as the local engine, once per run, but no transform-level points: a transform there is a step in a Beam or Spark job, not a copy with a thread.
|
Beam and native Spark run a Hop transform without a native implementation inside a small local pipeline: on Beam one per transform and worker, on native Spark one per transform and partition.
These are local engines of the single-threaded type, and they fire the local engine’s extension points, pipeline and transform level, for every bundle or partition they run.
A listener that only wants the run itself sees these too.
They have no dedicated marker yet: their pipeline is named after the transform, their run configuration is named |
A workflow run on the local engine
The local workflow engine (Workflow, LocalWorkflowEngine) fires:
| Extension point | Object | When |
|---|---|---|
|
|
The workflow has checked its actions against the engine (engine compatibility), after the execution started listeners, before the first action. |
|
|
Right after |
|
|
Before every action. A listener can stop the action from running: set |
|
|
The action threw an exception, raised its error count, or ran a child pipeline or workflow that failed. |
|
|
After every action, with its result. |
|
|
The workflow ended with a false result, unless someone stopped it and nothing went wrong. |
|
|
The workflow ended, successfully or not. The execution finished listeners run after it. |
WorkflowMetaLoaded fires whenever a WorkflowMeta is read from a file.
The remote workflow engine fires none of these on the client: the Hop Server runs the workflow on its local engine, which fires them there.
|
A child workflow that a Workflow action runs fires |
Before and around a run
| Extension point | When |
|---|---|
|
|
|
|
|
|
|
Hop GUI starts to run a pipeline ( |
|
Right before Hop GUI shows the run configuration of a pipeline. |
|
Right before Hop GUI starts the pipeline engine. |
|
The same for a workflow. |
|
A dialog that picks a run configuration (run options, Pipeline and Workflow actions, Pipeline and Workflow executor, Metadata injection) fills its list: the extension point gets the list, so a plugin can add to it. |
|
A pipeline that Hop GUI ran has finished. |
Checks, database connections and metadata
| Extension point | When |
|---|---|
|
Before and after the transforms of a pipeline are verified. |
|
Before and after each transform is verified. |
|
After the actions of a workflow were verified. |
|
The output fields of a transform are worked out and its |
|
A |
|
|
|
A project and its lifecycle environment were enabled. |
|
The home folder of a project is being worked out. |
Hop Server
| Extension point | When |
|---|---|
|
The server worked out its configuration file, before it uses it. |
|
Right before the server starts. |
|
The server has started and is fully up. |
|
Right before the server shuts down. |
|
The server has shut down. |
The import tool
HopImportStart and HopImportEnd fire at the start and the end of hop-import.
In between, HopImportTargetMetadataReady fires once the metadata of the target exists, HopImportRewriteMetadata once the imported files and connections are written, and HopImportCreateProject to register a project for the target folder.
Hop GUI
These fire in Hop GUI (and Hop Web), not during a run.
| Extension point | When |
|---|---|
|
Before the main window is created. |
|
Hop GUI has started. |
|
A project was enabled in Hop GUI. |
|
A pipeline or workflow file was opened. |
|
A pipeline file is about to be saved, was saved, or was saved under a new name. |
|
A workflow file is about to be saved, or was saved. |
|
A transform was renamed. |
|
Transforms are about to be deleted from a pipeline. |
|
The pipeline canvas is drawn: before everything, on each transform icon, on each hop, and on top of everything. |
|
The same for the workflow canvas. |
|
Mouse events on the pipeline canvas. |
|
Mouse events on the workflow canvas. |
|
The mouse hovers over a drawn area of a canvas: a plugin can add a tooltip. |
|
The explorer works out the tab name of a pipeline or workflow. |
|
A metadata object is about to be created (before its dialog), was created, updated or deleted. |
|
Search collects the places it searches. |
|
The variable list ( |
|
The lifecycle environment dialog collects its tabs. |
|
Open the marketplace searching for a plugin, from a dialog about a missing transform or action. |
|
Open a session of the AI advisor. |
|
Files are about to be committed to git. |
|
The problems tab refreshes, after the database cache was cleared. |
And the ones in HopGuiExtensionPoint:
| Extension point | When |
|---|---|
|
Before a file open dialog is shown, and after a file was picked in it. |
|
Before a folder dialog is shown, and after a folder was picked in it. |
|
The explorer works out its root folder. |
|
A file name is pasted onto a workflow. |
|
A canvas or execution viewer updates: a plugin can enable or disable widgets. |
|
The system variables were saved from the configuration perspective. |
Declared but not fired
These constants exist, and some have listeners, but nothing in Hop fires them at the moment. A plugin that listens to one of them is never called:
HopGuiEnd, OpenRecent, PipelineHeartbeat, PipelineBeforeClose, PipelineAfterClose, PipelineChanged, PipelineTransformRightClick, RunConfigurationSelection, RunConfigurationIsRemote, WorkflowBeforeOpen, WorkflowBeforeClose, WorkflowAfterClose, WorkflowChanged, WorkflowDialogShowRetrieveLogTableFields, HopGuiPipelineAfterClose, HopGuiWorkflowAfterClose, and in HopGuiExtensionPoint HopGuiFileSaveDialog and HopGuiNewPipelineTab.
Firing your own
Anything can fire an extension point, by name:
ExtensionPointHandler.callExtensionPoint(
log, variables, HopExtensionPoint.PipelineStart.id, pipeline);
A plugin may define a name of its own and fire it; listeners find it by that name.
When an engine fires the run’s extension points, it should fire them at the moments in the tables above, each once per run, with the same object type: listeners rely on that order, and on PipelineCompleted being the last call before waitUntilFinished() returns.