-
Notifications
You must be signed in to change notification settings - Fork 2
Connector API DSL
This is the top-level definition of a new service. It takes a string ID and a block. The string ID is the ID you will use to address this service. The ID is used by the connector service to generate a URL like /v0.4/:myservice. When defining the connector.yml file in your workflow directory, it will use this URL to reference the specific service.
action
and listener
are the two highest level capabilities within a service definition. An action is a method you call to take an action. It is short lived and ephemeral, like sending a message to Hipchat.
An action callback is what you run when the action is done processing. It takes one variable, a hash or an array. That information becomes available in the workflow for the proceeding steps.
The listener
is one of two of the high level capabilities within a service. It is designed to be long-living and waiting for events. For example, listening for a particulare message in a chat room, or a listener for a Github push event, or a timer which triggers every 5 mintues. Each of these live for a long time, but then trigger on a particular event.
A start_workflow
event only appears within the listener
block. You can call it multiple times. A better name for it might be "trigger", as it triggers the execution of a workflow.
The 'start' block within a listener is used to perform any work and start the listening event. For example, it may call into Github and register a post-receive web hook.
The params are all the parameters that the user passed into the call, plus the credentials from the credentials.yml file for this particular service.
start do |params|
# setup the listener
end
The stop block is responsible for tearing down anything that was created by the start block. For example, if you registered a web hook with start
, use this to unregister. The "params" passed in will be the same values you received in the "start" block.
stop do |params| # tear down the artifacts created by start end
You can use info, warn, and error, to send a log message. This will appear in the output of the workflow as it is executing.
info "All is good"
warn "There is a problem, but the workflow is still running fine"
error "Somethings busted"
Using fail