Queue rules are used to publish messages from pub/sub channels into an Ably Reactor Queue or into a 3rd party queue or stream using the Ably Reactor Firehose. If you would like to know why you should be using queues, see our Reactor Queue documentation.
We'll walk you through the process of setting up a queue rule now, however we assume you have already followed the steps to create a physical queue first.
1. Visit your app dashboard
2. Click on the Reactor tab and click "New Reactor Rule"
3. Select "Choose" under the Reactor Rules section
4. Configure your queue rule
The source for the realtime data can be either messages (messages published on channels), presence (presence events for members using presence and entering and leaving channels) or channel lifecycle events (for events triggered by channels being created or disposed).
The channel filter allows you to filter which channels produce messages or events for your queues. Regular expressions are supported
The encodings supported are either JSON (a text format) or MsgPack (a binary format)
Please note that by default all messages pushed into queues are wrapped in Ably envelope which contains meta data about the message. If you only want the payload (data element) of published messages published into the queue, you can turn off the envelope and headers with the metadata will be set on the message instead.
4. Test your rule
Once your rule is set up, you can use the dev console to publish messages, generate channel events or broadcast presence events on the channels that match the channel filter set up in your queue rule. In your queue dashboard, you should then see the messages building up in the "Messages ready" field of your queue in your queue dashboard (the stats from the queue are updated in real time).
If you are having problems with your queue, see some tips on how to debug the problem.