Class: Qup::Adapter::Kestrel::Destination

Inherits:
Object
  • Object
show all
Defined in:
lib/qup/adapter/kestrel/destination.rb

Overview

Internal: The Common base class for Kestrel Topic and Queue

Direct Known Subclasses

Queue, Topic

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(address, name) ⇒ Destination

Internal: Create a new Topic or Queue

address - the Connection Address string for the Kestrel Client name - the String name of the Topic

Returns a new Topic.



16
17
18
19
20
21
22
# File 'lib/qup/adapter/kestrel/destination.rb', line 16

def initialize( address, name )
  @address      = address
  @client       = blocking_transactional_client( @address )
  @admin_client = regular_client( @address )
  @name         = name
  ping
end

Instance Attribute Details

#nameObject (readonly)

Internal: the name of the Queue or Topic



8
9
10
# File 'lib/qup/adapter/kestrel/destination.rb', line 8

def name
  @name
end

Instance Method Details

#destroyObject

Internal: Destroy the Topic or Queue

If possible remove the existence of the Topic from the System

Returns nothing.



29
30
31
32
# File 'lib/qup/adapter/kestrel/destination.rb', line 29

def destroy
  @admin_client.delete( name )
  @admin_client.delete( name+"_errors" )
end

#pingObject

Internal: Make sure the Topic or Queue exists

Returns nothing



37
38
39
40
# File 'lib/qup/adapter/kestrel/destination.rb', line 37

def ping
  @admin_client.peek( name )
  return true
end