blob: 91f73763b4e6a32f5dea5195ed0d3825bed6fd88 [file] [log] [blame]
E. Scott Daniels392168d2019-11-06 15:12:38 -05001
E. Scott Daniels117030c2020-04-10 17:17:02 -04002
E. Scott Daniels392168d2019-11-06 15:12:38 -05003.. This work is licensed under a Creative Commons Attribution 4.0 International License.
4.. SPDX-License-Identifier: CC-BY-4.0
5.. CAUTION: this document is generated from source in doc/src/rtd.
6.. To make changes edit the source and recompile the document.
7.. Do NOT make changes directly to .rst or .md files.
8
9
E. Scott Daniels117030c2020-04-10 17:17:02 -040010
E. Scott Daniels392168d2019-11-06 15:12:38 -050011RMR Overview
12============================================================================================
13
14
15RMr Library
16============================================================================================
17
18
19NAME
20--------------------------------------------------------------------------------------------
21
22RMr -- Ric Message Router Library
23
24DESCRIPTION
25--------------------------------------------------------------------------------------------
26
27RMr is a library which provides a user application with the
28ability to send and receive messages to/from other RMr based
29applications without having to understand the underlying
Lott, Christopher (cl778h)5157a972020-04-06 20:31:32 -040030messaging transport environment (e.g., SI95) and without
E. Scott Daniels392168d2019-11-06 15:12:38 -050031needing to know which other endpoint applications are
32currently available and accepting messages. To do this, RMr
33depends on a routing table generated by an external source.
34This table is used to determine the destination endpoint of
35each message sent by mapping the message type T (supplied by
36the user application) to an endpoint entry. Once determined,
37the message is sent directly to the endpoint. The user
38application is unaware of which endpoint actually receives
39the message, and in some cases whether that message was sent
40to multiple applications.
41
42RMr functions do provide for the ability to respond to the
43specific source instance of a message allowing for either a
44request response, or call response relationship when needed.
45
46The Route Table
E. Scott Daniels117030c2020-04-10 17:17:02 -040047~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
E. Scott Daniels392168d2019-11-06 15:12:38 -050048
E. Scott Daniels0b79fc22019-12-04 15:20:16 -050049The library must be given a route table which maps message
E. Scott Daniels392168d2019-11-06 15:12:38 -050050numbers to endpoint groups such that each time a message of
51type T is sent, the message is delivered to one member of
52each group associated with T. For example, message type 2
53might route to two different groups where group A consists of
54worker1 and worker2, while group B consists only of logger1.
55
56It is the responsibility of the route table generator to know
57which endpoints belong to which groups, and which groups
58accept which message types. Once understood, the route table
59generator publishes a table that is ingested by RMr and used
60for mapping messages to end points.
61
E. Scott Daniels0b79fc22019-12-04 15:20:16 -050062The following is a simple route table which causes message
63types 0 through 9 to be routed to specific applications:
64
65::
66
67 newrt|start
68 mse|0|-1| %meid
69 mse|1|-1|app10:4560,app11:4560
70 mse|2|-1|app12:4560
71 mse|3|-1|app14:4560
72 mse|4|-1|app18:4560
73 mse|5|-1|app01:4560
74 mse|6|-1|app02:4560
75 mse|7|-1|app03:4560
76 mse|8|-1|app04:4560
77 mse|9|-1|app05:4560
78 newrt|end
79
80
81
82The special endpoint "%meid" indicates that the message type
83(0 in this case) is to be routed to the endpoint which has
84been listed as the "owner" for the meid appearing in the
85message. MEID ownership is communicated to RMR using the same
86Route Table Manager interface and by supplying a "table" such
87as the one below:
88
89::
90
91 meid_map | start
92 mme_ar | control1 | meid000 meid001 meid002 meid003 meid004 meid005
E. Scott Daniels190665f2019-12-09 09:05:22 -050093 mme_ar | control2 | meid100 meid101 meid102 meid103
E. Scott Daniels0b79fc22019-12-04 15:20:16 -050094 meid_map | end | 2
95
96
97This table indicates that the application (endpoint)
98*control1* "owns" 6 MEIDs and *control2* owns 4. When message
99type 0 is sent, the MEID in the message will be used to
100select the endpoint via this table.
101
102The MEID table will update the existing owner relationships,
103and add new ones; it is necessary to send only the changes
104with the add/replace (mme_ar) entries in the table. When
105necessary, MEIDs can be deleted by adding an mme_del record
106to the table. The following example illustrates how this
107might look:
108
109::
110
111 meid_map | start
112 mme_ar | control1 | meid000 meid001 meid002 meid003 meid004 meid005
E. Scott Daniels190665f2019-12-09 09:05:22 -0500113 mme_ar | control2 | meid100 meid101 meid102 meid103
E. Scott Daniels0b79fc22019-12-04 15:20:16 -0500114 mme_del| meid200 meid401
E. Scott Daniels190665f2019-12-09 09:05:22 -0500115 meid_map | end | 3
E. Scott Daniels0b79fc22019-12-04 15:20:16 -0500116
117
118
119Route Table Syntax
E. Scott Daniels117030c2020-04-10 17:17:02 -0400120~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
E. Scott Daniels0b79fc22019-12-04 15:20:16 -0500121
122The following illustrates the syntax for both the route
123table.
124
125
126::
127
128 newrt | start
129 mse | <message-type>[,<sender-endpoint>] | <sub-id> <roud-robin-grp>[;<round-robin-grp>]...
130 newrt | end
131
132
133
134A round robin group is one or more endpoints from which one
135will be selected to receive the message. When multiple
136endpoints are given in a group, they must be separated with a
137comma. An endpoint is the IP address and port (e.g.
138192.158.4.30:8219) or DNS name and port of the application
139that should receive the message type. If multiple round-robin
140groups are given, they must be separated by a semicolon, and
141
142MEID Map Syntax
E. Scott Daniels117030c2020-04-10 17:17:02 -0400143~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
E. Scott Daniels0b79fc22019-12-04 15:20:16 -0500144
145The MEID map is similar to the route table. Entries are used
146to add or replace the ownership of one or more MEIDs (mme_ar)
147or to delete one or more MEIDs (mme_del). The following is
148the syntax for the MEID map.
149
150
151::
152
153 meid_map | start
154 mme_ar | <owner-endpoint> | <meid> [<meid>...]
155 mme_del | <meid> [<meid>...]
E. Scott Daniels190665f2019-12-09 09:05:22 -0500156 meid_map | end | <count> [| <md5sum>
E. Scott Daniels0b79fc22019-12-04 15:20:16 -0500157
158
159
160The <count> on the end record indicates the number of mme_ar
161and mme_del records which were sent; if the count does not
162match the whole map is refused and dropped. The
163<owner-endpoint> is the endpoint which should receive the
164message when a message is routed based on the MEID it
165contains. A MEID may be "owned" by only one endpoint, and if
166supplied multiple times, the last observed relationship is
167used. Each of the lists of MEIDs are blank separated.
168
E. Scott Daniels190665f2019-12-09 09:05:22 -0500169The optional <md5sum> on the *end* record should be the
170computed MD5 hash for all records which appear between the
171start and and records. This allows for a tighter verification
172that all data was received exactly as the route manager
173transmitted them.
174
E. Scott Daniels392168d2019-11-06 15:12:38 -0500175Environment
E. Scott Daniels117030c2020-04-10 17:17:02 -0400176~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
E. Scott Daniels392168d2019-11-06 15:12:38 -0500177
178To enable configuration of the library behaviour outside of
179direct user application control, RMr supports a number of
180environment variables which provide information to the
181library. The following is a list of the various environment
182variables, what they control and the defaults which RMr uses
183if undefined.
184
185
E. Scott Daniels0b79fc22019-12-04 15:20:16 -0500186
E. Scott Daniels392168d2019-11-06 15:12:38 -0500187RMR_ASYNC_CONN
188
E. Scott Daniels4d1f9bf2020-03-06 12:29:28 -0500189 Allows the async connection mode to be turned off (by
Lott, Christopher (cl778h)5157a972020-04-06 20:31:32 -0400190 setting the value to 0). When set to 1, or missing from
191 the environment, RMR will invoke the connection interface
192 in the transport mechanism using the non-blocking (async)
E. Scott Daniels392168d2019-11-06 15:12:38 -0500193 mode. This will likely result in many "soft failures"
194 (retry) until the connection is established, but allows
Lott, Christopher (cl778h)5157a972020-04-06 20:31:32 -0400195 the application to continue unimpeded should the
E. Scott Daniels392168d2019-11-06 15:12:38 -0500196 connection be slow to set up.
E. Scott Daniels4d1f9bf2020-03-06 12:29:28 -0500197
E. Scott Daniels392168d2019-11-06 15:12:38 -0500198
199RMR_BIND_IF
200
E. Scott Daniels4d1f9bf2020-03-06 12:29:28 -0500201 This provides the interface that RMR will bind listen
Lott, Christopher (cl778h)5157a972020-04-06 20:31:32 -0400202 ports to, allowing for a single interface to be used
203 rather than listening across all interfaces. This should
204 be the IP address assigned to the interface that RMR
205 should listen on, and if not defined RMR will listen on
206 all interfaces.
E. Scott Daniels4d1f9bf2020-03-06 12:29:28 -0500207
208
209RMR_CTL_PORT
210
211 This variable defines the port that RMR should open for
212 communications with Route Manager, and other RMR control
213 applications. If not defined, the port 4561 is assumed.
214
215 Previously, the RMR_RTG_SVC (route table generator service
216 port) was used to define this port. However, a future
217 version of Route Manager will require RMR to connect and
218 request tables, thus that variable is now used to supply
Lott, Christopher (cl778h)5157a972020-04-06 20:31:32 -0400219 the Route Manager's well-known address and port.
E. Scott Daniels4d1f9bf2020-03-06 12:29:28 -0500220
Lott, Christopher (cl778h)5157a972020-04-06 20:31:32 -0400221 To maintain backwards compatibility with the older Route
222 Manager versions, the presence of this variable in the
223 environment will shift RMR's behaviour with respect to the
224 default value used when RMR_RTG_SVC is **not** defined.
E. Scott Daniels4d1f9bf2020-03-06 12:29:28 -0500225
226 When RMR_CTL_PORT is **defined:** RMR assumes that Route
227 Manager requires RMR to connect and request table updates
Lott, Christopher (cl778h)5157a972020-04-06 20:31:32 -0400228 is made, and the default well-known address for Route
E. Scott Daniels4d1f9bf2020-03-06 12:29:28 -0500229 manager is used (routemgr:4561).
230
231 When RMR_CTL_PORT is **undefined:** RMR assumes that Route
232 Manager will connect and push table updates, thus the
233 default listen port (4561) is used.
234
235 To avoid any possible misinterpretation and/or incorrect
236 assumptions on the part of RMR, it is recommended that
237 both the RMR_CTL_PORT and RMR_RTG_SVC be defined. In the
238 case where both variables are defined, RMR will behave
239 exactly as is communicated with the variable's values.
240
E. Scott Daniels392168d2019-11-06 15:12:38 -0500241
242RMR_RTG_SVC
243
E. Scott Daniels4d1f9bf2020-03-06 12:29:28 -0500244 The value of this variable depends on the Route Manager in
245 use.
246
247 When the Route Manager is expecting to connect to an xAPP
248 and push route tables, this variable must indicate the
249 port which RMR should use to listen for these connections.
250
251 When the Route Manager is expecting RMR to connect and
252 request a table update during initialisation, the variable
253 should be the host of the Route Manager process.
254
255 The RMR_CTL_PORT variable (added with the support of
256 sending table update requests to Route manager), controls
257 the behaviour if this variable is not set. See the
258 description of that variable for details.
259
260
261RMR_HR_LOG
262
263 By default RMR writes messages to standard error
264 (incorrectly referred to as log messages) in human
265 readable format. If this environment variable is set to 0,
266 the format of standard error messages might be written in
267 some format not easily read by humans. If missing, a value
268 of 1 is assumed.
269
270
271RMR_LOG_VLEVEL
272
273 This is a numeric value which corresponds to the verbosity
274 level used to limit messages written to standard error.
275 The lower the number the less chatty RMR functions are
276 during execution. The following is the current
277 relationship between the value set on this variable and
278 the messages written:
279
280
2810
282
283 Off; no messages of any sort are written.
284
285
2861
287
288 Only critical messages are written (default if this
289 variable does not exist)
290
291
2922
293
294 Errors and all messages written with a lower value.
295
296
2973
298
299 Warnings and all messages written with a lower value.
300
301
3024
303
304 Informational and all messages written with a lower
305 value.
306
307
3085
309
310 Debugging mode -- all messages written, however this
311 requires RMR to have been compiled with debugging
312 support enabled.
313
314
E. Scott Daniels392168d2019-11-06 15:12:38 -0500315
316RMR_RTG_ISRAW
317
E. Scott Daniels4d1f9bf2020-03-06 12:29:28 -0500318 **Deprecated.** Should be set to 1 if the route table
319 generator is sending "plain" messages (not using RMR to
Lott, Christopher (cl778h)5157a972020-04-06 20:31:32 -0400320 send messages), 0 if the RTG is using RMR to send. The
321 default is 1 as we don't expect the RTG to use RMR.
E. Scott Daniels4d1f9bf2020-03-06 12:29:28 -0500322
323 This variable is only recognised when using the NNG
324 transport library as it is not possible to support NNG
325 "raw" communications with other transport libraries. It is
326 also necessary to match the value of this variable with
327 the capabilities of the Route Manager; at some point in
328 the future RMR will assume that all Route Manager messages
329 will arrive via an RMR connection and will ignore this
330 variable.
E. Scott Daniels392168d2019-11-06 15:12:38 -0500331
332RMR_SEED_RT
333
334 This is used to supply a static route table which can be
335 used for debugging, testing, or if no route table
336 generator process is being used to supply the route table.
E. Scott Daniels4d1f9bf2020-03-06 12:29:28 -0500337 If not defined, no static table is used and RMR will not
E. Scott Daniels0b79fc22019-12-04 15:20:16 -0500338 report *ready* until a table is received. The static route
339 table may contain both the route table (between newrt
340 start and end records), and the MEID map (between meid_map
Lott, Christopher (cl778h)5157a972020-04-06 20:31:32 -0400341 start and end records).
E. Scott Daniels392168d2019-11-06 15:12:38 -0500342
343RMR_SRC_ID
344
345 This is either the name or IP address which is placed into
346 outbound messages as the message source. This will used
347 when an RMR based application uses the rmr_rts_msg()
348 function to return a response to the sender. If not
349 supplied RMR will use the hostname which in some container
350 environments might not be routable.
E. Scott Daniels4d1f9bf2020-03-06 12:29:28 -0500351
352 The value of this variable is also used for Route Manager
353 messages which are sent via an RMR connection.
E. Scott Daniels392168d2019-11-06 15:12:38 -0500354
355RMR_VCTL_FILE
356
357 This supplies the name of a verbosity control file. The
358 core RMR functions do not produce messages unless there is
359 a critical failure. However, the route table collection
360 thread, not a part of the main message processing
361 component, can write additional messages to standard
362 error. If this variable is set, RMR will extract the
363 verbosity level for these messages (0 is silent) from the
364 first line of the file. Changes to the file are detected
365 and thus the level can be changed dynamically, however RMR
366 will only suss out this variable during initialisation, so
367 it is impossible to enable verbosity after startup.
368
369RMR_WARNINGS
370
371 If set to 1, RMR will write some warnings which are
372 non-performance impacting. If the variable is not defined,
373 or set to 0, RMR will not write these additional warnings.
374
375
376SEE ALSO
377--------------------------------------------------------------------------------------------
378
379rmr_alloc_msg(3), rmr_tralloc_msg(3), rmr_call(3),
380rmr_free_msg(3), rmr_init(3), rmr_init_trace(3),
381rmr_get_meid(3), rmr_get_src(3), rmr_get_srcip(3),
382rmr_get_trace(3), rmr_get_trlen(3), rmr_get_xact(3),
383rmr_payload_size(3), rmr_rcv_msg(3), rmr_rcv_specific(3),
384rmr_rts_msg(3), rmr_ready(3), rmr_fib(3), rmr_has_str(3),
385rmr_tokenise(3), rmr_mk_ring(3), rmr_realloc_payload(3),
386rmr_ring_free(3), rmr_set_trace(3), rmr_torcv_msg(3),
387rmr_wh_open(3), rmr_wh_send_msg(3)