Method: ActiveMessaging::Adapters::Jms::Connection#find_or_create_destination

Defined in:
lib/activemessaging/adapters/jms.rb

#find_or_create_destination(queue_name, headers = {}) ⇒ Object



152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# File 'lib/activemessaging/adapters/jms.rb', line 152

def find_or_create_destination queue_name, headers={}
  destination = find_destination queue_name, headers[:destination_type]
  if destination.nil?
    if headers.symbolize_keys[:destination_type] == :topic
      destination = @session.create_topic(queue_name.to_s)
      @destinations << destination
    elsif headers.symbolize_keys[:destination_type] == :queue
      destination = @session.create_queue(queue_name.to_s)
      @destinations << destination
    else
      raise "headers[:destination_type] must be either :queue or :topic.  was #{headers[:destination_type]}"
    end
  end
  destination
end