Class: Qup::Subscriber

Inherits:
Consumer show all
Defined in:
lib/qup/subscriber.rb

Overview

Public: Receives Messages from a Topic

All Subscribers to a Topic will receive each Message that is published to the Topic.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Consumer

#acknowledge, #consume

Constructor Details

#initialize(topic, queue) ⇒ Subscriber

Public: Create a new Subscriber on a Topic

Returns a Subscriber



14
15
16
17
18
# File 'lib/qup/subscriber.rb', line 14

def initialize( topic, queue )
  super( queue )
  @topic = topic
  @name  = @queue.name
end

Instance Attribute Details

#nameObject (readonly)

Public: The name of this subscriber



9
10
11
# File 'lib/qup/subscriber.rb', line 9

def name
  @name
end

Instance Method Details

#unsubscribeObject

Public: Remove the Subscriber from the Topic

This just means to destroy the Queue that it is attached to



24
25
26
# File 'lib/qup/subscriber.rb', line 24

def unsubscribe
  @queue.destroy
end