Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement BulkPublish for NATS JetStream #3649

Closed
wants to merge 2 commits into from

Conversation

Jarema
Copy link
Contributor

@Jarema Jarema commented Jan 15, 2025

Description

This PR implements BulkPublish for NATS JetStream with a goal to enable parallel processing of published messages.

Continous async publishing would be a better solution, but there seem to be no interface for that in DAPR.
The alternatives:

  • use PublishRequest.Metadata on pubsub.Publish to pass a switch that would enable asynchronous publishing
  • use general NATS JetStream DAPR config to opt-in into asynchronous publishing for everything.

Not sure what is the most idiomatic way to handle that in DAPR.
For some context: In future NATS will introduce actuall BulkPublish which would be an atomic operation, so using BulkPublish might bring issues in the future, or at least rise the same question: how to switch between atomic and non atomic bulk publish.

I would appreciate some guidance from the maintainers what is the best approach here, DAPR API wise.

Issue reference

#3115

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • Code compiles correctly
  • Created/updated tests
  • Extended the documentation / Created issue in the https://github.com/dapr/docs/ repo: dapr/docs#[issue number]

PR specific checklist

  • decide how to implement asynchronous publish

This commit uses the BulkPublish API to introduce asynchronous publish.
It uses NATS client `PublishAsync` to publish all messages, then
iterates over all acks, gathers failed ones and returns.

Signed-off-by: Tomasz Pietrek <[email protected]>
Copy link
Contributor

@piotrpio piotrpio left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link

This pull request has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@github-actions github-actions bot added the stale label Feb 14, 2025
Copy link

This pull request has been automatically closed because it has not had activity in the last 37 days. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@github-actions github-actions bot closed this Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants