Skip to main content

RabbitMQ source

The RabbitMQ source connects Scenid directly to a queue on your own RabbitMQ broker and consumes its messages continuously. Every message becomes a document. Charts, dashboards and APIs update as messages arrive.

There is nothing to build: no endpoint to call, no consumer to run, no scheduler. You point Scenid at an exchange and a queue, and data flows.

Why it is different​

RabbitMQ sourceOther ways to stream data
Who pushes?Nobody. Scenid pulls from your brokerYour code has to call Scenid
InfrastructureYour existing brokerAn integration service you write and run
ScalingSeveral parallel consumers on the same queueYou scale your senders
DeliveryMessages are acknowledged after they are indexed, so nothing is lostDepends on your code
VisibilityLive queue depth in the appYou build monitoring
BackpressureThe queue buffers while Scenid catches upYou handle retries

It fits when events already flow through RabbitMQ (IoT gateways, order events, audit streams, integration buses) and you want them in dashboards and APIs without writing glue code.

Set it up​

  1. In the Insights app, create a new source and choose RabbitMQ.
  2. Enter the connection settings (below).
  3. Choose Test connection. Scenid connects, declares the exchange and queue and binds them, and reports success or the error.
  4. Create the source.

Connection settings​

SettingDescription
HostBroker URL, for example amqp://broker.example.com:5672
Virtual hostThe vhost
Username, PasswordCredentials. The password is stored encrypted
Exchange nameThe exchange to consume from
Exchange typedirect, topic or fanout
Exchange is durableMatch how the exchange exists on your broker
Queue nameThe queue Scenid reads
Routing keyBinding of the queue to the exchange. Default *
Queue is durableMatch your broker
Number of test messagesHow many messages to sample for field detection. Default 50

Give Scenid its own user on the broker with permission to configure, write and read the exchange and queue it uses.

First data, field detection, start​

After creation Scenid samples messages for up to ten seconds to detect the fields. The sampled messages are put back on the queue, so none are skipped. Then:

  1. Open the Data tab and review the detected fields. All fields start as string, set the right types (float, integer, boolean, date-iso, geo-point, …).
  2. Set duplicate control if messages can be delivered more than once (see below).
  3. Choose Start import.

While the queue is empty the source says no data has arrived. As soon as messages come in, the import starts by itself.

Messages​

  • The message body must be JSON.
  • Nested objects are flattened with _ ({ "gps": { "lat": 1 } } becomes gps_lat). Arrays are stored as text.
  • If the body has a top-level object message or Message, that object is used as the document. This unwraps envelopes such as SNS.
  • A field named _id in the body is ignored.
  • Oversized documents are skipped and logged.
A message body
{
"timestamp": "2026-09-01T12:00:00Z",
"deviceId": "SENS-HH-01",
"site": "Hamburg Warehouse",
"temperature": 21.4,
"humidity": 47.5,
"batteryPct": 96,
"location": "53.5453,9.9937",
"alarm": false
}

Delivery guarantees​

  • Scenid reads in batches: by default up to 5,000 messages or five seconds, whichever comes first, and writes the batch in bulk.
  • Messages are acknowledged after they are indexed. If indexing fails, the messages go back on the queue. Delivery is therefore at least once.
  • Because a message can arrive twice, set duplicate control:
    • Hash (default): identical messages overwrite each other, so a redelivery is harmless.
    • Field: choose a field that identifies the record (for example deviceId plus a timestamp field, or an event id) so a new message with the same key updates the document.
  • Parallel consumers: each source runs several consumers on the same queue (by default up to four) to keep up with high rates.

Invalid values​

A message whose values do not fit the field type (for example "n/a" in a float field) is not retried and not blocked. The problem is counted and listed in the Warnings tab with samples, and the message is acknowledged. Fix the field type or the publisher.

Publish valid JSON

Messages that are not valid JSON are not processed and remain unacknowledged on the queue. Scenid does not dead-letter them, so make sure publishers send JSON, or route failures on the broker side.

New fields appear automatically​

If a message contains a field Scenid has not seen, it is added as a disabled text field, and the source shows "New data fields were detected. Please review the field configuration." with an option to activate them all. Nothing breaks when a publisher adds a field.

Idle behaviour​

After a period without messages (five minutes by default) the source goes to SUCCESSFUL. It resumes to RUNNING when the next message arrives.

Monitor​

  • The Information tab shows the queue depth (messages waiting) and ingest progress, throughput per minute and per day, and recent events.
  • Warnings collects value problems.
  • The Connection tab shows the parameters. Editing them re-tests the connection and restarts the consumers.

Read-only​

Documents from a RabbitMQ source cannot be created, edited or deleted in Scenid (data belongs to the queue). Everything you can do with a source still works: aggregate from REST and the SDK, charts and dashboards, CSV export, joins, transforms. Use Reset data to clear the documents.

Try it with the sample data​

The test data contains 80 JSON messages (rabbitmq-sensor-messages.jsonl) and a publisher script for your own broker:

rabbitmq-sensor-messages.jsonl80 sensor readings as one JSON message per line
yarn add amqplib
RABBIT_URL=amqp://user:pass@localhost:5672/insights \
RABBIT_EXCHANGE=sensor-events RABBIT_ROUTING_KEY=readings \
node publish-rabbitmq.mjs ../rabbitmq-sensor-messages.jsonl 200

Create the RabbitMQ source with exchange sensor-events (type topic), queue sensor-readings and routing key readings. Then publish. Watch the documents arrive.

Read the data in code​

import sdk from '@scenid/cloud-sdk'

const { result } = await sdk.asAdmin().Insights().Source('Sensor stream').aggregate({
size: 20,
sort: [{ timestamp: 'desc' }],
filter: [{ term: { alarm: true } }]
})

The source is available to dashboards and APIs the moment the first message has been indexed.