lib/deimos/producer.rb in deimos-ruby-1.3.0.pre.beta5 vs lib/deimos/producer.rb in deimos-ruby-1.4.0.pre.beta1
- old
+ new
@@ -61,11 +61,11 @@
class << self
# @return [Hash]
def config
@config ||= {
encode_key: true,
- namespace: Deimos.config.producer_schema_namespace
+ namespace: Deimos.config.producers.schema_namespace
}
end
# Set the topic.
# @param topic [String]
@@ -74,11 +74,11 @@
if topic
config[:topic] = topic
return
end
# accessor
- "#{Deimos.config.producer_topic_prefix}#{config[:topic]}"
+ "#{Deimos.config.producers.topic_prefix}#{config[:topic]}"
end
# Override the default partition key (which is the payload key).
# @param _payload [Hash] the payload being passed into the produce method.
# Will include `payload_key` if it is part of the original payload.
@@ -98,12 +98,12 @@
# @param sync [Boolean] if given, override the default setting of
# whether to publish synchronously.
# @param force_send [Boolean] if true, ignore the configured backend
# and send immediately to Kafka.
def publish_list(payloads, sync: nil, force_send: false)
- return if Deimos.config.seed_broker.blank? ||
- Deimos.config.disable_producers ||
+ return if Deimos.config.kafka.seed_brokers.blank? ||
+ Deimos.config.producers.disabled ||
Deimos.producers_disabled?(self)
backend_class = determine_backend_class(sync, force_send)
Deimos.instrument(
'encode_messages',
@@ -124,10 +124,10 @@
# @return [Class < Deimos::Backend]
def determine_backend_class(sync, force_send)
backend = if force_send
:kafka
else
- Deimos.config.publish_backend
+ Deimos.config.producers.backend
end
if backend == :kafka_async && sync
backend = :kafka
elsif backend == :kafka && sync == false
backend = :kafka_async