{starlight-rabbitmq} brings native RabbitMQ® protocol support to {pulsar-reg}, enabling migration of existing RabbitMQ applications and services to {pulsar-short} without modifying the code. RabbitMQ applications can leverage {pulsar-short} features such as the following:
-
Consistent metadata store: {starlight-rabbitmq} uses Apache ZooKeeper™, so existing Zookeeper configuration stores can store {starlight-rabbitmq} metadata.
-
Security and authentication: {starlight-rabbitmq} connects to brokers that have TLS, authentication, and/or authorization enabled, because it uses the same
AuthenticationServiceas {pulsar-short}. -
Clustering: Launch multiple stateless {starlight-rabbitmq} instances simultaneously for scalability and high availability.
-
Multi-tenancy: {starlight-rabbitmq} offers support for multi-tenancy, mapping an AMQP virtual host to a {pulsar-short} tenant and namespace.
By integrating two popular event streaming ecosystems, {starlight-rabbitmq} unlocks new use cases and reduces barriers for users adopting {pulsar-short}. Leverage advantages from each ecosystem and build a truly unified event streaming platform with {starlight-rabbitmq} to accelerate the development of real-time applications and services.
Get started producing and consuming RabbitMQ messages on a {pulsar-short} cluster.
-
To start connecting {starlight-rabbitmq}, select RabbitMQ in the {product} Connect tab.
-
When the popup appears, confirm you want to enable RabbitMQ on your tenant.
ImportantYou cannot remove the RabbitMQ namespace created on your tenant with this step. You must remove the tenant itself to remove this namespace.
-
Select Enable RabbitMQ to create a
rabbitmqnamespace in your {product} tenant for RabbitMQ functionality, as well as a configuration file. -
Save the configuration to a
rabbitmq.conffile:rabbitmq.confusername: TENANT_NAME password: token:*** host: rabbitmq-azure-us-west-2.streaming.datastax.com port: 5671 virtual_host: azure/rabbitmqThe configuration details depend on your {product} tenant configuration.
This example uses a Python script to create a connection between RabbitMQ and your {pulsar-short} tenant, establish a message queue named queuename, print ten messages, and then close the connection.
-
Create a
connect-test.pyfile containing the following code:connect-test.pyimport ssl import pika virtual_host = "VIRTUAL_HOST" token = "TOKEN" context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2) context.verify_mode = ssl.CERT_NONE context.check_hostname = False context.load_default_certs() ssl_options = pika.SSLOptions(context) connection = pika.BlockingConnection(pika.ConnectionParameters( virtual_host=virtual_host, host="HOST_NAME", ssl_options=ssl_options, port=PORT, credentials=pika.PlainCredentials("", token))) print("connection success") channel = connection.channel() print("started a channel") channel.queue_declare(queue='queuename') for x in range(10): channel.basic_publish(exchange='', routing_key='routingkey', body='message body goes here') print(" sent one") connection.close()
Replace the following with values from your downloaded
rabbitmq.conffile:-
VIRTUAL_HOST -
TOKEN -
HOST_NAME -
PORT
-
-
Save the
connect-test.pyfile. -
Run
connect-test.py:python3 connect-test.py
-
Make sure the result is similar to the following:
connection success started a channel sent one sent one sent one sent one sent one sent one sent one sent one sent one sent one
-
Navigate to your
rabbitmqnamespace dashboard in {product}, and then monitor your activity.If configured correctly, you should have new topics called
amq.default.__queuenameandamq.default_routingkeythat were created by the Python script, as well as an increasing amount of traffic and messages. Your RabbitMQ messages are being published to a {pulsar-short} topic.
{starlight-rabbitmq} maps RabbitMQ exchanges to {pulsar-short} topics, as described in the following table:
| Exchange | Routing key | {pulsar-short} topic name | Usage example |
|---|---|---|---|
|
used |
|
|
|
used |
|
|
|
not used |
|
|
|
not used |
|
|
|
not used |
Name of the header |
|
-
getting-started:index.adoc