-
Notifications
You must be signed in to change notification settings - Fork 174
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
add queue subscriber and unit test #388
Merged
Merged
Changes from all commits
Commits
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 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 |
---|---|---|
@@ -1,4 +1,3 @@ | ||
use bytes::Bytes; | ||
use futures_util::StreamExt; | ||
use std::error::Error; | ||
use std::time::Instant; | ||
|
This file contains 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 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
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.
I didn't want to stray from your existing conventions, but it would be slightly more ergonomic for the signature of subscribe to be
fn subscribe<T:ToString>(&self, subject: T)
and for queue_subscribe to be
fn queue_subscribe<T1:ToString,T2:ToString>(&self, subject: T1, queue_group: T2)
Or, if they are to be unified into a single subscribe function, then
fn subscribe<T1:ToString,T2:ToString>(&self, subject: T1, queue_group: Option<T2>)
If you're ok with either of those, I can also implement it on the next commit.
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.
ToString
allocates, even if you passString
.Into<String>
is a better option here, though we decided to NOT have that right now, as we might addSubject
type later, which would break API.We refrained from having those helpers to allow ourselves to decide later.
Both @caspervonb and I want to be very clear in the codebase - especially in
publish
which can happen thousands of times per second - what is allocated etc.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.
I'm hesitant towards doing this because the
ToString
implementation for String is a deep clone, it could beInto<String>
which should be a move but personally I'm more for explicit conversions than implicit ones as the caller is in control of how the conversion happens.We're considering if we want a (potentially interned) type for
Subject
s, header names will likely get one in the form ofHeaderName
s from the http crate's API.I'd say hold off on this for now, at-least until the subject-type matter is resolved.
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.
Short notice: So far #222 is ready for review and completely integrated the
Subject
type and aAsSubject
trait into the old code base. It may went unnoticed with all the async rewriting process.