Class: ActiveMessaging::Adapters::Adapter::Queue
- Inherits:
-
Object
- Object
- ActiveMessaging::Adapters::Adapter::Queue
- Defined in:
- lib/activemessaging/adapters/wmq.rb
Overview
Queue class is used to keep track of the subscriptions It contains :
- name of the queue
- options to use when getting from the queue
- number of subscriptions
Instance Attribute Summary collapse
-
#get_options ⇒ Object
Returns the value of attribute get_options.
-
#name ⇒ Object
Returns the value of attribute name.
-
#nb_subscriptions ⇒ Object
Returns the value of attribute nb_subscriptions.
Instance Method Summary collapse
- #add_subscription ⇒ Object
- #has_subscription? ⇒ Boolean
-
#initialize(name, get_options) ⇒ Queue
constructor
A new instance of Queue.
- #remove_subscription ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(name, get_options) ⇒ Queue
Returns a new instance of Queue.
169 170 171 172 |
# File 'lib/activemessaging/adapters/wmq.rb', line 169 def initialize(name, ) @name, @get_options = name, @nb_subscriptions = 0 end |
Instance Attribute Details
#get_options ⇒ Object
Returns the value of attribute get_options.
167 168 169 |
# File 'lib/activemessaging/adapters/wmq.rb', line 167 def @get_options end |
#name ⇒ Object
Returns the value of attribute name.
167 168 169 |
# File 'lib/activemessaging/adapters/wmq.rb', line 167 def name @name end |
#nb_subscriptions ⇒ Object
Returns the value of attribute nb_subscriptions.
167 168 169 |
# File 'lib/activemessaging/adapters/wmq.rb', line 167 def nb_subscriptions @nb_subscriptions end |
Instance Method Details
#add_subscription ⇒ Object
174 175 176 |
# File 'lib/activemessaging/adapters/wmq.rb', line 174 def add_subscription @nb_subscriptions += 1 end |
#has_subscription? ⇒ Boolean
182 183 184 |
# File 'lib/activemessaging/adapters/wmq.rb', line 182 def has_subscription? @nb_subscriptions > 0 end |
#remove_subscription ⇒ Object
178 179 180 |
# File 'lib/activemessaging/adapters/wmq.rb', line 178 def remove_subscription @nb_subscriptions -= 1 unless @nb_subscriptions > 0 end |
#to_s ⇒ Object
186 187 188 |
# File 'lib/activemessaging/adapters/wmq.rb', line 186 def to_s "<Adapter::Queue name='#{@name}' get_options=#{@get_options} nb_subscriptions=#{@nb_subscriptions}>" end |