Skip to content
This repository was archived by the owner on Dec 18, 2024. It is now read-only.

Subscribe/Unsubscribe for Python Client #269

Conversation

nayakned
Copy link
Contributor

@nayakned nayakned commented Apr 23, 2022

  • Implemented the unsubscribe call in init.py
  • Implemented subscribe and unsubscribe in the interactive client. To test execute the client and after authorization execute "subscribe Vehicle.Speed". Subsequently execute the command (e.g. tail -f /log_Vehicle.OBD.EngineLoad_1650736673.377693) printed on the client in another terminal instance.

Signed-off-by: nayakned naresh.nayak@de.bosch.com

…w invoke subscribe and unsubscribe as well.

Signed-off-by: nayakned <naresh.nayak@de.bosch.com>
Signed-off-by: Naresh Nayak <naresh.nayak@de.bosch.com>
self.subscribeFileDesc[args.Path] = open(fileName, "w")
self.subscribeIdToPath[resJson["subscriptionId"]] = args.Path
print("Subscription log available at " + fileName)
print("Execute tail -f " + fileName + " on another Terminal instance")
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible to ASK first, whether to open an xterm? Because often there might not be an X system on the system, and this would fail

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ofcourse we can add a flag for the user to use (or not use) xterm.

Currently it would fail rather silently.
image
If you like, we can even redirect the stderr of the subprocess to avoid this.
This way user would not see this at all. The client would use xterm if it is available. Else the user needs to execute the corresponding tail command.

What would be a better solution?

- Checking existence of xterm before starting it in case of a subscribe.
- Checks for subscription ID before unsubscribing

Signed-off-by: nayakned <naresh.nayak@de.bosch.com>
@nayakned
Copy link
Contributor Author

nayakned commented May 5, 2022

The commit 44ebac0 fixes the issues on subscribing on machines without xterm and also the exceptions thrown when incorrect subscription ids are passed.

Signed-off-by: nayakned <naresh.nayak@de.bosch.com>
@SebastianSchildt SebastianSchildt merged commit bf6f492 into eclipse-archived:master May 7, 2022
@nayakned nayakned deleted the python_client_sub_unsub branch May 9, 2022 07:28
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants