Class: BoomNats::Router

Inherits:
Object
  • Object
show all
Defined in:
lib/boom_nats/router.rb

Instance Method Summary collapse

Constructor Details

#initialize(application) ⇒ Router

Returns a new instance of Router.



3
4
5
# File 'lib/boom_nats/router.rb', line 3

def initialize(application)
  @application = application
end

Instance Method Details

#in_queue(name, &block) ⇒ Object



11
12
13
14
15
# File 'lib/boom_nats/router.rb', line 11

def in_queue(name, &block)
  @current_group = name
  instance_eval(&block)
  @current_group = nil
end

#setup(&block) ⇒ Object



7
8
9
# File 'lib/boom_nats/router.rb', line 7

def setup(&block)
  instance_eval(&block)
end

#topic(name, klass, options = {}) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/boom_nats/router.rb', line 17

def topic(name, klass, options = {})
  options = {
    queue: @current_group,
    **options
  }
  RouteTopic.new(@application).setup(name, klass, **options)
end