Sha256: 61dfd877185ac7694a9de347124c17379c06915ba204309f9b48d8404c8e3b25
Contents?: true
Size: 776 Bytes
Versions: 1
Compression:
Stored size: 776 Bytes
Contents
require_relative "base" module Moleculer module Transporters ## # The fake transporter is designed to be used in testing. It is simply an in memory queue and should not be used # in production. class Fake < Base def initialize(config) super(config) # in this case we want to use a class var as this needs to behave like a singleton to mimic how a global # transporter functions @@subscriptions ||= {} # rubocop:disable Style/ClassVars end def subscribe(channel, &block) @@subscriptions[channel] = block end def publish(packet) @@subscriptions[packet.topic].call(packet) end def start true end def stop true end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
moleculer-0.2.0 | lib/moleculer/transporters/fake.rb |