• Glossary
  • Support
  • Downloads
  • DataStax Home
Get Live Help
Expand All
Collapse All

DataStax Streaming Home

Astra Streaming Documentation

    • Getting Started
    • Developing
      • Using Pulsar binaries with Astra Streaming
      • Using curl with Astra Streaming
      • Astra CLI
      • Astra Streaming Functions
      • Starlight for Kafka
      • Starlight for RabbitMQ
      • Producing and consuming messages
        • Astra Portal
        • Pulsar Cli
        • Client Applications
          • Java
          • Python
          • C#
          • Golang
          • Node.js
      • Change data capture (CDC)
        • CDC for Astra DB
    • Operations
      • Geo-replication
      • Astra Streaming Limits
      • Astra Streaming Pricing
      • Astra Streaming Regions
      • Scrape Astra Streaming metrics with Prometheus
      • Manage Tokens
      • Enrollment FAQ
    • Guides and Examples
      • FAQs
      • Manage permissions
        • Use custom roles
      • Pulsar subscriptions
        • Exclusive
        • Shared
        • Failover
        • Key_shared
    • API Docs
      • Using the DevOps v2 API
      • API References
    • IO Connectors
    • Astra Streaming release notes
  • Astra Streaming Documentation
  • Developing
  • Producing and consuming messages
  • Pulsar Cli
Edit this Page

Pulsar client with Astra Streaming

This guide assumes you have completed the Astra Streaming quickstart and you have set up your Pulsar binaries to work with your tenant.

Now it’s time to produce and consume messages in your new streaming tenant.

Set the required variables. If you’ve just completed the quickstart, these values are already set.

TOPIC="my-topic"
NAMESPACE="my-namespace"
TENANT="my-stream-<rand>" #replace <rand> with a few alphanumeric characters

Run the following script to create 1 new message.

# Produce a new message on the given tenant/namespace/topic
./bin/pulsar-client produce \
    "$TENANT/$NAMESPACE/$TOPIC" \
    --messages "Hi there" \
    --num-produce 1

Now you have a new, unacknowledged message in your topic.

Run the following script to create a consumer that retrieves and acknowledges that message.

# Consume a new message on the given tenant/namespace/topic
./bin/pulsar-client consume \
    "$TENANT/$NAMESPACE/$TOPIC" \
    --subscription-name "examples-subscriber" \
    --num-messages 1

The output should look similar to this:

404: Not Found

If you made it here then your produce & consume journey was successful. Congrats🎉! Now it’s time to take your skills further 🚀🚀.

What’s next?

Astra Streaming Functions
CDC for Astra DB

Astra Portal Client Applications

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

© DataStax | Privacy policy | Terms of use

DataStax, Titan, and TitanDB are registered trademarks of DataStax, Inc. and its subsidiaries in the United States and/or other countries.

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.

landing_page landingpage