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

feat: add kafka support #56

Merged
merged 18 commits into from
Oct 19, 2023
Merged

feat: add kafka support #56

merged 18 commits into from
Oct 19, 2023

Conversation

yangxi
Copy link
Contributor

@yangxi yangxi commented Oct 16, 2023

No description provided.

src/pubsub/mod.rs Fixed Show resolved Hide resolved
src/pubsub/mod.rs Fixed Show fixed Hide fixed
src/pubsub/mod.rs Fixed Show fixed Hide fixed
src/pubsub/mod.rs Fixed Show fixed Hide fixed
src/pubsub/mod.rs Fixed Show fixed Hide fixed
src/pubsub/mod.rs Fixed Show fixed Hide fixed
src/pubsub/mod.rs Fixed Show fixed Hide fixed
src/pubsub/mod.rs Fixed Show fixed Hide fixed
src/clients/mod.rs Outdated Show resolved Hide resolved
src/pubsub/mod.rs Fixed Show resolved Hide resolved
src/pubsub/momento.rs Outdated Show resolved Hide resolved
Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

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

clippy found more than 10 potential problems in the proposed changes. Check the Files changed tab for more details.

src/workload/mod.rs Outdated Show resolved Hide resolved
src/workload/mod.rs Outdated Show resolved Hide resolved
src/config/workload.rs Outdated Show resolved Hide resolved
src/metrics/mod.rs Outdated Show resolved Hide resolved
src/output/mod.rs Outdated Show resolved Hide resolved
src/pubsub/kafka.rs Outdated Show resolved Hide resolved
src/pubsub/kafka.rs Outdated Show resolved Hide resolved
src/pubsub/kafka.rs Outdated Show resolved Hide resolved
src/pubsub/kafka.rs Outdated Show resolved Hide resolved
src/pubsub/kafka.rs Outdated Show resolved Hide resolved
src/pubsub/kafka.rs Outdated Show resolved Hide resolved
src/pubsub/mod.rs Outdated Show resolved Hide resolved
src/pubsub/mod.rs Outdated Show resolved Hide resolved
src/pubsub/mod.rs Outdated Show resolved Hide resolved
@brayniac
Copy link
Contributor

brayniac commented Oct 18, 2023 via email

src/pubsub/mod.rs Fixed Show fixed Hide fixed
src/pubsub/mod.rs Fixed Show fixed Hide fixed
src/pubsub/mod.rs Fixed Show fixed Hide fixed
src/pubsub/mod.rs Fixed Show fixed Hide fixed
src/pubsub/mod.rs Fixed Show fixed Hide fixed
src/pubsub/mod.rs Fixed Show fixed Hide fixed
src/pubsub/mod.rs Fixed Show fixed Hide fixed
src/pubsub/mod.rs Fixed Show fixed Hide fixed
src/pubsub/mod.rs Fixed Show fixed Hide fixed
src/pubsub/mod.rs Fixed Show resolved Hide resolved
mod momento;

struct MessageStamp {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we call this a message validator?

src/pubsub/mod.rs Fixed Show resolved Hide resolved
}
}

pub fn create_topics(runtime: &mut Runtime, config: Config, workload_components: &Vec<Component>) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please make this &[Component]

@@ -4,6 +4,10 @@ fn one() -> usize {
1
}

fn empty_names() -> Vec<String> {
Copy link
Contributor

Choose a reason for hiding this comment

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

This isn't necessary

topic_len: usize,
#[serde(default = "empty_names")]
Copy link
Contributor

Choose a reason for hiding this comment

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

Just #[serde(default)] does what you want

Ok(m) => match m.payload_view::<[u8]>() {
Some(Ok(m)) => {
let mut v = Vec::new();
v.extend_from_slice(m);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you can just do let mut v = m.to_owned();

@@ -29,9 +100,20 @@ pub fn launch_pubsub(
work_receiver: Receiver<WorkItem>,
workload_components: Vec<Component>,
) -> PubsubRuntimes {
if config.pubsub().is_some() {
if let Protocol::Kafka = config.general().protocol() {
let mut topic_rt = Builder::new_multi_thread()
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add some comment here explaining why we need an additional Tokio runtime for this. I'm unclear why we wouldn't handle this differently

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I moved kafka::create_topics to lauch_publishers, so it reuses the publisher_rt to create the topics.

Copy link
Contributor

@brayniac brayniac left a comment

Choose a reason for hiding this comment

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

Still requires some changes. Please address the clippy lints and my comments

@brayniac brayniac changed the title WIP: Kafka Client feat: add kafka support Oct 19, 2023
@brayniac brayniac merged commit 64f8104 into iopsystems:main Oct 19, 2023
12 checks passed
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.

2 participants