Bridge Relay (Edge)
The WAMP procedures for managing bridge relays (Bondy Edge connections) at runtime — adding, removing, starting, stopping, and checking the status of a bridge. For what a bridge relay is, why it's distinct from clustering, and what syncs (and what does not sync) when one connects, see Bondy Edge (Bridge Relay).
Types
input_data()
A Bridge Relay object configuration has the following properties:
nameThe name to be use as unique identifier for the bridge.
enabledWhether the bridge is enabled.
falseendpointThe IP Address or Hostname and port e.g myhost:9075
transportThe connection transport. The allowed values are: tls and tcp.
tls_optsClient certificate.
socket_optsSocket options.
parallelismParallelism.
1restartDefines when the supervisor restarts a terminated bridge. The allowed values are: permanent and transient.
- A
permanentbridge is always restarted, even after recovering from a Bondy node crash or when the node is manually stopped and re-started. Bondy persists the configuration of permanent bridges in the database and reads them during startup. - A
transientbridge is restarted only if it terminated abnormally. A node crash, or a manual stop and restart of the node, does not restart it.
idle_timeoutTime in milliseconds that Bondy will allow for a connection with no activity to be kept alive. Bondy will close the connection after this time.
hibernateAllowed values: never, idle and always.
connect_timeoutTCP connection timeout in milliseconds.
network_timeoutTime in milliseconds that Bondy will wait for a network connected event. When a connection is dropped, Bondy Bridge Relay connection will wait for the host to have at least one non-loopback network interface address to be available before starting a connection retry.
This is mainly to avoid logging failed connection attempts when Bondy knows there is no network interface address available.
max_frame_sizeThe maximum frame size in bytes, or infinity.
reconnectEnables or disables the reconnect feature. Once a connection is established but fails due to an unknown error or by the connecting being aborted by the remote with an error that is recoverable, we might want to ask Bondy to retry the connection e.g. when connecting with realm A the remote aborts the connection with reason no_such_realm, in this case maybe the realm has not yet been provisioned, so we want the connection to retry indefinitely. When reconnect is disabled, or when Bondy does not retry the connect error, the bridge stops and stays stopped until a call to bondy.router.bridge.start.
pingrealmsThe list of realm bridging configuration
Procedures
The following WAMP procedures add, start, stop, inspect and remove bridge relays.
AUTHORIZATION
Only a session attached to the master realm (com.leapsight.bondy) can call these procedures. A session in any other realm gets wamp.error.not_authorized.
Bondy also reserves bondy.router.bridge.update, but does not implement it. A call to it fails with wamp.error.no_such_procedure. To change a bridge, remove it and add it again.
| Name | URI |
|---|---|
| Add a bridge | bondy.router.bridge.add |
| Remove a bridge | bondy.router.bridge.remove |
| Start a bridge | bondy.router.bridge.start |
| Stop a bridge | bondy.router.bridge.stop |
| Retrieve a bridge | bondy.router.bridge.get |
| List all bridges | bondy.router.bridge.list |
| Check status of a bridge | bondy.router.bridge.status |
| Check spec of a bridge | bondy.router.bridge.check_spec |
Add a bridge
bondy.router.bridge.add(input_data()) -> bridge()
Adds a Bridge Relay specification and optionally starts the bridge.
Call
Positional Args
0The bridge relay configuration data
Keyword Args
autostartIf true, Bondy starts the bridge at once. If false, start the bridge with bondy.router.bridge.start. Defaults to false.
dry_runIf true, Bondy validates the specification and checks that the name is free, but does not add or start the bridge. The result is an object with dry_run (true), would (a sentence that names the action) and bridge (the parsed specification). Defaults to false.
Result
Positional Results
0The bridge relay object.
Keyword Results
None.
Errors
- bondy.error.already_exists: when the provided bridge name already exists.
- The validation errors of
bondy.router.bridge.check_spec: when the specification is not valid.
Example
./wick --url ws://localhost:19080/ws \
--realm com.leapsight.bondy \
call bondy.router.bridge.add \
'{
"name": "edge_test",
"endpoint": "127.0.0.1:18093",
"transport": "tls",
"realms": [
{
"uri": "com.leapsight.test",
"authid": "device1",
"cryptosign": {
"pubkey": "1766c9e6ec7d7b354fd7a2e4542753a23cae0b901228305621e5b8713299ccdd",
"privkey": "4ffddd896a530ce5ee8c86b83b0d31835490a97a9cd718cb2f09c9fd31c4a7d71766c9e6ec7d7b354fd7a2e4542753a23cae0b901228305621e5b8713299ccdd"
}
}
],
"reconnect": {"enabled":true},
"ping": {"enabled":true}
}' --kwarg autostart=true | jq{
"connect_timeout": 5000,
"enabled": false,
"endpoint": "127.0.0.1:18093",
"idle_timeout": 86400000,
"max_frame_size": 4194304,
"name": "edge_test",
"parallelism": 1,
"ping": {
"enabled": true,
"idle_timeout": 20000,
"max_attempts": 3,
"timeout": 10000
},
"realms": [
{
"authid": "device1",
"cryptosign": {
"privkey": "4ffddd896a530ce5ee8c86b83b0d31835490a97a9cd718cb2f09c9fd31c4a7d71766c9e6ec7d7b354fd7a2e4542753a23cae0b901228305621e5b8713299ccdd",
"pubkey": "1766c9e6ec7d7b354fd7a2e4542753a23cae0b901228305621e5b8713299ccdd"
},
"procedures": [],
"topics": [],
"uri": "com.leapsight.test"
}
],
"reconnect": {
"backoff_max": 60000,
"backoff_min": 5000,
"backoff_type": "jitter",
"enabled": true,
"max_retries": 100
},
"restart": "transient",
"socket_opts": {
"keepalive": true,
"nodelay": true
},
"tls_opts": {
"verify": "verify_none"
},
"transport": "tls",
"type": "bridge_relay",
"version": "1.0"
}Remove a bridge
bondy.router.bridge.remove(name)
Stops the bridge if it runs, and removes its definition from the bridge manager. For a permanent bridge, Bondy also deletes the stored definition.
The call succeeds when the bridge does not exist.
Call
Positional Args
0The name of the bridge.
Keyword Args
None.
Result
Positional Results
None.
Keyword Results
None.
Errors
bondy.error.internal_error: when the bridge supervisor refuses to delete the bridge, for example because the bridge restarts at the moment of the call.
Example
./wick --url ws://localhost:19080/ws \
--realm com.leapsight.bondy \
call bondy.router.bridge.remove "edge_test"Start a bridge
bondy.router.bridge.start(name())
Starts a bridge which has already been defined using bondy.router.bridge.add.
Call
Positional Args
0The name of the bridge.
Keyword Args
None.
Result
Positional Results
None.
Keyword Results
None.
Errors
- bondy.error.not_found: when the provided bridge name is not found.
- wamp.error.invalid_argument: when there are an invalid number of positional arguments.
bondy.error.internal_error: when the bridge fails to start. The node log records the reason.
Examples
Success Call
- Request
./wick --url ws://localhost:19080/ws \
--realm com.leapsight.bondy \
call bondy.router.bridge.start "edge_test"Stop a bridge
bondy.router.bridge.stop(name())
Stops an existing running bridge.
A call for a bridge that was started and has stopped succeeds. A call for a bridge that was never started on this node fails with bondy.error.not_found.
Call
Positional Args
0The name of the bridge.
Keyword Args
None.
Result
Positional Results
None.
Keyword Results
None.
Errors
- bondy.error.not_found: when no bridge with this name exists, or when the bridge was never started on this node.
- wamp.error.invalid_argument: when there are an invalid number of positional arguments.
Examples
Success Call
- Request
./wick --url ws://localhost:19080/ws \
--realm com.leapsight.bondy \
call bondy.router.bridge.stop "edge_test"Retrieve a bridge
bondy.router.bridge.get(name()) -> bridge()
Retrieves a Bridge Object specification by name
Call
Positional Args
0The name of the bridge.
Keyword Args
None.
Result
Positional Results
0The bridge relay object.
Keyword Results
None.
Errors
- bondy.error.not_found: when the provided bridge name is not found.
- wamp.error.invalid_argument: when there are an invalid number of positional arguments.
Examples
Success Call
- Request
./wick --url ws://localhost:19080/ws \
--realm com.leapsight.bondy \
call bondy.router.bridge.get "edge_test" | jq- Response:
{
"connect_timeout": 5000,
"enabled": false,
"endpoint": "127.0.0.1:18093",
"hibernate": "idle",
"idle_timeout": 86400000,
"max_frame_size": 4194304,
"name": "edge_test",
"network_timeout": 30000,
"parallelism": 1,
"ping": {
"enabled": true,
"idle_timeout": 20000,
"max_attempts": 3,
"timeout": 10000
},
"realms": [
{
"authid": "device1",
"cryptosign": {
"privkey": "4ffddd896a530ce5ee8c86b83b0d31835490a97a9cd718cb2f09c9fd31c4a7d71766c9e6ec7d7b354fd7a2e4542753a23cae0b901228305621e5b8713299ccdd",
"pubkey": "1766c9e6ec7d7b354fd7a2e4542753a23cae0b901228305621e5b8713299ccdd"
},
"procedures": [],
"topics": [],
"uri": "com.leapsight.test"
}
],
"reconnect": {
"backoff_max": 60000,
"backoff_min": 5000,
"backoff_type": "jitter",
"enabled": true,
"max_retries": 100
},
"restart": "transient",
"socket_opts": {
"keepalive": true,
"nodelay": true
},
"tls_opts": {
"verify": "verify_none"
},
"transport": "tls",
"type": "bridge_relay",
"version": "1.0"
}List all bridges
bondy.router.bridge.list() -> [bridge()]
Returns a list of all installed bridges in the system.
Call
Positional Args
None.
Keyword Args
None.
Result
Positional Results
0The all bridges you want to retrieve.
Keyword Results
None.
Errors
Examples
Success Call
- Request
./wick --url ws://localhost:19080/ws \
--realm com.leapsight.bondy \
call bondy.router.bridge.list | jq- Response:
[
{
"connect_timeout": 5000,
"enabled": false,
"endpoint": "127.0.0.1:18093",
"hibernate": "idle",
"idle_timeout": 86400000,
"max_frame_size": 4194304,
"name": "edge_test",
"network_timeout": 30000,
"parallelism": 1,
"ping": {
"enabled": true,
"idle_timeout": 20000,
"max_attempts": 3,
"timeout": 10000
},
"realms": [
{
"authid": "device1",
"cryptosign": {
"privkey": "4ffddd896a530ce5ee8c86b83b0d31835490a97a9cd718cb2f09c9fd31c4a7d71766c9e6ec7d7b354fd7a2e4542753a23cae0b901228305621e5b8713299ccdd",
"pubkey": "1766c9e6ec7d7b354fd7a2e4542753a23cae0b901228305621e5b8713299ccdd"
},
"procedures": [],
"topics": [],
"uri": "com.leapsight.test"
}
],
"reconnect": {
"backoff_max": 60000,
"backoff_min": 5000,
"backoff_type": "jitter",
"enabled": true,
"max_retries": 100
},
"restart": "transient",
"socket_opts": {
"keepalive": true,
"nodelay": true
},
"tls_opts": {
"verify": "verify_none"
},
"transport": "tls",
"type": "bridge_relay",
"version": "1.0"
}
]Check status of a bridge
bondy.router.bridge.status() -> bridgeStatus()
Returns an object where the key is an installed bridge name and the value is the bridge status object.
The status object has the following properties:
- status — The status of the bridge it can be:
not_started: The bridge was added but never started since the Bondy node startedstopped: The bridge was stoppedrestarting: The bridge crashes and the supervisor is restarting itrunning: The bridge is running
Call
Positional Args
None.
Keyword Args
None.
Result
Positional Results
statusThe status of the bridge.
Keyword Results
None.
Errors
Examples
Success Call
- Request
./wick --url ws://localhost:19080/ws \
--realm com.leapsight.bondy \
call bondy.router.bridge.status | jq- Response:
{
"edge_test": {
"status": "not_started"
}
}Check spec of a bridge
bondy.router.bridge.check_spec(input()) -> bridge()
Checks the validity of a Bridge Relay Object.
Call
Positional Args
0The bridge relay configuration data
Keyword Args
None.
Result
Positional Results
0The bridge relay object.
Keyword Results
None.
Errors
- bondy.error.missing_required_value: when a required value is not provided.
bondy.error.unknown_error, withcodeinvalid_datatype: when the data type is invalid.- bondy.error.invalid_value: when the data value is invalid.
- bondy.error.invalid_data: when the data values are invalid.
Examples
Success Call
- Request
./wick --url ws://localhost:19080/ws \
--realm com.leapsight.bondy \
call bondy.router.bridge.check_spec \
'{
"name": "edge_test",
"endpoint": "127.0.0.1:18093",
"realms": [
{
"uri": "com.leapsight.test",
"authid": "device1",
"cryptosign": {
"pubkey": "1766c9e6ec7d7b354fd7a2e4542753a23cae0b901228305621e5b8713299ccdd",
"privkey": "4ffddd896a530ce5ee8c86b83b0d31835490a97a9cd718cb2f09c9fd31c4a7d71766c9e6ec7d7b354fd7a2e4542753a23cae0b901228305621e5b8713299ccdd"
}
}
]
}' | jq- Response:
{
"connect_timeout": 5000,
"enabled": false,
"endpoint": "127.0.0.1:18093",
"idle_timeout": 86400000,
"max_frame_size": 4194304,
"name": "edge_test",
"parallelism": 1,
"ping": {},
"realms": [
{
"authid": "device1",
"cryptosign": {
"privkey": "4ffddd896a530ce5ee8c86b83b0d31835490a97a9cd718cb2f09c9fd31c4a7d71766c9e6ec7d7b354fd7a2e4542753a23cae0b901228305621e5b8713299ccdd",
"pubkey": "1766c9e6ec7d7b354fd7a2e4542753a23cae0b901228305621e5b8713299ccdd"
},
"procedures": [],
"topics": [],
"uri": "com.leapsight.test"
}
],
"reconnect": {},
"restart": "transient",
"socket_opts": {
"keepalive": true,
"nodelay": true
},
"tls_opts": {
"verify": "verify_none"
},
"transport": "tcp",
"type": "bridge_relay",
"version": "1.0"
}