Skip to content

Commit d257e79

Browse files
committed
routing: Document plans for enabling dynamic routing for MQTT etc
1 parent 5027dd1 commit d257e79

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

src/routing.coffee

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,27 @@ debug = require('debug')('msgflo:routing')
33

44
# Used to bind one queue/exchange to another when the Broker
55
# of the transport cannot provide this functionality, like on MQTT
6+
#
7+
# TODO: split into two pieces
8+
# a) a Router, which implements message routing
9+
# with a message-queue based interface for listing and manipulating bindings.
10+
# b) a Binder mixin for MessageBroker inteface,
11+
# which sends
12+
#
13+
# This allows a single Router to exist in the network. It holds the canonical state of which
14+
# queues/topics are bound to eachother, and multiple processes can query and manipulate these.
15+
# Typically this would be hosted on the same machine as the Broker itself, and would have same lifetime.
16+
#
17+
# Protocol:
18+
# (in) /msgrouter/$instance/addbinding Add a new binding between a source and target topic/queue.
19+
# (in) /msgrouter/$instance/removebinding Remove an existing binding between a source and target topic/queue.
20+
# (out) /msgrouter/$instance/bindings Full list of current bindings. Emitted on changes, or when requested.
21+
# (in) /msgrouter/$instance/listbindings Explicitly request current bindings.
22+
#
23+
# The default $instance is 'default'
24+
# The Router implementation should persist the bindings whenever they change.
25+
# Upon restarting it should restore the persisted bindings (and emit a signal).
26+
#
627
bindingId = (f, t) ->
728
return "#{f}-#{t}"
829

0 commit comments

Comments
 (0)