Class HttpNotificationWorkflowOperationHandler
java.lang.Object
org.opencastproject.workflow.api.AbstractWorkflowOperationHandler
org.opencastproject.workflow.handler.notification.HttpNotificationWorkflowOperationHandler
- All Implemented Interfaces:
WorkflowOperationHandler
Workflow operation handler that will send HTTP POST or PUT requests to a specified address.
The request can contain a message type and a message body and automatically includes the workflow instance id. Should the notification fail, a retry strategy is implemented.
Requests will be send using the POST method by default, PUT is a supported alternative method.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.opencastproject.workflow.api.AbstractWorkflowOperationHandler
AbstractWorkflowOperationHandler.Configuration -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringName of the message HTTP parameterstatic final StringName of the subject HTTP parameterstatic final StringName of the workflow instance id HTTP parameterstatic final intDefault time between two request attemptsstatic final StringConfiguration key for the maximal attempts for the notification requeststatic final StringConfiguration key for the HTTP method to use (put or post)static final StringConfiguration key for the notification messagestatic final StringConfiguration key for the notification eventstatic final StringConfiguration key for the request timeoutstatic final StringConfiguration key for the target URL of the notification requeststatic final intThe scale factor to the sleep time between two notification attemptsFields inherited from class org.opencastproject.workflow.api.AbstractWorkflowOperationHandler
asList, description, id, serviceRegistry, SOURCE_FLAVOR, SOURCE_FLAVORS, SOURCE_TAG, SOURCE_TAGS, TARGET_FLAVOR, TARGET_FLAVORS, TARGET_TAG, TARGET_TAGS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidsetServiceRegistry(ServiceRegistry serviceRegistry) Sets the service registry.start(WorkflowInstance workflowInstance, JobContext context) Runs the workflow operation on thisWorkflowInstance.Methods inherited from class org.opencastproject.workflow.api.AbstractWorkflowOperationHandler
activate, asList, cfgKeyMissing, createResult, createResult, createResult, createResult, destroy, equals, getCfg, getConfig, getConfig, getConfig, getDescription, getFileNameFromElements, getId, getOptConfig, getOptConfig, getTagsAndFlavors, hashCode, setJobBarrierPollingInterval, skip, toString, waitForStatus, waitForStatus
-
Field Details
-
OPT_URL_PATH
Configuration key for the target URL of the notification request- See Also:
-
OPT_NOTIFICATION_SUBJECT
Configuration key for the notification event- See Also:
-
OPT_NOTIFICATION_MESSAGE
Configuration key for the notification message- See Also:
-
OPT_METHOD
Configuration key for the HTTP method to use (put or post)- See Also:
-
OPT_MAX_RETRY
Configuration key for the maximal attempts for the notification request- See Also:
-
OPT_TIMEOUT
Configuration key for the request timeout- See Also:
-
HTTP_PARAM_SUBJECT
Name of the subject HTTP parameter- See Also:
-
HTTP_PARAM_MESSAGE
Name of the message HTTP parameter- See Also:
-
HTTP_PARAM_WORKFLOW
Name of the workflow instance id HTTP parameter- See Also:
-
INITIAL_SLEEP_TIME
public static final int INITIAL_SLEEP_TIMEDefault time between two request attempts- See Also:
-
SLEEP_SCALE_FACTOR
public static final int SLEEP_SCALE_FACTORThe scale factor to the sleep time between two notification attempts- See Also:
-
-
Constructor Details
-
HttpNotificationWorkflowOperationHandler
public HttpNotificationWorkflowOperationHandler()
-
-
Method Details
-
start
public WorkflowOperationResult start(WorkflowInstance workflowInstance, JobContext context) throws WorkflowOperationException Runs the workflow operation on thisWorkflowInstance. If the execution fails for some reason, this must throw aWorkflowOperationExceptionin order to handle the problem gracefully. Runtime exceptions will cause the entire workflow instance to fail.- Specified by:
startin interfaceWorkflowOperationHandler- Specified by:
startin classAbstractWorkflowOperationHandler- Parameters:
workflowInstance- the workflow instancecontext- the job context- Returns:
- the
WorkflowOperationResultcontaining a potentially modified MediaPackage and whether to put the workflow instance into a wait state. - Throws:
WorkflowOperationException- If the workflow operation fails to execute properly, and the default error handling should be invoked.- See Also:
-
setServiceRegistry
Description copied from class:AbstractWorkflowOperationHandlerSets the service registry. This method is here as a convenience for developers that need the registry to do job waiting.- Overrides:
setServiceRegistryin classAbstractWorkflowOperationHandler- Parameters:
serviceRegistry- the service registry
-