-
Notifications
You must be signed in to change notification settings - Fork 26
feat: end to end wiring for per message nack #365
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
Open
ayildirim21
wants to merge
13
commits into
numaproj:main
Choose a base branch
from
ayildirim21:per-msg-nack
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
594b200
fix: use the closed window in the eof response (#360)
vaibhavtiwari33 cf16d9f
feat: end to end wiring for per message nack
ayildirim21 d3cc5f6
fix lint
ayildirim21 3ad675e
fix test
ayildirim21 b80c71a
fix lint
ayildirim21 50f8767
add unit and integration tests
ayildirim21 5312191
fix lint
ayildirim21 b5d3ca5
chore: release v0.14.0 (#364)
vaibhavtiwari33 7f2d8e9
docs: updated CHANGELOG.md (#366)
github-actions[bot] 11cc76b
refactor
ayildirim21 370c6d8
Merge branch 'main' into per-msg-nack
ayildirim21 a1db133
generic map
ayildirim21 3e79b16
Merge branch 'per-msg-nack' of github.com-personal:ayildirim21/numafl…
ayildirim21 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| [project] | ||
| name = "nack" | ||
| version = "0.1.0" | ||
| requires-python = ">=3.10, <3.15" | ||
| dependencies = [ | ||
| "pynumaflow", | ||
| ] | ||
|
|
||
| [tool.uv.sources] | ||
| pynumaflow = { path = "../../"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| from __future__ import annotations | ||
|
|
||
| from dataclasses import dataclass, field | ||
|
|
||
| from pynumaflow.proto.common import nack_options_pb2 | ||
|
|
||
|
|
||
| @dataclass | ||
| class NackOptions: | ||
| """Per-message redelivery options for a nack. | ||
|
|
||
| Args: | ||
| delay: the redelivery delay in milliseconds. | ||
| max_deliveries: the maximum number of redelivery attempts. | ||
| reason: a human-readable reason for nacking the message. | ||
| nack_map: a generic map of string key-value pairs used to pass | ||
| properties/configurations for nacking back to the source (e.g. for | ||
| sources like SQS, Pulsar or JetStream that support NACK). | ||
| """ | ||
|
|
||
| delay: int | None = None | ||
| max_deliveries: int | None = None | ||
| reason: str | None = None | ||
| nack_map: dict[str, str] = field(default_factory=dict) | ||
|
|
||
| def _to_proto(self) -> nack_options_pb2.NackOptions: | ||
| return nack_options_pb2.NackOptions( | ||
| reason=self.reason, | ||
| max_deliveries=self.max_deliveries, | ||
| delay=self.delay, | ||
| nack_map=self.nack_map, | ||
| ) | ||
|
|
||
|
|
||
| def _nack_options_to_proto( | ||
| opts: NackOptions | None, | ||
| ) -> nack_options_pb2.NackOptions | None: | ||
| if opts is None: | ||
| return None | ||
| return opts._to_proto() | ||
|
|
||
|
|
||
| def _nack_options_from_proto( | ||
| proto: nack_options_pb2.NackOptions, | ||
| ) -> NackOptions: | ||
| return NackOptions( | ||
| delay=proto.delay if proto.HasField("delay") else None, | ||
| max_deliveries=proto.max_deliveries if proto.HasField("max_deliveries") else None, | ||
| reason=proto.reason if proto.HasField("reason") else None, | ||
| # proto3 map fields do not support HasField; an unset map is simply empty. | ||
| nack_map=dict(proto.nack_map), | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
packages/pynumaflow/pynumaflow/proto/common/nack_options.proto
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| syntax = "proto3"; | ||
|
|
||
| package common; | ||
|
|
||
| // NackOptions carries per-message redelivery options for a negative acknowledgement (nack). | ||
| message NackOptions { | ||
| // reason is a human-readable reason for nacking the message. | ||
| optional string reason = 1; | ||
| // max_deliveries is the maximum number of redelivery attempts. | ||
| optional uint32 max_deliveries = 2; | ||
| // delay is the redelivery delay in milliseconds. | ||
| optional uint64 delay = 3; | ||
| // nack_map is a generic map of string key-value pairs used to pass | ||
| // properties/configurations for nacking back to the source (e.g. for | ||
| // sources like SQS, Pulsar or JetStream that support NACK). | ||
| map<string, string> nack_map = 4; | ||
| } | ||
40 changes: 40 additions & 0 deletions
40
packages/pynumaflow/pynumaflow/proto/common/nack_options_pb2.py
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll need generic options here as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reference for the changes: https://github.com/numaproj/numaflow-rs/pull/184/changes#diff-1745643b2a27b90446b957e56e25850c3cf648a9fccc621eaa0c96526858c065