Class: Moleculer::Transporters::Redis

Inherits:
Base
  • Object
show all
Defined in:
lib/moleculer/transporters/redis.rb

Overview

The Moleculer Redis transporter

Defined Under Namespace

Classes: Publisher, Subscriber

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Redis

Returns a new instance of Redis.



190
191
192
# File 'lib/moleculer/transporters/redis.rb', line 190

def initialize(config)
  @config = config
end

Instance Method Details

#publish(packet) ⇒ Object



198
199
200
# File 'lib/moleculer/transporters/redis.rb', line 198

def publish(packet)
  publisher.publish(packet)
end

#startObject



202
203
204
205
# File 'lib/moleculer/transporters/redis.rb', line 202

def start
  publisher.connect
  subscriber.connect
end

#stopObject



207
208
209
210
# File 'lib/moleculer/transporters/redis.rb', line 207

def stop
  publisher.disconnect
  subscriber.disconnect
end

#subscribe(channel, &block) ⇒ Object



194
195
196
# File 'lib/moleculer/transporters/redis.rb', line 194

def subscribe(channel, &block)
  subscriber.subscribe(channel, &block)
end