Routing Codes
Routing codes are an optional feature in Janus that allow clients to influence how session events are processed/routed downstream by providing a three-character routingCode in the Session creation request. Then, clients are able to implement custom routing logic in their own systems or in MHS-managed workflows.
Why Use Routing Codes?
- Identify the origin of a session (e.g., region, tenant, or workflow)
- Route events to specific servers or pipelines.
- Example 1: In Production, a client has a server in the United States and another in Europe. All events are sent to the same production web-hook. But, the Routing Code may be used to redirect the event to the correct server in the correct region. There is no limit to the number of servers and regions that a client can operate in, so the solution scales well.
- Example 2: In lower environments, a client has the following servers... Dev, QA, UAT, and Staging. With a single Development web-hook the Routing Code may be used to redirect the event to the correct environment. Since different clients have any number of lower environments, this saves clients from having to create additional web-hooks, and reduces complexity by limiting the amount of environment configurations hosted by MHS.
How It Works
- Client defines a 3-letter routing code when creating a Session.
Example: "FRA" for France, "CAN" for Canada. However, any 3-character alphanumeric value may be submitted. - A sessionID UUID is randomly generated for that Session.
Example UUID: 793a5ff2-f7e5-4dd3-9e64-77fdada25659 - Each routing code character is converted to its hexadecimal ASCII representation.
F → 0x46
R → 0x52
A → 0x41
Routing Code → "465241" for code "FRA" - These generated characters replace the last 6 hex characters of the generated sessionID UUID.
Original UUID: 793a5ff2-f7e5-4dd3-9e64-77fdada25659
Encoded Session ID: 793a5ff2-f7e5-4dd3-9e64-77fdad465241 - Janus returns this sessionID in the subject line of public Events. Clients can decode the last 6 characters to retrieve the original routing code. This is secure because the client defines the code (it doesn't need to match a pre-defined list) and it contains no PII/PHI.