### Home Classes Methods

### In Files

- lib/amqp/deprecated/rpc.rb

### Parent

Object

### Methods

- ::new
- #respond_to

### Class/Module Index

Quicksearch

- AMQP
- AMQP::BitSet
- AMQP::BlankSlate
- AMQP::Broker
- AMQP::Channel
- AMQP::ChannelClosedError
- AMQP::Client
- AMQP::Consumer
- AMQP::Error
- AMQP::Exchange
- AMQP::Header
- AMQP::IncompatibleOptionsError
- AMQP::IntAllocator
- AMQP::Integration
- AMQP::Integration::Rails
- AMQP::Logger
- AMQP::PossibleAuthenticationFailureError
- AMQP::Queue
- AMQP::RPC
- AMQP::RPC::Client
- AMQP::RPC::Server
- AMQP::Session
- AMQP::TCPConnectionFailed
- AMQP::Utilities
- AMQP::Utilities::EventLoopHelper
- AMQP::Utilities::ServerType
- MQ
- MQ::Exchange
- MQ::Logger
- MQ::Queue
- EM
- Object

No matching classes.

# AMQP::RPC::Server

@private

### Public Class Methods

new(channel, queue_name, impl) click to toggle source

    # File lib/amqp/deprecated/rpc.rb, line 130
    def initialize(channel, queue_name, impl)
      @channel  = channel
      @exchange = AMQP::Exchange.default(@channel)
      @queue    = @channel.queue(queue_name)
      @impl     = impl

      @handlers     = Hash.new
      @id           = "client_identifier_#{rand(1_000_000)}"

      @queue.subscribe(:ack => true) do |header, payload|
        selector, *args = Marshal.load(payload)
        result = @impl.__send__(selector, *args)

        respond_to(header, result) if header.to_hash[:reply_to]
        header.ack
      end
    end

### Public Instance Methods

respond_to(header, result) click to toggle source

    # File lib/amqp/deprecated/rpc.rb, line 148
    def respond_to(header, result)
      @exchange.publish(Marshal.dump(result), :message_id => header.message_id, :routing_key => header.reply_to)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.