CloudAMQP

The Devprime platform natively supports CloudAMQP, which provides a SaaS approach to RabbitMQ, an open-source messaging software that operates on the Advanced Message Queuing Protocol (AMQP) and Streaming Text Oriented Messaging Protocol (MQTT) protocols.

CloudAMQP’s configurations follow the same model as RabbitMQ’s with a point of attention to the HostName parameter that already includes the url and credentials provided when creating the service in CloudAMQP. User/Password/Port parameters are not required

Subscribe to a queue in RabbitMQ

The JSON below demonstrates the default configuration with the RabbitMQ credentials, the exchange used, the Retry, the Fallback, the Threads, and the ‘Subscribe’ option to receive events in the ‘orderevents’ queue as defined in the Queues item.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
"DevPrime_Stream": [
    {
      "Enable": "true",
      "Alias": "Stream1",
      "Default": "true",
      "StreamType": "RabbitMQ",
      "HostName": "amqps://user:password@demo.rmq.cloudamqp.com/demo",
      "Exchange": "devprime",
      "ExchangeType": "direct",
      "Retry": "3",
      "Fallback": "State1",
      "Threads": "30",
      "Buffer": "1",
      "Subscribe": [
        {
          "Queues": "orderevents"
        }
      ]
    }
  ],

In the example below, we’re detailing the default Adapter settings and the RabbitMQ-specific settings.

General
Enable Enable the Stream adapter (True/False)
Alias Defines a unique name to identify the service
Default Sets as default to the centary of having more than one Stream (True/False)
StreamType Sets the Stream type (RabbitMQ/Kafka)
HostName Configures the url/credential provided by CloudAMQP
Exchange Sets up the default RabbitMQ
ExchangeType Configures the type of Exchange
Retry Configure the number of retries
Fallback Configures a State for automatic resitence in case of failure
Threads Sets the number of concurrent connections processing events
Buffer Defines the number of events obtained per connection
Subscribe Configures RabbitMQ Queues for Read

Example in the application log with this configuration:

1
2
[INF][ms-order][Stream][Type "RabbitMQ"][Alias "Stream1"]
["Enable"][Subscribe]["orderevents"][Parallel "30"][Buffer "1"]

YAML example with application settings:
To export the configurations as an environment variable and use in Kubernetes, run the command in the Devprime CLI:
dp export kubernetes

1
2
3
4
5
6
- name: devprime_stream1
    value: "alias=Stream1|||enable=true|||default=true|||streamtype=RabbitMQ|||
    hostname=amqps://user:password@demo.rmq.cloudamqp.com/demo|||
    exchange=devprime|||exchangetype=direct|||retry=3|||
    fallback=State1|||threads=30|||buffer=1|||
    subscribe=[queues=orderevents]"

Use the RabbitMQ examples to explore other variations in configuration.

Last modified January 10, 2024 (967dcac3)