-
Notifications
You must be signed in to change notification settings - Fork 18
feat(mq): add RocksMQ input/output stub (config + protocol placeholder) #217
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
Closed
Closed
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 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 |
|---|---|---|
|
|
@@ -11,3 +11,4 @@ | |
| // limitations under the License. | ||
|
|
||
| pub mod kafka; | ||
| pub mod rocksmq; | ||
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,43 @@ | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| //! RocksMQ input config. | ||
| //! | ||
| //! RocksMQ is an embedded message queue (e.g. used by Milvus). There is no | ||
| //! standalone Rust client at present; this is a stub. Replace with a real | ||
| //! implementation when a client (e.g. Milvus gRPC or native crate) is available. | ||
|
|
||
| use std::collections::HashMap; | ||
|
|
||
| #[derive(Debug, Clone)] | ||
| pub struct RocksMQConfig { | ||
| pub path: String, | ||
| pub topic: String, | ||
| pub consumer_id: Option<String>, | ||
| pub properties: HashMap<String, String>, | ||
| } | ||
|
|
||
| impl RocksMQConfig { | ||
| pub fn new( | ||
| path: String, | ||
| topic: String, | ||
| consumer_id: Option<String>, | ||
| properties: HashMap<String, String>, | ||
| ) -> Self { | ||
| Self { | ||
| path, | ||
| topic, | ||
| consumer_id, | ||
| properties, | ||
| } | ||
| } | ||
| } |
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 @@ | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| pub mod config; | ||
| pub mod rocksmq_protocol; | ||
|
|
||
| pub use config::RocksMQConfig; | ||
| pub use rocksmq_protocol::RocksMQProtocol; |
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,51 @@ | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| //! RocksMQ input protocol (stub). | ||
| //! | ||
| //! RocksMQ (e.g. Milvus) has no official Rust client. This stub implements | ||
| //! InputProtocol but poll() always returns Ok(None). Replace with a real | ||
| //! consumer when a client is available (e.g. Milvus gRPC or future crate). | ||
|
|
||
| use super::config::RocksMQConfig; | ||
| use crate::runtime::buffer_and_event::BufferOrEvent; | ||
| use crate::runtime::input::input_protocol::InputProtocol; | ||
| use std::time::Duration; | ||
|
|
||
| pub struct RocksMQProtocol { | ||
| config: RocksMQConfig, | ||
| } | ||
|
|
||
| impl RocksMQProtocol { | ||
| pub fn new(config: RocksMQConfig) -> Self { | ||
| Self { config } | ||
| } | ||
| } | ||
|
|
||
| impl InputProtocol for RocksMQProtocol { | ||
| fn name(&self) -> String { | ||
| format!("rocksmq-{}", self.config.topic) | ||
| } | ||
|
|
||
| fn init(&self) -> Result<(), Box<dyn std::error::Error + Send>> { | ||
| // Stub: no-op until a real RocksMQ client is integrated. | ||
| Ok(()) | ||
| } | ||
|
|
||
| fn poll( | ||
| &self, | ||
| _timeout: Duration, | ||
| ) -> Result<Option<BufferOrEvent>, Box<dyn std::error::Error + Send>> { | ||
| // Stub: always no message. Replace with real RocksMQ consumer when available. | ||
| Ok(None) | ||
| } | ||
| } |
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 |
|---|---|---|
|
|
@@ -15,3 +15,4 @@ | |
| // Provides implementations of various output protocols | ||
|
|
||
| pub mod kafka; | ||
| pub mod rocksmq; | ||
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 @@ | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| pub mod producer_config; | ||
| pub mod rocksmq_protocol; | ||
|
|
||
| pub use producer_config::RocksMQProducerConfig; | ||
| pub use rocksmq_protocol::RocksMQOutputProtocol; |
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,32 @@ | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| //! RocksMQ producer config (stub). Replace with real client config when available. | ||
|
|
||
| use std::collections::HashMap; | ||
|
|
||
| #[derive(Debug, Clone)] | ||
| pub struct RocksMQProducerConfig { | ||
| pub path: String, | ||
| pub topic: String, | ||
| pub properties: HashMap<String, String>, | ||
| } | ||
|
|
||
| impl RocksMQProducerConfig { | ||
| pub fn new(path: String, topic: String, properties: HashMap<String, String>) -> Self { | ||
| Self { | ||
| path, | ||
| topic, | ||
| properties, | ||
| } | ||
| } | ||
| } |
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,49 @@ | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| //! RocksMQ output protocol (stub). | ||
| //! | ||
| //! RocksMQ has no official Rust client. This stub implements OutputProtocol | ||
| //! but send() is a no-op. Replace with a real producer when a client is available. | ||
|
|
||
| use super::producer_config::RocksMQProducerConfig; | ||
| use crate::runtime::buffer_and_event::BufferOrEvent; | ||
| use crate::runtime::output::output_protocol::OutputProtocol; | ||
|
|
||
| pub struct RocksMQOutputProtocol { | ||
| config: RocksMQProducerConfig, | ||
| } | ||
|
|
||
| impl RocksMQOutputProtocol { | ||
| pub fn new(config: RocksMQProducerConfig) -> Self { | ||
| Self { config } | ||
| } | ||
| } | ||
|
|
||
| impl OutputProtocol for RocksMQOutputProtocol { | ||
| fn name(&self) -> String { | ||
| format!("rocksmq-{}", self.config.topic) | ||
| } | ||
|
|
||
| fn init(&self) -> Result<(), Box<dyn std::error::Error + Send>> { | ||
| Ok(()) | ||
| } | ||
|
|
||
| fn send(&self, _data: BufferOrEvent) -> Result<(), Box<dyn std::error::Error + Send>> { | ||
| // Stub: no-op until a real RocksMQ producer is integrated. | ||
| Ok(()) | ||
| } | ||
|
|
||
| fn flush(&self) -> Result<(), Box<dyn std::error::Error + Send>> { | ||
| Ok(()) | ||
| } | ||
| } |
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
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.
Serde tag and
input_type/output_typevalue mismatchHigh Severity
The
RocksMQvariant on an enum with#[serde(rename_all = "kebab-case")]produces a serde tag value like"rocks-m-q"(serde inserts a hyphen before each uppercase letter). Butinput_type()returns"rocksmq"andoutput_type()returns"rocksmq". The validation inInputGroup::from_yaml_valueandWasmTaskConfig::from_yaml_valuecompares the raw YAML tag against these method return values, so it will always fail with a type mismatch error for RocksMQ configs. Either add#[serde(rename = "rocksmq")]to theRocksMQvariants, or change the return values ofinput_type()andoutput_type()to match the serde-generated tag.Additional Locations (1)
src/runtime/task/processor_config.rs#L571-L572