A component for publish–subscribe messaging pattern on elastic.io platform.
This feature implements conditional logic for data flow in a loosely coupled way, using a “contract” between the Publisher and its Subscribers. Such a “contract” is called a Topic
.
The technical notes page gives some technical details about Pub-Sub component like changelog.
By default no environment variable is necessary to operate the component.
A Topic is a named JSON schema to be used to communicate in a PubSub style. Topic can be created via UI or API-call and contains following information:
For example, here is the topic that contains information about some person:
{
"data": {
"type": "topic",
"attributes": {
"name": "The person",
"schema": {
"$id": "https://example.com/person.schema.json",
"title": "Person",
"type": "object",
"properties": {
"firstName": {
"type": "string",
"description": "The person's first name."
},
"lastName": {
"type": "string",
"description": "The person's last name."
},
"age": {
"description": "Age in years which must be equal to or greater than zero.",
"type": "number",
"minimum": 0
}
}
}
}
}
}
Trigger, which receives data of a certain type from a Topic as an input and starts the Flow execution after this. When you create a Subscriber Flow you must choose a Topic on which your flow will be listening for messages. You can create as many Subscriber Flows as you want, and they will process messages from the Publisher independently.
Please Note: Topics can only be accessed if they are already in your workspace.Topic can be created via UI or API-call.
For our example, we have created a special flow that publishes messages for our trigger.
Please Note: You need to know what your flow sample will look like in order to work with it further.
Since we know what our sample should be, we can add it manually:
This sample can be used later in your Flows as usual.
{
"firstName": "dolore",
"lastName": "ut enim sunt tempor eu",
"age": 54053437
}
Action that publishes a message of a certain type to the topic to be later received by loosely coupled Subscribers.
During the creation of a Publisher Flow you must choose a topic
created earlier, by which your Publisher Flow will communicate with it’s Subscribers. As you can see, we have already used this action for our Subscribe
trigger before. After you have chosen the topic you need, you can enter new data.
Connection between the Publisher and the Subscriber is loosely coupled. This means that your Publisher will never know if there any subscribers at all, and if they processed incoming message.
Click here to learn more about the elastic.io iPaaS