Module: RuoteStomp
- Defined in:
- lib/ruote-stomp.rb,
lib/ruote-stomp/version.rb,
lib/ruote-stomp/receiver.rb,
lib/ruote-stomp/participant.rb,
lib/ruote-stomp/workitem_listener.rb,
lib/ruote-stomp/launchitem_listener.rb
Overview
Stomp participant and listener pair for ruote.
Documentation
See #RuoteStomp::Listener and #RuoteStomp::Participant for detailed documentation on using each of them.
Stomp Notes
RuoteAmqp uses durable queues and persistent messages by default, to ensure no messages get lost along the way and that running expressions doesn’t have to be restarted in order for messages to be resent. <- not exactly sure yet how RuoteStomp will handle durable queues, messages are persisted.
Defined Under Namespace
Classes: LaunchitemListener, Participant, ParticipantProxy, Receiver, WorkitemListener
Constant Summary collapse
- VERSION =
'2.2.4'
Class Attribute Summary collapse
-
.use_persistent_messages ⇒ Object
writeonly
Sets the attribute use_persistent_messages.
Class Method Summary collapse
-
.start! ⇒ Object
Ensure the Stomp connection is started.
-
.started! ⇒ Object
:nodoc:.
-
.started? ⇒ Boolean
Check whether the AMQP connection is started.
-
.stop! ⇒ Object
Close down the Stomp connections.
-
.use_persistent_messages? ⇒ Boolean
Whether or not to use persistent messages (true by default).
Class Attribute Details
.use_persistent_messages=(value) ⇒ Object (writeonly)
Sets the attribute use_persistent_messages
29 30 31 |
# File 'lib/ruote-stomp.rb', line 29 def (value) @use_persistent_messages = value end |
Class Method Details
.start! ⇒ Object
Ensure the Stomp connection is started
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/ruote-stomp.rb', line 38 def start! return if started? mutex = Mutex.new cv = ConditionVariable.new Thread.main[:ruote_stomp_connection] = Thread.new do Thread.abort_on_exception = true begin if STOMP.settings[:ssl] $stomp = OnStomp::Client.new(create_connection_uri(STOMP.settings), :ssl => { :ca_file => STOMP.settings[:cert], :verify_mode => OpenSSL::SSL::VERIFY_NONE } ) $stomp.connect else $stomp = OnStomp.connect create_connection_uri(STOMP.settings) end if $stomp && $stomp.connected? started! cv.signal end rescue Exception => e raise e, "Failed to connect to Stomp server: #{e.}" end end mutex.synchronize { cv.wait(mutex) } yield if block_given? end |
.started! ⇒ Object
:nodoc:
77 78 79 |
# File 'lib/ruote-stomp.rb', line 77 def started! #:nodoc: Thread.main[:ruote_stomp_started] = true end |
.started? ⇒ Boolean
Check whether the AMQP connection is started
73 74 75 |
# File 'lib/ruote-stomp.rb', line 73 def started? Thread.main[:ruote_stomp_started] == true end |
.stop! ⇒ Object
Close down the Stomp connections
82 83 84 85 86 87 |
# File 'lib/ruote-stomp.rb', line 82 def stop! return unless started? $stomp.disconnect Thread.main[:ruote_stomp_connection].join Thread.main[:ruote_stomp_started] = false end |
.use_persistent_messages? ⇒ Boolean
Whether or not to use persistent messages (true by default)
32 33 34 35 |
# File 'lib/ruote-stomp.rb', line 32 def @use_persistent_messages = true if @use_persistent_messages.nil? @use_persistent_messages end |