lib/message_driver/adapters/stomp_adapter.rb in message-driver-0.3.0 vs lib/message_driver/adapters/stomp_adapter.rb in message-driver-0.4.0
- old
+ new
@@ -8,21 +8,19 @@
end
end
module Adapters
class StompAdapter < Base
-
class Message < MessageDriver::Message::Base
attr_reader :stomp_message
def initialize(ctx, stomp_message)
@stomp_message = stomp_message
super(ctx, stomp_message.body, stomp_message.headers, {})
end
end
class Destination < MessageDriver::Destination::Base
-
end
attr_reader :config, :poll_timeout
def initialize(broker, config)
@@ -30,11 +28,11 @@
@broker = broker
@config = config.symbolize_keys
connect_headers = @config[:connect_headers] ||= {}
connect_headers.symbolize_keys
- connect_headers[:"accept-version"] = "1.1,1.2"
+ connect_headers[:"accept-version"] = '1.1,1.2'
vhost = @config.delete(:vhost)
connect_headers[:host] = vhost if vhost
@poll_timeout = 1
@@ -48,17 +46,17 @@
#def subscribe(destination, consumer)
#destination.subscribe(&consumer)
#end
def create_destination(name, dest_options={}, message_props={})
- unless name.start_with?("/")
+ unless name.start_with?('/')
name = "/queue/#{name}"
end
Destination.new(adapter, name, dest_options, message_props)
end
- def publish(destination, body, headers={}, properties={})
+ def publish(destination, body, headers={}, _properties={})
with_connection do |connection|
connection.publish(destination.name, body, headers)
end
end
@@ -117,10 +115,10 @@
def validate_stomp_version
required = Gem::Requirement.create('~> 1.3.1')
current = Gem::Version.create(Stomp::Version::STRING)
unless required.satisfied_by? current
- raise MessageDriver::Error, "stomp 1.3.1 or a later version of the 1.3.x series is required for the stomp adapter"
+ raise MessageDriver::Error, 'stomp 1.3.1 or a later version of the 1.3.x series is required for the stomp adapter'
end
end
end
end
end