An event is a message that notifies other components about a change of state, an action or an occurred fact. Event Publisher publishes an event for other configured pipelines to listen to it and have a chance to react when the publishing happens.

More information about Event-Oriented Architecture can be found here.

Take a look at the configuration parameters of the component:

  • Event: name of the created event to be published for other pipelines consumption. This parameter supports Double Braces.

  • Body: payload to be sent with the event. This parameter supports Double Braces.

  • Log Each Event Sent: when activated, the option will generate an input log for each sent event.

  • Fail On Error: if the option is enabled, the execution of the pipeline with error will be interrupted; otherwise, the pipeline execution proceeds, but the result will show a false value for the “success” property.

Some of the parameters above support Double Braces. To understand how this language works, read our article by clicking here.

How is Event Publisher used?

To implement an Event-Oriented Architecture, it's necessary to define:

  • the pipeline that will publish the event (Publisher)

  • one or more pipelines that will consume the event (Subscribers)

To configure the pipeline that will publish the event:

  • drag Event Publisher to the canvas of the Publisher pipeline;

  • configure the name of the event in the "Event” property of Event Publisher;

  • if you want to provide a payload with the event, define the content of the “Body” property.

To consume the pipeline that will consume the event:

  • change the type of trigger to Event in the Subscriver pipeline;

  • open the trigger configurations and inform the name of the event to be consumed in the "Name of the Event" property. This value must be identical to the one informed in Event Publisher of the Publisher pipeline.

Messages Flow

Input

The component waits for a valid message in JSON format. No specific attribute is expected. The input message can be referred through Double Braces not only for the configuration of "Event" attribute, but also for the “Body” attribute. For example, let's say the message below is passed to Event Publisher:

{
"eventName": "example",
"body": {
"id": "1",
"description": "Description of the case"
}
}

You could define a Double Braces expression in the "Event" attribute to obtain the value of the eventName attribute:

{{ message.eventName }}

The body attribute could be configured the same way:

{{ message.body }}

Output

The component repasses the received message from the previous component without any change. In the example above, the repassed message would be:

{
"eventName": "example",
"body": {
"id": "1",
"description": "Description of the case"
}
}

Did this answer your question?