Class: RubyRabbitmqJanus::Rabbit::Publisher::Exclusive

Inherits:
Base
  • Object
show all
Defined in:
lib/rrj/rabbit/publisher/exclusive.rb

Overview

# Publish message

Publish message in queue exclusive. Bunny create automaticaly a name for this queue. The queue name like to ‘amq.gen-1A456DGVHDVUS’.

Author:

Instance Attribute Summary

Attributes inherited from BaseEvent

#responses

Instance Method Summary collapse

Constructor Details

#initialize(exchange, name_queue) ⇒ Exclusive

Initialize an queue exclusive and generated automaticaly by bunny

Parameters:

  • exchange (String)

    Exchange used for the transaction

  • name_queue (String)

    Name to queue exclusive



17
18
19
20
21
# File 'lib/rrj/rabbit/publisher/exclusive.rb', line 17

def initialize(exchange, name_queue)
  @reply = exchange.queue(name_queue, exclusive: true)
  super(exchange)
  subscribe_to_queue
end

Instance Method Details

#publish(request) ⇒ Janus::Response::Standard

Send an message to queue and waiting a response

Parameters:

  • request (String)

    JSON request sending to rabbitmq queue

Returns:

  • (Janus::Response::Standard)

    response for an request reading by janus instance



29
30
31
32
# File 'lib/rrj/rabbit/publisher/exclusive.rb', line 29

def publish(request)
  super(request)
  return_response
end