1.. zephyr:code-sample:: zbus-confirmed-channel
2   :name: Confirmed channel
3   :relevant-api: zbus_apis
4
5   Use confirmed zbus channels to ensure all subscribers consume a message.
6
7Overview
8********
9This sample implements a simple way of using confirmed channels in zbus.
10The confirmed channel can only be published when all the subscribers consume the message.
11
12Building and Running
13********************
14
15This project outputs to the console.  It can be built and executed
16on QEMU as follows:
17
18.. zephyr-app-commands::
19   :zephyr-app: samples/subsys/zbus/confirmed_channel
20   :host-os: unix
21   :board: qemu_x86
22   :goals: run
23
24Sample Output
25=============
26
27.. code-block:: console
28
29   I: From listener -> Confirmed message payload = 0
30   I: From bar_sub2 subscriber -> Confirmed message payload = 0
31   I: From bar_sub1 subscriber -> Confirmed message payload = 0
32   I: From bar_sub3 subscriber -> Confirmed message payload = 0
33   I: From listener -> Confirmed message payload = 1
34   I: From bar_sub2 subscriber -> Confirmed message payload = 1
35   I: From bar_sub1 subscriber -> Confirmed message payload = 1
36   I: From bar_sub3 subscriber -> Confirmed message payload = 1
37   I: From listener -> Confirmed message payload = 2
38   I: From bar_sub2 subscriber -> Confirmed message payload = 2
39   I: From bar_sub1 subscriber -> Confirmed message payload = 2
40   I: From bar_sub3 subscriber -> Confirmed message payload = 2
41   I: From listener -> Confirmed message payload = 3
42   I: From bar_sub2 subscriber -> Confirmed message payload = 3
43   I: From bar_sub1 subscriber -> Confirmed message payload = 3
44   I: From bar_sub3 subscriber -> Confirmed message payload = 3
45   <continues>
46
47Exit QEMU by pressing :kbd:`CTRL+A` :kbd:`x`.
48