Broker Bridge Settings

A subsystem that enables to re-publish WAMP Events to an external non-WAMP broker.

Bondy Broker Bridge is a subsystem that enables you to have a set of supervised embedded WAMP subscribers that re-publish events to an external message broker or system.

The subsystem manages a set of bridges, each one enabled through the bondy.conf file. At the moment the bondy_kafka_bridge is the only one provided and it is disabled by default.

Enabling the Kafka Bridge

To enable the Kafka Bridge modify the broker_bridge.kafka.enabled option in the bondy.conf file as shown below:

broker_bridge.kafka.enabled = on

To learn more about the Kafka Bridge and how to configure it, read the following section:

Configuring Broker Bridge Subscriptions

A subscription can be dynamically created and removed at runtime using the HTTP and WAMP APIs or it can be created at Bondy initialisation time through a Bridge Subscriptions Specification Format.

Dynamically configuring subscriptions

TBD

WAMP
HTTP/REST

Statically configuring subscriptions via a configuration file

To configure one or more subscriptions you need to define a specification file using the Bridge Subscriptions Specification Format and modify the bondy.conf to tell Bondy where to find it.

The following snippet provides an example subscriptions specification file.

/bondy/etc/subscriptions.json
{
"id":"subscribers_1",
"meta":{},
"subscriptions" : [
{
"bridge": "bondy_kafka_bridge",
"match": {
"realm": "com.example.realm",
"topic" : "com.example.user.created",
"options": {"match": "exact"}
},
"action": {
"type": "produce_sync",
"topic": "{{kafka.topics |> get(com.magenta.wamp_events)}}",
"key": "\"{{event.topic}}/{{event.publication_id}}\"",
"value": "{{event}}",
"options" : {
"client_id": "default",
"acknowledge": true,
"required_acks": "all",
"partition": null,
"partitioner": {
"algorithm": "fnv32a",
"value": "\"{{event.topic}}/{{event.publication_id}}\""
},
"encoding": "json"
}
}
}
]
}

The following snippet shows how to modify the bondy.conf file to tell Bondy where to locate the file.

bondy.conf
bondy_broker_bridge.config_file = /bondy/etc/subscriptions.json

Broker Bridge Subscriptions Object Specification Format

Specification Object

Property

Required

Type

Description

Examples

id

true

string

A unique identifier for this specification

subscribers_1

meta

false

object

An arbitrary object containing user metadata. Bondy treats it as an opaque object.

{"foo" : "bar"}

subscriptions

true

array

An array of Subscription Objects

Example Specification Object
{
"id":"subscribers_1",
"meta":{},
"subscriptions" : [ ]
}

Subscription Object

Property

Required

Type

Description

Examples

bridge

true

Bridge Identifier

The identifier of the bridge to use. These are the Erlang module names of the implemented bridges.

bondy_kafka_bridge

match

true

Match Specification Object

action

true

Action Object

Match Specification Object

Property

Required

Type

Description

Examples

realm

true

string

The bondy realm this subscription will live in

my_realm, com.example.realm

topic

true

string

The WAMP topic we want to match

com.example.user.added

options

false

Match Options Object

The way we want to match the topic. It should be one of "exact", "prefix" or "wildcard"

{"match": "exact"}

Match Options Object

This the WAMP Subscription Options object.

Property

Required

Type

Description

Examples

match

false

string

The way we want to match the topic. It should be one of "exact", "prefix" or "wildcard"

exact

nkey

At the moment Bondy does not support wildcard matching. Support is planned.

Action Object

The Action Object is and abstract object. Concrete implementations are defined by each Bridge.

Review the following link for the Kafka Bridge implementation.