Skip to main content

Keeping Your Message Queues in Your Own Messaging

OpenDataDSL keeps your message queues in its own Azure Service Bus namespace, and your applications connect to them with a connection string. You can choose to keep them in your own messaging service instead, so the messages for your systems never leave your infrastructure, your applications read them the way they read the rest of your messages, and you can monitor and govern them with your own tools.

You add connections to your messaging, as many as you need and of any of four kinds, and say which queues go to each one by their names (for example trading-* to one Kafka cluster, risk-* to another and etrm-prices to an AMQP broker). Queues no name matches stay in the OpenDataDSL namespace, unless you choose one of your connections as the default.

MessagingWhat OpenDataDSL usesHow OpenDataDSL signs inGuide
Azure Service BusQueues in your namespaceAs its own application with a role: no keysAzure Service Bus
Amazon SQSStandard queues in your AWS accountAssumes an IAM role with a token from its own Microsoft Entra tenant: no keys. Or an access keyBelow
Apache KafkaTopics in Confluent Cloud, Amazon MSK, Azure Event Hubs, Aiven or your own clusterA user name and password (SASL PLAIN or SCRAM) over TLSBelow
AMQP 1.0Queues on ActiveMQ Artemis, Amazon MQ for ActiveMQ, RabbitMQ 4, Solace, IBM MQ or Apache QpidA user name and password over TLSBelow

What changes​

QueuesWhat happens
New queuesCreated in the connection their name matches most closely (an exact name first, then the pattern with the most letters), else the default; whoever creates a queue can also choose the connection. Names: Service Bus: the same name as in OpenDataDSL (<environment>/<your-company>/<queue>). SQS: odsl-<environment>-<queue>. Kafka and AMQP: odsl.<environment>.<queue>. You can change the prefix (odsl- or odsl.)
Queues you already haveStay in the OpenDataDSL namespace and keep working, with their connection string
HandlersQueues in your messaging can't have a handler (trigger or loader): keep queues that load data into OpenDataDSL or trigger processes in the OpenDataDSL namespace
SendingAutomations, send in scripts and processes, and the Message Queues extension send to your queues wherever they are, and every message OpenDataDSL sends is logged in the queue log. For SQS, Kafka and AMQP, scripts run outside the platform send through the OpenDataDSL API, which holds the credentials

The Message Queues extension only offers what your messaging can do: for example it shows no messages for SQS (an SQS receive hides the message and counts towards its receive limit), and only Service Bus can delete or move chosen messages. See what OpenDataDSL can do with your queues.

Where to configure it​

An administrator of your company in OpenDataDSL (a user with the admin role) adds each connection on the Messaging tab of the Custom Infrastructure extension (Manage > Custom Infrastructure > Messaging): a name, the queues to send to it, the details below, a test, and save. The tab shows every step below with your values, policies and commands filled in. If you don't have the extension, OpenDataDSL support can configure it for you.

Passwords and keys​

Kafka and AMQP passwords and AWS secret access keys are entered once and kept in the OpenDataDSL key vault. They are never shown again, to you or to OpenDataDSL support. To rotate one, enter the new value in the extension and save: OpenDataDSL tests it straight away.

Amazon SQS​

How OpenDataDSL signs in​

OpenDataDSL gets a token for its own application from its Microsoft Entra tenant and exchanges it for temporary AWS credentials with STS AssumeRoleWithWebIdentity, the same mechanism GitHub Actions and Kubernetes use to sign in to AWS. You create an OpenID Connect identity provider for the OpenDataDSL Entra tenant and a role that trusts it. The trust policy only lets in the OpenDataDSL application, and only with your company's session name odsl-<your-tenant-id>, so no other OpenDataDSL client can assume your role. OpenDataDSL's connection test checks this: it refuses a role that would accept any session name.

If you can't use a role, you can give OpenDataDSL an access key of an IAM user with the same permission policy instead.

Step 1: Add the identity provider​

As an IAM administrator, add an OpenID Connect identity provider (IAM > Identity providers > Add provider) with the Provider URL and Audience shown on the Messaging tab when you choose Amazon SQS. Or with the AWS CLI:

aws iam create-open-id-connect-provider \
--url https://sts.windows.net/<opendatadsl-tenant-id>/ \
--client-id-list <opendatadsl-application-id>

This is done once per AWS account.

Step 2: Create the role​

Create a role (IAM > Roles > Create role > Custom trust policy) with this trust policy. The Messaging tab shows it with every value filled in:

{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Federated": "arn:aws:iam::<account-id>:oidc-provider/sts.windows.net/<opendatadsl-tenant-id>"
},
"Action": "sts:AssumeRoleWithWebIdentity",
"Condition": {
"StringEquals": {
"sts.windows.net/<opendatadsl-tenant-id>:aud": "<opendatadsl-application-id>",
"sts.windows.net/<opendatadsl-tenant-id>:sub": "<opendatadsl-application-object-id>",
"sts:RoleSessionName": "odsl-<your-tenant-id>"
}
}
}
]
}

Step 3: Give the role access to the queues​

Add this permission policy to the role (or to the IAM user for an access key). It only covers queues whose names start with your prefix:

{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "OpenDataDSLQueues",
"Effect": "Allow",
"Action": [
"sqs:CreateQueue", "sqs:DeleteQueue", "sqs:GetQueueUrl", "sqs:GetQueueAttributes",
"sqs:SetQueueAttributes", "sqs:SendMessage", "sqs:PurgeQueue",
"sqs:StartMessageMoveTask", "sqs:ListMessageMoveTasks", "sqs:ReceiveMessage", "sqs:DeleteMessage"
],
"Resource": "arn:aws:sqs:<region>:<account-id>:odsl-*"
},
{
"Sid": "OpenDataDSLList",
"Effect": "Allow",
"Action": ["sqs:ListQueues"],
"Resource": "*"
}
]
}

sqs:ReceiveMessage and sqs:DeleteMessage are only for moving dead letter messages back (an SQS message move task); OpenDataDSL never reads your messages otherwise.

What OpenDataDSL creates​

For each queue: a standard queue odsl-<environment>-<queue> with the queue's retention (1 minute to 14 days) and timeout as its visibility timeout, and unless you turn it off a dead letter queue odsl-<environment>-<queue>-dlq that SQS moves a message to after 10 failed receives (you can change the number). Messages carry the subject, content type, message id and correlation id as message attributes.

Connecting your applications​

Each application uses its own IAM role or user with sqs:ReceiveMessage, sqs:DeleteMessage and sqs:ChangeMessageVisibility on its queue. In Python:

import boto3

sqs = boto3.client("sqs")
url = sqs.get_queue_url(QueueName="odsl-prod-etrm-prices")["QueueUrl"]
res = sqs.receive_message(QueueUrl=url, MaxNumberOfMessages=10, WaitTimeSeconds=10, MessageAttributeNames=["All"])
for m in res.get("Messages", []):
print(m["Body"])
sqs.delete_message(QueueUrl=url, ReceiptHandle=m["ReceiptHandle"])

Apache Kafka​

Step 1: Create a user for OpenDataDSL​

Kafka serviceUser namePassword
Confluent CloudThe API key of a service accountThe API secret
Azure Event Hubs (Standard tier or higher)$ConnectionStringThe connection string of a shared access policy on the namespace (Manage if OpenDataDSL creates the topics, otherwise Send and Listen)
Amazon MSKA SCRAM-SHA-512 user (an AWS Secrets Manager secret associated with the cluster), with public access turned onIts password
Aiven, self-managedA SASL PLAIN or SCRAM userIts password

OpenDataDSL connects over TLS (SASL_SSL, or SSL without a password) to the cluster's bootstrap servers.

Step 2: Allow the user on your topics​

OpenDataDSL needs Describe, Read and Write on topics starting with your prefix (odsl.), and if it creates the topics also Create, Delete, DescribeConfigs and AlterConfigs. It reads without a consumer group, so it needs no group ACL and never moves your applications' offsets. For example:

kafka-acls.sh --bootstrap-server <bootstrap-servers> --command-config admin.properties \
--add --allow-principal User:<user> \
--operation Describe --operation Read --operation Write --operation Create \
--operation Delete --operation DescribeConfigs --operation AlterConfigs \
--resource-pattern-type prefixed --topic odsl.
confluent kafka acl create --allow --service-account <sa-id> \
--operations describe,read,write,create,delete,describe-configs,alter-configs \
--topic odsl. --prefix

What OpenDataDSL creates​

If OpenDataDSL creates the topics (the default), each queue is a topic odsl.<environment>.<queue> with 3 partitions, replication factor 3 and the queue's retention as retention.ms; you can change the partitions and replication factor. Otherwise you create the topics and OpenDataDSL checks they exist. With dead letter topics turned on, <topic>.dlq is the queue's dead letter topic: your consumers write to it, and the Message Queues extension can show it, clear it and copy its records back.

The record key is the correlation id (or the message id). The subject, content type, message id, correlation id and properties are record headers. Kafka keeps records after they are read, until the topic's retention, so the counts are the records still in the topic.

Connecting your applications​

Each application reads its topic with its own user and consumer group. In Python:

from confluent_kafka import Consumer

c = Consumer({"bootstrap.servers": "<bootstrap-servers>", "security.protocol": "SASL_SSL",
"sasl.mechanism": "PLAIN", "sasl.username": "<user>", "sasl.password": "<password>",
"group.id": "etrm-loader", "auto.offset.reset": "earliest"})
c.subscribe(["odsl.prod.etrm-prices"])
while True:
msg = c.poll(5.0)
if msg is not None and not msg.error():
print(dict(msg.headers() or []), msg.value().decode())

AMQP 1.0​

Step 1: Create the queues​

AMQP has no standard way to create or delete queues, so OpenDataDSL never does. Create a queue (an anycast address in ActiveMQ Artemis) for each OpenDataDSL queue, named odsl.<environment>.<queue>, or let the broker create queues on first use (ActiveMQ Artemis auto-create-queues). The Message Queues extension shows each name. Deleting a queue in OpenDataDSL leaves it on your broker.

For dead letters, configure them on the broker so each queue has its own dead letter queue with a prefix, for example ActiveMQ Artemis with auto-create-dead-letter-resources and the prefix DLQ., and enter the same prefix in OpenDataDSL.

Step 2: Create a user for OpenDataDSL​

The user needs send, consume and browse rights on the queues starting with your prefix, and on their dead letter queues. In ActiveMQ Artemis broker.xml:

<security-setting match="odsl.#">
<permission type="send" roles="odsl"/>
<permission type="consume" roles="odsl"/>
<permission type="browse" roles="odsl"/>
</security-setting>

In RabbitMQ 4 (native AMQP 1.0):

rabbitmqctl set_permissions -p / odsl "^odsl\..*" "^odsl\..*" "^odsl\..*"

OpenDataDSL connects with TLS only, to amqps://<broker>:5671 (connection options for the Qpid JMS client can follow after ?).

What OpenDataDSL sends​

Persistent text messages. The subject is the AMQP subject (JMSType), the correlation id the AMQP correlation id, and the message id, content type and properties are application properties. Counts and the message view browse the queue (counts stop at 1000), clearing receives and deletes the messages, and moving dead letters back receives each one from the dead letter queue and sends it to the queue in one transaction.

Connecting your applications​

Each application reads its queue with its own user. In Python, with Qpid Proton:

from proton.utils import BlockingConnection

conn = BlockingConnection("amqps://<broker>:5671", user="<user>", password="<password>")
receiver = conn.create_receiver("odsl.prod.etrm-prices")
msg = receiver.receive(timeout=10)
print(msg.subject, msg.body)
receiver.accept()
conn.close()

Networking​

OpenDataDSL connects to your messaging over the internet. If it only allows selected networks, allow the OpenDataDSL addresses: ask OpenDataDSL support for them.

Changing or removing it​

To stop OpenDataDSL using a connection, select Remove next to it on the Messaging tab of the Custom Infrastructure extension (or ask OpenDataDSL support), then remove its access on your side (the IAM role or identity provider, the Kafka user or ACLs, the broker user). Queues already in your messaging stay there, but OpenDataDSL can no longer reach them: automations and scripts that send to them fail until each queue is deleted and created again. Pointing a connection at another broker works the same way, and the extension lists the affected queues before you confirm. Changing which queues go to a connection only affects new queues.

If you remove OpenDataDSL's access first, everything that sends to your queues fails until access is restored.

Troubleshooting​

SymptomLikely cause
SQS: InvalidIdentityToken or no OpenID Connect providerThe identity provider in step 1 is missing, or its URL or audience is different from the values on the Messaging tab
SQS: OpenDataDSL is not allowed to assume the roleThe trust policy's provider, aud, sub or sts:RoleSessionName values don't match the ones on the Messaging tab
SQS: the test says the role accepts any session nameAdd the sts:RoleSessionName condition to the trust policy
SQS: AccessDenied on a queue actionThe permission policy is missing the action, or the prefix in its resource doesn't match the prefix in OpenDataDSL
SQS: purge refusedSQS allows one purge of a queue a minute: try again shortly
Kafka: authentication failedThe user name or password is wrong (for Event Hubs, the user name must be $ConnectionString)
Kafka: topic authorization failedThe ACLs on the prefix are missing (step 2)
Kafka: timeoutsThe bootstrap servers are wrong, or OpenDataDSL isn't allowed through the cluster's network rules
AMQP: unauthorizedThe user name or password is wrong, or the user has no rights on the queue
AMQP: the queue does not existCreate it, or let the broker create queues automatically
Saving a queue with a handler is refusedHandlers aren't available in your own messaging (see What changes)

More information​