lib/deimos/config/configuration.rb in deimos-ruby-1.7.0.pre.beta1 vs lib/deimos/config/configuration.rb in deimos-ruby-1.8.0.pre.beta1

- old
+ new

@@ -45,20 +45,18 @@ def self.validate_consumers Phobos.config.listeners.each do |listener| handler_class = listener.handler.constantize delivery = listener.delivery - # Validate that Deimos consumers use proper delivery configs - if handler_class < Deimos::BatchConsumer - unless delivery == 'inline_batch' - raise "BatchConsumer #{listener.handler} must have delivery set to"\ - ' `inline_batch`' + next unless handler_class < Deimos::Consumer + + # Validate that each consumer implements the correct method for its type + if delivery == 'inline_batch' + if handler_class.instance_method(:consume_batch).owner == Deimos::Consume::BatchConsumption + raise "BatchConsumer #{listener.handler} does not implement `consume_batch`" end - elsif handler_class < Deimos::Consumer - if delivery.present? && !%w(message batch).include?(delivery) - raise "Non-batch Consumer #{listener.handler} must have delivery"\ - ' set to `message` or `batch`' - end + elsif handler_class.instance_method(:consume).owner == Deimos::Consume::MessageConsumption + raise "Non-batch Consumer #{listener.handler} does not implement `consume`" end end end # @param kafka_config [Configurable::ConfigStruct]