Service: SmoothMQ - EyevinnOSC/community GitHub Wiki
SmoothMQ (serviceId poundifdef-smoothmq) is a drop-in replacement for Amazon SQS: any SQS client can use it by pointing at the instance endpoint. In Eyevinn Open Source Cloud (OSC) it is a long-running service instance with up to 10 GiB of storage per instance. License: AGPL-3.0.
- Provide a private SQS-compatible message queue for your solution.
- Be used with existing SQS clients and SDKs, for example Python boto3, by changing only the endpoint URL.
- Serve as the queue behind other OSC services that use SQS, for example the Player Analytics Eventsink.
Create the instance with create-service-instance using serviceId: "poundifdef-smoothmq" and a config object. The instance name must be alphanumeric and at most 20 characters. SmoothMQ has no dependencies on other OSC services.
Store the credentials as service secrets first with create-service-secret (serviceId: "poundifdef-smoothmq"), for example accesskey and secretkey.
{
"name": "guide",
"AccessKey": "{{secrets.accesskey}}",
"SecretKey": "{{secrets.secretkey}}"
}Wait for the instance with wait-for-service-ready, then use describe-service-instance to get the URL and internal endpoint. The instance is available at https://<tenant>-guide.poundifdef-smoothmq.auto.prod-se.osaas.io/, where <tenant> is your tenant id.
With the OSC CLI:
% npm install -g @osaas/cli
% osc create poundifdef-smoothmq guide -o AccessKey="{{secrets.accesskey}}" -o SecretKey="{{secrets.secretkey}}"| Option | Required | Type | Meaning |
|---|---|---|---|
| name | Yes | string | Name of the instance. Alphanumeric, at most 20 characters. |
| AccessKey | No | string, sensitive | AWS-compatible access key id that SQS clients use to authenticate against the instance. Store it as a secret and pass {{secrets.NAME}}. |
| SecretKey | No | string, sensitive | AWS-compatible secret access key paired with AccessKey. Store it as a secret and pass {{secrets.NAME}}. |
A {{secrets.NAME}} reference must be the whole field value. Changing a secret later does not restart a running instance.
Use the AWS credentials you set as AccessKey and SecretKey (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY) with an SQS client and set the endpoint URL to the instance URL.
Install boto3 and create a queue and send a message (send.py):
import boto3
sqs = boto3.client("sqs", endpoint_url="https://<tenant>-guide.poundifdef-smoothmq.auto.prod-se.osaas.io/")
sqs.create_queue(QueueName='guide')
response = sqs.list_queues()
url = response['QueueUrls'][0]
sqs.send_message(QueueUrl=url, MessageBody="Hello world")% python -m venv .venv
% . .venv/bin/activate
% python -m pip install boto3
% export AWS_ACCESS_KEY_ID=<access-key>
% export AWS_SECRET_ACCESS_KEY=<secret-key>
% python send.pyRead the message (recv.py):
import boto3
sqs = boto3.client("sqs", endpoint_url="https://<tenant>-guide.poundifdef-smoothmq.auto.prod-se.osaas.io/")
response = sqs.list_queues()
url = response['QueueUrls'][0]
msg = sqs.receive_message(QueueUrl=url)
print (msg['Messages'][0]['Body'])Running it prints Hello world.
- Storage is limited to 10 GiB per instance.