Routing Table Configuration

May 20, 2026 ยท View on GitHub

The routingTable.conf file defines the rules and logic for how messages are evaluated and dispatched to different workers or routing chains. It uses a custom, colon-separated syntax grouped into routing tables (chains).

๐Ÿ—‚๏ธ File Structure & Tables

Routing logic is organized into Routing Tables.

  • Tables are defined by enclosing their name in square brackets, such as [default].
  • If a table name is not explicitly defined at the top of the file, rules are automatically assigned to the [default] table.
  • Empty lines are safely ignored.
  • Lines starting with # are treated as comments. Note that the parser actually captures these comments and uses them as descriptive labels for the immediately following table or rule.

๐Ÿ“ Routing Rules Syntax

Inside each table, routing rules are evaluated top-to-bottom. Every rule MUST follow a strict four-part, colon-separated format:

Target:Attribute:Operator:Value

ComponentDescriptionExample
TargetWhere to send the message if the rule matches. This can be the name of a specific worker instance (e.g., testRoute1, smppserver.smpp) or the name of another routing table to evaluate (e.g., MESSAGE).testRoute1
AttributeThe property of the message you want to check.type, owner_id, from, to, body, product
OperatorThe logical operator used to compare the attribute against the value.==, equals, default etc.
ValueThe specific value to match.0, 123, SenderX

๐Ÿงฎ Available Operators

The routing engine supports a wide array of operators to evaluate message attributes.

Negation (!): Any operator can be negated by prefixing it with an exclamation mark ! (e.g., !equals, !startsWith, !==).

The Default Operator

  • default: Always matches. Used as a fallback/catch-all rule at the end of a routing table. (Attribute and Value can be left blank).

String Operators

Used for standard text comparisons:

  • equals: Exact string match.
  • equalsIgnoreCase: Case-insensitive string match.
  • matches: Evaluates the value as a Regular Expression (Regex).
  • startsWith: Checks if the attribute starts with the given value.
  • endsWith: Checks if the attribute ends with the given value.
  • greaterThan, greaterEqual, lessThan, lessEqual: Alphabetical/lexicographical string comparisons.
  • isNull: Checks if the attribute is null (requires no value).

Boolean Operators

  • isTrue: Checks if the attribute evaluates to true.
  • isFalse: Checks if the attribute evaluates to false.

Numeric Operators (Typed)

  • Integer: ==, >, >=, <, <=

โœ‰๏ธ Message Type Reference

When writing rules that evaluate the type attribute (e.g., MESSAGE:type:==:0), use the following integer constants to represent different message formats:

Integer ValueMessage TypeConstant Name
0Standard Text SMSMSG_TEXT
10Binary SMSMSG_BINARY
11UCS-2 (Unicode) SMSMSG_UCS2
14Flash SMSMSG_FLASH
17Push SMSMSG_PUSH
18Delivery Receipt (DLR)MSG_DLR

๐Ÿ“– Example Walkthrough

Let's break down a complete routingTable.conf example:

[default]
MESSAGE:type:==:0
MESSAGE:type:==:11
MESSAGE:type:==:10
smppserver.smpp:type:==:18

[MESSAGE]
testRoute2:owner_id:equals:123
testRoute1:from:equals:SenderX
testRoute::default:

1. The [default] Table

This is the entry point for incoming messages.

  • MESSAGE:type:==:0: If the message is a standard text SMS (type 0), forward it to the [MESSAGE] routing table for further evaluation.
  • MESSAGE:type:==:11: If the message is UCS-2 (type 11), forward it to the [MESSAGE] table.
  • MESSAGE:type:==:10: If the message is binary (type 10), forward it to the [MESSAGE] table.
  • smppserver.smpp:type:==:18: If the message is a Delivery Receipt (type 18), route it directly to the smppserver.smpp worker instance.

2. The [MESSAGE] Table

Messages that get passed here from the [default] table are evaluated against these secondary rules.

  • testRoute2:owner_id:equals:123: If the message belongs to account ID 123, route it to the testRoute2 SMPP client.
  • testRoute1:from:equals:SenderX: If the sender ID (from address) is exactly SenderX, route it to the testRoute1 SMPP client.
  • testRoute::default:: If none of the above conditions match, this catch-all rule routes the message to the testRoute SMPP client.