Class: WideRabbitMQTopic

Inherits:
BaseRabbitMQTopic show all
Defined in:
lib/postcard_rb/dispatchers/RabbitMQ/routings/Wide/WideRabbitMQTopic.rb

Instance Method Summary collapse

Constructor Details

#initialize(name:, channel:) ⇒ WideRabbitMQTopic

Returns a new instance of WideRabbitMQTopic.



5
6
7
8
9
10
# File 'lib/postcard_rb/dispatchers/RabbitMQ/routings/Wide/WideRabbitMQTopic.rb', line 5

def initialize name:, channel:
  super()

  @channel = channel
  @exchange = @channel.fanout(name, :durable => false)
end

Instance Method Details

#createRoom(name:, exclusive: false, autoDelete: false) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/postcard_rb/dispatchers/RabbitMQ/routings/Wide/WideRabbitMQTopic.rb', line 12

def createRoom name:, exclusive: false, autoDelete: false
  room = WideRabbitMQRoom.new(
    name: name,
    exclusive: exclusive,
    autoDelete: autoDelete,
    channel: @channel,
    exchange: @exchange
  )
  
  addRoom(room: room)

  return room
end

#publish(payload:, correlationId: nil, replyTo: nil) ⇒ Object



26
27
28
29
30
31
32
33
# File 'lib/postcard_rb/dispatchers/RabbitMQ/routings/Wide/WideRabbitMQTopic.rb', line 26

def publish payload:, correlationId: nil, replyTo: nil
  @exchange.publish(
    payload, 
    :correlation_id => correlationId,
    :reply_to => replyTo,
    :persistent => false
  )
end