Starlight for RabbitMQ

Starlight for RabbitMQ brings native RabbitMQ® protocol support to Apache Pulsar®, enabling migration of existing RabbitMQ applications and services to Pulsar without modifying the code. RabbitMQ applications can now leverage Pulsar’s powerful features, such as:

  • Consistent metadata store: Starlight for RabbitMQ uses Apache ZooKeeper™, so existing Zookeeper configuration stores can store Starlight for RabbitMQ metadata.

  • Security and authentication: Starlight for RabbitMQ connects to brokers that have TLS, authentication, and/or authorization enabled, because it uses the same AuthenticationService as Pulsar.

  • Clustering: Launch multiple stateless Starlight for RabbitMQ instances simultaneously for scalability and high availability.

  • Multi-tenancy: Starlight for RabbitMQ offers support for multi-tenancy, mapping an AMQP virtual host to a Pulsar tenant and namespace.

By integrating two popular event streaming ecosystems, Starlight for RabbitMQ unlocks new use cases and reduces barriers for users adopting Pulsar. Leverage advantages from each ecosystem and build a truly unified event streaming platform with Starlight for RabbitMQ to accelerate the development of real-time applications and services.

Get started producing and consuming RabbitMQ messages on a Pulsar cluster.

Starlight for RabbitMQ Quickstart

  1. To start connecting Starlight for RabbitMQ, select RabbitMQ in the Astra Streaming Connect tab.

  2. When the popup appears, confirm you want to enable RabbitMQ on your tenant.

    You can’t remove the RabbitMQ namespace created on your tenant with this step. You must remove the tenant itself to remove this namespace.

  3. Select Enable RabbitMQ to create a rabbitmq namespace in your Astra Streaming tenant for RabbitMQ functionality, as well as a configuration file.

  4. Save the configuration to a rabbitmq.conf file:

    rabbitmq.conf
    username: TENANT_NAME
    password: token:***
    host: rabbitmq-azure-us-west-2.streaming.datastax.com
    port: 5671
    virtual_host: azure/rabbitmq

    The configuration details depend on your Astra Streaming tenant configuration.

Connect RabbitMQ and Pulsar

This example uses a Python script to create a connection between RabbitMQ and your Pulsar tenant, establish a message queue named queuename, print ten messages, and then close the connection.

  1. Create a connect-test.py file containing the following code:

    connect-test.py
    import 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.conf file:

    • VIRTUAL_HOST

    • TOKEN

    • HOST_NAME

    • PORT

  2. Save the connect-test.py file.

  3. Run connect-test.py:

    python3 connect-test.py
  4. 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
  5. Navigate to your rabbitmq namespace dashboard in Astra Streaming, and then monitor your activity.

    If configured correctly, you should have new topics called amq.default.__queuename and amq.default_routingkey that 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 topic.

RabbitMQ exchanges and Pulsar topics

Starlight for RabbitMQ maps RabbitMQ exchanges to Pulsar topics, as described in the following table:

Exchange Routing key Pulsar topic name Usage example

amp.direct

used

amq.direct.__{routing key}

channel.basic_publish(exchange='amp.direct',

amp.default or empty string

used

amq.default.__{routing key}

channel.basic_publish(exchange="),

amp.match

not used

amp.match

channel.basic_publish(exchange=amp.match),

amp.fanout

not used

amp.fanout

channel.basic_publish(exchange='amp.fanout'),

headers

not used

Name of the header

channel.exchange_declare(exchange='header_logs', exchange_type='headers') channel.basic_publish(exchange='header_logs'),

Was this helpful?

Give Feedback

How can we improve the documentation?

© 2024 DataStax | Privacy policy | Terms of use

Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Pulsar, Pulsar, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries. Kubernetes is the registered trademark of the Linux Foundation.

General Inquiries: +1 (650) 389-6000, info@datastax.com