
Benjamin KAHANE
- Updated
This is a beginner's guide to the Job Execution Framework.
We have provided the flex-jefexampleexecutor-service project with a comprehensive number of plugin scenarios.
For more information on how to access https://github.com/dalet-oss/flex-jefexampleexecutor-service, please contact your Dalet representative.
See https://github.com/dalet-oss/flex-jefexampleexecutor-service/
To set up the framework for JEF, you must do the following:
export FLEX_IP= 'ifconfig | grep -Eo 'inet (addr:)?([0-9]_.){3}[0-9]_' | grep -Eo '([0-9]_.){3}[0-9]_' | grep -v '127.0.0.1' | grep -v '192.168.1'>-Add the following entries in your host file, in order to run the Consul and Enterprise services:
<DOCKER IP> mysqlhost dockermachine consul
Most of the plugins found in Dalet Flex require you to populate configuration fields. In most cases, there are mandatory fields that must be filled out in order for the plugin to function correctly. These are found under the Configuration tab when you view a plugin in the Dalet Flex user interface. Defining the Action Configuration
To begin creating the configuration for the plugin, you must create a class that implements the ActionConfiguration interface:
Example 1: You could create a “Send Email” action. This action could contain the following fields: Recipient's Email, Subject, and Message.
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(JsonInclude.Include.ALWAYS)
@ActionPluginConfiguration(description = "Email details needed by the Notification-Email-Action")
public class EmailActionConfiguration implements ActionConfiguration {
@ConfigField(
displayName = "Recipent's Email",
description = "Person to receive email",
required = true)
private String recipientEmail;
@ConfigField(
displayName = "Subject",
description = "Email subject line",
required = true)
private String subject;
@ConfigField(
displayName = "Message",
description = "Email's body",
required = true)
private String body;
}
You can design the configuration of a plugin using the metadata annotations provided as part of JEF (these are effectively Dalet Flex metadata definitions). These annotations provide solutions to define native, primitive, and complex fields.
Example 2: In a transcode plugin you might see a complex called “Destination”. Within the “Destination” complex you would find destination related fields such as: Folder Resource, VFSLocation, Protocol, Hostname, and so on.
Extend the ActionExecutor abstract class and implement execute(..) method.
Example:
@Override
public ActionExecutorResponse execute() { log.info("JEF Example external email action started execution for job");
EmailExternalActionConfiguration emailActionConfiguration = (EmailExternalActionConfiguration) actionConfiguration; ... // Sends email
emailUtils.sendEmail(emailActionConfiguration.getRecipientEmail(), emailActionConfiguration.getSubject(),
emailActionConfiguration.getBody()); log.info("JEF Example external email action done"); return new ActionExecutorResponse();
}
Comments
0 comments
Please sign in to leave a comment.