Class: TorqueBox::Messaging::Topic
- Inherits:
-
Destination
- Object
- Destination
- TorqueBox::Messaging::Topic
- Defined in:
- lib/torquebox/messaging/topic.rb
Constant Summary collapse
- DEFAULT_SUBSCRIBER_NAME =
'subscriber-1'
Constants inherited from Destination
Instance Attribute Summary
Attributes inherited from Destination
#connect_options, #connection_factory, #enumerable_options, #java_destination, #name
Class Method Summary collapse
-
.start(name, options = {}) ⇒ Topic?
Creates the topic, starts and return a Topic object.
Instance Method Summary collapse
- #to_s ⇒ Object
-
#unsubscribe(subscriber_name = DEFAULT_SUBSCRIBER_NAME, options = { }) ⇒ void
Unsubscribes the selected subscriber from the topic.
Methods inherited from Destination
#_dump, _load, #each, #initialize, list, lookup, #normalize_options, #publish, #receive, #stop, #stop_sync, #wait_for_destination, wait_for_latch, with_destinationizer, #with_session
Constructor Details
This class inherits a constructor from TorqueBox::Messaging::Destination
Class Method Details
.start(name, options = {}) ⇒ Topic?
Creates the topic, starts and return a Topic object.
36 37 38 39 40 41 42 43 44 |
# File 'lib/torquebox/messaging/topic.rb', line 36 def start(name, ={}) exported = .fetch(:exported, false) with_destinationizer do |destinationizer| destinationizer.create_topic(name, exported) end new(name, ) end |
Instance Method Details
#to_s ⇒ Object
60 61 62 |
# File 'lib/torquebox/messaging/topic.rb', line 60 def to_s "[Topic: #{super}]" end |
#unsubscribe(subscriber_name = DEFAULT_SUBSCRIBER_NAME, options = { }) ⇒ void
This method returns an undefined value.
Unsubscribes the selected subscriber from the topic
52 53 54 55 56 57 58 |
# File 'lib/torquebox/messaging/topic.rb', line 52 def unsubscribe(subscriber_name = DEFAULT_SUBSCRIBER_NAME, = { }) wait_for_destination([:startup_timeout]) do with_session do |session| session.unsubscribe( subscriber_name ) end end end |