eclipse-iceoryx / iceoryx2

Eclipse iceoryx2™ - true zero-copy inter-process-communication in pure Rust
https://iceoryx.io
Apache License 2.0
1.03k stars 40 forks source link

In the C++ interface, can the subscriber receive and process the received message by setting a callback function? #520

Open xfsaid opened 14 hours ago

xfsaid commented 14 hours ago

Currently, subscribers can only obtain messages by calling receive(). Is it necessary to use the Listener and Notifier of the Event module to complete this function?

elBoberido commented 13 hours ago

@xfsaid yes, events are required to achieve this functionality. The listener is the most simple approach and for more complex scenarios, the waitset can be used for event multiplexing. On the producer side, a notifier needs to signal that new data is available. Please have a look at the examples for more details.

In the future there might be an additional, more high level API for generic use cases which does a few things implicitely, like notify on each send. This comes with a cost though, since the pure data transport does not require a context switch but the signaling mechanism does. By having that functionality split into two distict messaging pattern, the user has the option to get the most performance out of iceoryx2.