The sendCustomEvent operation synchronizes workflows with external events.

public void sendCustomEvent(String eventName, String serializedProperties);

The sendCustomEvent operation sends messages from Web service clients to workflows that are waiting for a particular event to occur before they run. The waiting workflows resume their run when they receive the message from sendCustomEvent.

A custom event that calls sendCustomEvent to send a message when it occurs can be any script, workflow, or action that Orchestrator can run. For example, a workflow might use sendCustomEvent to trigger another workflow that reloads all Orchestrator plug-ins when the sending workflow performs a specific action while it is running.

The messages that sendCustomEvent sends are simple triggers, the format of which is not exposed to users. The message triggers the waiting workflow to run at the moment that the server receives it.

Important:

Access to the sendCustomEvent operation is not protected by a username and password combination. VMware therefore recommends that you only use this function in secure, internal deployments. For example, do not use this operation in deployments that operate openly across the Internet.

Type

Value

Description

String

eventName

The eventName property is the name of the event that a workflow is waiting for before running. The eventName string you pass to sendCustomEvent must match the name of an Event object declared in the script, action or workflow that defines the custom event.

String

serializedProperties

The serializedProperties property defines the parameters to pass to the waiting workflow as a series of name-value pairs. The syntax of serializedProperties is as follows:

"name1=value1\nname2=value2\nname3=value3"

If the workflow requires no input parameters, the serializedProperties property can be null or omitted.

Return Value

No return value informs applications that the sendCustomEvent operation ran successfully.

The sendCustomEvent operation returns an exception if you pass it an invalid parameter.

Receiving Messages from sendCustomEvent

Workflows waiting for a message from sendCustomEvent before they run must declare the event they are waiting for by calling the System.waitCustomEventUntil operation from the Orchestrator API. The following example shows two calls to waitCustomEventUntil.

System.waitCustomEventUntil("internal", customEventKey, myDate);
System.waitCustomEventUntil("external", customEventKey, myDate);

The waitCustomEventUntil operation's parameters are as follows.

internal / external

The awaited event comes from another workflow (internal) or from a Web service application (external).

customEventKey

The name of the awaited event.

myDate

The date until which waitCustomEventUntil waits for a message from sendCustomEvent.