Subscribing to events, types of events, receiving events
Numerous requests to our API are asynchronous. Results to such calls arrive shortly in forms of events. Here you can find what types of events are produced and how to subscribe to them.
Subscribing to events
TEOS API distributes events using RabbitMQ message-queueing platform. This chapter describes how one can subscribe to TEOS Events. Some knowledge of RabbitMQ is required.
Connection details and user credentials
To establish a connection to the RabbbitMQ and to create a channel the following data(examples) is provided by TEOS API administrator:
There are multiple endpoints, available on different ports:
AMQP 0-9-1 (Advanced Message Queuing Protocol) is a messaging protocol that enables conforming client applications to communicate with conforming messaging middleware brokers. More about it here.
The exact endpoint and port are depending on the environment/tenant
A TLS-secured version of AMQP 0-9-1.
TLS version supported by TEOS RabbitMQ is: TLS 1.2
The exact endpoint and port are depending on the environment/tenant
The following cipher suites are available on the Teos RabbitMQ Node (OpenSSL format):
The cipher suites listed above are in formats that can be used for inbound and outgoing (e.g. Shovel, Federation) client TLS connections
MQTT protocol is available over a WebSocket connection.
The exact endpoint and port are depending on the environment/tenant
Examples of Mqtt clients, connecting to TEOS Api events can be found here
Important!
The connection to the RabbitMQ endpoint should be resistant to transient network errors and automatically reconnect to the server, recreate queues, and rebind them to the exchanges in case of network failures.
Queues
Only queues with server-generated names are allowed which means the queue names should be empty while declaring a new queue.
Exchange
Event messages are sent to exchange with the name "teos_events" and of type "topic". Each TEOS Event, published to the exchange, has its own specific routing key (see lower) - a list of words, delimited by dots.
Bindings
Queues are bound to the exchange with a routing key. The routing key specifies what types of events will be delivered to the queue. Wildcards are supported:
* (star) can substitute for exactly one word.
# (hash) can substitute for zero or more words
Example: the routing key "asset.#" will bind the queue to all asset events
The same queue can be bound multiple times to the exchange with different routing keys.
Events overview
This chapter provides the list of published events, with their routing keys and payload examples