Using the branch handler in your component is quite easy.
1. Declare a member variable for the BranchHandler:
Code Block |
---|
|
BranchHandler branchHandler = null; |
2. Initialize the branch handler in your initialize() method based on your component's configuration:
Code Block |
---|
|
branchHandler = BranchHandlerFactory.newInstance(config, this); |
3. If you have some branch events which are required, check that they exist and throw an exception if they don't. This is also typically in your initialize() method:
Code Block |
---|
|
if(!branchHandler.canEnqueueOrProcess("onPublish")) {
throw new AspireException(this, "aspire.framework.FeedOne.missing-branch-with-pipelinemanager",
"The FeedOne component needs to be configured with a branches/branch that specifies a pipeline manager. Either the branches or branch tags are missing, or a pipeline manager is not specified with the @pipelineManager attribute.");
} |
4. For new jobs or sub-jobs only(!), you can use the [enqueue()] method to queue the job on a pipeline manager queue:
Code Block |
---|
|
branchHandler.enqueue(j, "onPublish"); |
...