Skip to content

Conversation

@joeriddles
Copy link

@joeriddles joeriddles commented May 16, 2025

closes #2103

Implement support for NATS using its built-in persistence layer JetStream.

Example

You can test using either:

  • Installing the NATS server locally and running it with JetStream enabled: nats-server --js
  • Using the demo NATS server at demo.nats.io

The transport can be test using examples/nats_receive.py and examples/nats_send.py:

  1. Start the local NATS server (optional)
  2. Run python -m examples.nats_receive (append --demo if using the demo server)
  3. In another window, run python -m examples.nats_send (append --demo if using the demo server)

In the receive window, you should see something like:

Received message: 'hello world'
  properties:
{   'body_encoding': 'base64',
    'delivery_info': {'exchange': 'exchange', 'routing_key': 'messages'},
    'delivery_mode': 2,
    'delivery_tag': 'fa01f1a9-f666-46a0-af71-35e5164e1ad9',
    'priority': 0}
  delivery_info:
{'exchange': 'exchange', 'routing_key': 'messages'}

@joeriddles joeriddles mentioned this pull request May 16, 2025
@auvipy auvipy requested review from auvipy and Copilot May 17, 2025 08:16
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds initial support for NATS JetStream as a Kombu transport, including dependency, transport registration, and usage examples.

  • Adds nats-py extra requirement
  • Registers the nats transport in Kombu’s transport registry
  • Provides example scripts for sending and receiving messages via NATS JetStream

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

File Description
requirements/extras/nats.txt Pins the nats-py[nkeys] dependency
kombu/transport/init.py Registers 'nats' transport for JetStream
examples/nats_send.py Example for publishing messages to JetStream
examples/nats_receive.py Example for consuming messages from JetStream
Comments suppressed due to low confidence (1)

kombu/transport/init.py:48

  • [nitpick] The transport key 'nats' is generic and could conflict with other NATS-based transports; consider renaming it to 'nats_jetstream' to clearly distinguish this implementation.
'nats': 'kombu.transport.nats_jetstream:Transport',

Copy link
Member

@Nusnus Nusnus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please ping me when the PR is ready for review. Thank you for working on this!

@Nusnus Nusnus force-pushed the nats branch 2 times, most recently from a263b01 to f2df5f1 Compare May 31, 2025 15:50
@joeriddles joeriddles marked this pull request as ready for review June 11, 2025 02:49
@joeriddles
Copy link
Author

Please ping me when the PR is ready for review. Thank you for working on this!

@Nusnus ready for review!

@auvipy auvipy added this to the 5.7.0 milestone Jun 17, 2025
@joeriddles
Copy link
Author

@Nusnus @auvipy I fixed the merge conflicts and rebased on main

@auvipy
Copy link
Member

auvipy commented Oct 23, 2025

tried to fix the merge conflicts, but feel free to improve it

@joeriddles
Copy link
Author

Thanks @auvipy, I fixed tox.ini but otherwise the merge looks good

@maxyloon
Copy link

Just wanted to spread the love. So looking forward for this integration!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NATS support

4 participants