lib/legion/transport/message.rb in legion-transport-java-1.1.3 vs lib/legion/transport/message.rb in legion-transport-java-1.1.4

- old
+ new

@@ -9,11 +9,13 @@ end def publish(options = @options) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity raise unless @valid - exchange_dest = exchange.respond_to?(:new) ? exchange.new : exchange + $exchanges = {} if $exchanges.nil? + $exchanges[exchange.to_s] = exchange.new unless $exchanges.key?(exchange.to_s) + exchange_dest = $exchanges[exchange.to_s] exchange_dest.publish(encode_message, routing_key: routing_key || '', content_type: options[:content_type] || content_type, content_encoding: options[:content_encoding] || content_encoding, type: options[:type] || type, @@ -22,9 +24,13 @@ headers: headers) end def message @options + end + + def routing_key + nil end def encode_message message_payload = message message_payload = Legion::JSON.dump(message_payload) unless message_payload.is_a? String