lib/message_driver/client.rb in message-driver-0.3.0 vs lib/message_driver/client.rb in message-driver-0.4.0
- old
+ new
@@ -52,11 +52,11 @@
def find_consumer(consumer)
broker.find_consumer(consumer)
end
- def with_message_transaction(options={}, &block)
+ def with_message_transaction(options={})
wrapper = fetch_context_wrapper
wrapper.increment_transaction_depth
begin
if wrapper.ctx.supports_transactions?
if wrapper.transaction_depth == 1
@@ -74,11 +74,11 @@
wrapper.ctx.commit_transaction
else
yield
end
else
- logger.debug("this adapter does not support transactions")
+ logger.debug('this adapter does not support transactions')
yield
end
ensure
wrapper.decrement_transaction_depth
end
@@ -87,11 +87,11 @@
def current_adapter_context(initialize=true)
ctx = fetch_context_wrapper(initialize)
ctx.nil? ? nil : ctx.ctx
end
- def with_adapter_context(adapter_context, &block)
+ def with_adapter_context(adapter_context)
old_ctx, Thread.current[adapter_context_key] = fetch_context_wrapper(false), build_context_wrapper(adapter_context)
begin
yield
ensure
set_context_wrapper(old_ctx)
@@ -112,16 +112,16 @@
def broker_name
Broker::DEFAULT_BROKER_NAME
end
- def for_broker(_broker_name)
- Module.new do |mod|
+ def for_broker(name)
+ Module.new do
include Client
extend self
define_method :broker_name do
- _broker_name
+ name
end
end
end
module_function :for_broker