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

publisher and subscriber support callback #554

Open
owny990312 opened this issue Dec 19, 2024 · 2 comments
Open

publisher and subscriber support callback #554

owny990312 opened this issue Dec 19, 2024 · 2 comments

Comments

@owny990312
Copy link

when I use publisher and subscriber demo,I find it use polling, Is there an event-driven subscription mechanism like iceoryx1 to reduce system load?

@owny990312
Copy link
Author

when I use publisher and subscriber demo,I find it use polling, Is there an event-driven subscription mechanism like iceoryx1 to reduce system load?当我使用发布者和订阅者示例时,我发现它使用了轮询。是否有类似于 iceoryx1 的事件驱动订阅机制以减少系统负载?

and what is the difference between pub/sub and listen/notify

@elfenpiff
Copy link
Contributor

@owny990312

and what is the difference between pub/sub and listen/notify

  • pub/sub sends the actual payload like the sensor data in an unidirectional way, meaning always from publisher to subscriber
  • events are used to exchange notifications between processes and shall be used to wake up other processes whenever something interesting has happened. the events have an id (u32) to distinguish them. One process can wait either on one listener, or multiple listener and file descriptors (waitset: https://github.com/eclipse-iceoryx/iceoryx2/tree/main/examples/rust/event_multiplexing) until an event arrives. The event will then wake up the process and inform it on what channel what event id arrived.

So the normal workflow looks like:

  1. One process processes a specific work load, maybe sends multiple samples via multiple publishers to many processes.
  2. When the process is finished it can emit an event via the notifier to wake up the other processes that are waiting on the waitset or listener to inform them that they can now process their work.

The decoupling of pub/sub and event in iceoryx2 has now the advantage that the user can define and emit any kind of custom event. In classic iceoryx there was only one event: HAS_DATA_RECEIVED (or something like this) which was always emitted implicitly by the publisher whenever a sample was sent. In iceoryx2 you have now the total freedom - you can emit the event only on fridays when the sky is blue, or when publisher A has sent 2 samples and publisher B 5.

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

No branches or pull requests

2 participants