-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathREADME.md
163 lines (108 loc) · 3.34 KB
/
README.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# Zenoh Python Examples
## Get Started
```bash
python3 <example.py>
```
Each example accepts the `-h` or `--help` option that provides a description of its arguments and their default values.
If you run the tests against the zenoh router running in a Docker container, you need to add the
`-e tcp/localhost:7447` option to your examples. That's because Docker doesn't support UDP multicast
transport, and therefore the zenoh scouting and discrovery mechanism cannot work with.
## Examples description
### z_scout
Scouts for zenoh peers and routers available on the network.
Typical usage:
```bash
python3 z_scout.py
```
### z_info
Gets information about the Zenoh session.
Typical usage:
```bash
python3 z_info.py
```
### z_put
Puts a path/payload into Zenoh.
The path/payload will be received by all matching subscribers, for instance the [z_sub](#z_sub)
and [z_storage](#z_storage) examples.
Typical usage:
```bash
python3 z_put.py
```
or
```bash
python3 z_put.py -k demo/example/test -v 'Hello World'
```
### z_pub
Declares a resource with a path and a publisher on this resource. Then puts a payload using the numerical resource id.
The path/payload will be received by all matching subscribers, for instance the [z_sub](#z_sub)
and [z_storage](#z_storage) examples.
Typical usage:
```bash
python3 z_pub.py
```
or
```bash
python3 z_pub.py -k demo/example/test -v 'Hello World'
```
### z_sub
Creates a subscriber with a key expression.
The subscriber will be notified of each put made on any key expression matching
the subscriber's key expression, and will print this notification.
Typical usage:
```bash
python3 z_sub.py
```
or
```bash
python3 z_sub.py -k 'demo/**'
```
### z_get
Sends a query message for a selector.
The queryables with a matching path or selector (for instance [z_queryable](#z_queryable) and [z_storage](#z_storage))
will receive this query and reply with paths/payloads that will be received by the query callback.
Typical usage:
```bash
python3 z_get.py
```
or
```bash
python3 z_get.py -s 'demo/**'
```
### z_queryable
Creates a queryable function with a key expression.
This queryable function will be triggered by each call to a get operation on zenoh
with a selector that matches the key expression, and will return a payload to the querier.
Typical usage:
```bash
python3 z_queryable.py
```
or
```bash
python3 z_queryable.py -k demo/example/queryable -v 'This is the result'
```
### z_storage
Trivial implementation of a storage in memory.
This examples creates a subscriber and a queryable on the same key expression.
The subscriber callback will store the received key/values in an hashmap.
The queryable callback will answer to queries with the key/values stored in the hashmap
and that match the queried selector.
Typical usage:
```bash
python3 z_storage.py
```
or
```bash
python3 z_storage.py -k 'demo/**'
```
### z_pub_thr & z_sub_thr
Pub/Sub throughput test.
This example allows to perform throughput measurements between a pubisher performing
put operations and a subscriber receiving notifications of those puts.
Typical Subscriber usage:
```bash
python3 z_sub_thr.py
```
Typical Publisher usage:
```bash
python3 z_pub_thr.py 1024
```