You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/pubsub.rst
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,18 +2,18 @@
2
2
3
3
<br />
4
4
5
-
PubSub interface
6
-
================
5
+
PubSub
6
+
======
7
7
8
-
PubSub concept
9
-
--------------
8
+
Concepts
9
+
--------
10
10
11
11
Those unfamiliar with actor like messaging, may wonder what a pubsub messaging is. |br|
12
12
PubSub (Publisher-Subscriber) messaging is much like a producer/consumer architecture: an entity registers a "topic" on which it will send messages. |br|
13
13
Other entities can then subscribe to the topic to receive those messages. |br|
14
14
15
-
PubSub implementation
16
-
---------------------
15
+
Implementation
16
+
--------------
17
17
18
18
Since libmodule 2.1, pubsub implementation is async and makes use of unix pipes. |br|
19
19
When sending a message to other modules, a pubsub message is allocated and its address is written in recipient module's writable end of pipe. |br|
@@ -23,15 +23,15 @@ Since libmodule 4.0.0, module_tell() makes use of module references: it means re
23
23
Note that you cannot call any function on a module's reference as you cannot impersonate another module. |br|
24
24
Only module_is(), module_get_name/context() functions can be called passing as self_t handler a module's reference.
25
25
26
-
PubSub system messages
27
-
----------------------
26
+
System messages
27
+
---------------
28
28
29
29
Beside USER messages (pubsub_msg_t.type), there are 4 system messages, with type respectively: LOOP_STARTED, LOOP_STOPPED, TOPIC_REGISTERED, TOPIC_DEREGISTERED. |br|
30
30
These pubsub messages are automatically sent by libmodule (note that sender will be NULL) when matching functions are called. |br|
31
31
For example, you can use TOPIC_REGISTERED message (note that pubsub_msg_t.topic will be valued matching newly created topic) to subscribe to a topic as soon as it appears in current context.
32
32
33
-
PubSub notes
34
-
------------
33
+
Notes
34
+
-----
35
35
36
36
Note that a context must be looping to receive any pubsub message. |br|
37
37
Moreover, when a context stops looping, all pubsub messages will be flushed and thus delivered to each RUNNING module. |br|
0 commit comments