Bus
Inherits Reference < Object
A Bus sends messages to interested subscribers. Those subscribers can reply to a message. Those replies will be routed back to the original sender.
Constants
VERSION = "0.1.1"
Constructors
new
SourceInstance methods
has_subscription?(key)
Sourcemessage(body : Array(String) | String, origin : String | Nil = nil, tags : Array(String) = [] of String, parameters : Hash(String, String) = Hash(String, String).new, strategy : Message::Strategy = Message::Strategy::RandomWinner)
Generate a message for this bus.
pipeline
Sourcesend(body : Array(String) | String, origin : String | Nil = nil, tags : Array(String) = [] of String, parameters : Hash(String, String) = Hash(String, String).new, strategy : Message::Strategy = Message::Strategy::RandomWinner)
Sourcesubscriptions
As of Crystal 1.0.0, using Hashes here is faster in single threaded release mode, but it fails UGLY in multithreaded release mode. The SplayTreeMap implementation is currently slightly slower than the hash in single threaded, but it works just fine in multithreaded mode, so this implementation is going to stick with the SplayTreeMap for now.