eclipse-uprotocol / up-streamer-rust

Generic uStreamer implementation written in Rust
Apache License 2.0
1 stars 13 forks source link

[#49] Add uSubscription Requests to Streamer #49

Open matthewd0123 opened 3 months ago

matthewd0123 commented 3 months ago

Implements [#36]

PLeVasseur commented 2 months ago

Reminder to self that I'm waiting on feedback from @stevenhartley.

Posting here as well, maybe it'll get answered here (which is better I suppose so all can learn :slightly_smiling_face:)

So I wanted to make sure I got this, because I think I didn't before.

Would a uE that wants to subscribe, based on this uP-L2 API in up-rust: https://github.com/eclipse-uprotocol/up-rust/blob/8fc85aeb8143be06b46c2925834b063249c5fd23/src/communication/default_pubsub.rs#L291 actually pass in a client object that uses the same USubscription trait: https://github.com/eclipse-uprotocol/up-rust/blob/8fc85aeb8143be06b46c2925834b063249c5fd23/src/core/usubscription.rs#L163 as was used in the uSubscription library Daniel wrote, but tailored to actually send the various .proto objects such as NotificationsRequest: https://github.com/eclipse-uprotocol/up-spec/blob/da5ca97d3a7541d2fcd52ed010bc3bcca92e46cb/up-core-api/uprotocol/core/usubscription/v3/usubscription.proto#L280-L291 to the uSubscription service, over the host transport?

stevenhartley commented 2 months ago

@PLeVasseur best example for the USubscription client side library (API) they would call https://github.com/eclipse-uprotocol/up-java/blob/main/src/main/java/org/eclipse/uprotocol/client/usubscription/v3/USubscriptionClient.java that is implemented in https://github.com/eclipse-uprotocol/up-java/blob/main/src/main/java/org/eclipse/uprotocol/client/usubscription/v3/InMemoryUSubscriptionClient.java. the client side library sends the command to the USubscription service, registers a listener (to receive published events) and registers a SubscriptionChangeHandler that can process for the client the subscription state changes. The implementation sits on top of L2 APIs of RpcClient and Notifier.

PLeVasseur commented 2 months ago

Huh, I really have been buried under implementation work. Missed that @sophokles73 implemented the USubscription client over in up-rust.

That appears to do all the same sorts of things you've just described.

So then if I understand this correctly, then broadly speaking we should expect we'll get handed a USubscription trait implementation in order to interact through to the uSubscription service within the uStreamer, right?