Event Publisher

Discover more about the Event Publisher component and how to use it on the Digibee Integration Platform.

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.

For more information, read about Event-driven architecture.

Parameters

Take a look at the configuration parameters of the component. Parameters supported by Double Braces expressions are marked with (DB).

ParameterDescriptionDefault valueData type

Event (DB)

Name of the created event to be published for other pipelines consumption.

{{ DEFAULT(message.eventName, "new-event") }}

String

Body (DB)

Payload to be sent with the event.

{{ message.$ }}

JSON

Log Each Event Sent

When activated, the option will generate an input log for each sent event.

False

Boolean

Fail On Error

If the option is activated, the execution of the pipeline with an error will be interrupted; otherwise, the pipeline execution proceeds, but the result will show a false value for the “success” property.

False

Boolean

How is Event Publisher used?

To implement an event-driven 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 parameter of Event Publisher;

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

To consume the pipeline that will consume the event:

  • change the type of trigger to Event Trigger in the Subscriber 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.

Error scenarios

java.util.NoSuchElementException: Timeout waiting for idle object

When using Event Publisher, the following error message may occur: java.util.NoSuchElementException: Timeout waiting for idle object

This means that the component is having difficulty processing the large number of events sent at the same time. To solve this situation, you have two options:

  • Increase the number of pipeline replicas: this helps to distribute the event load as efficiently as possible and reduce the pressure on the component so that it can process events more smoothly.

  • Implement error handling with Retry: this approach uses the Retry component to make new attempts to send the events that caused the error. This can be useful for handling temporary load spikes or events that occasionally fail.

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 parameter, but also for the Body parameter. 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 parameter 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"
}
}

Last updated