lib/bbk/app/dispatcher.rb in bbk-app-1.1.0.199604 vs lib/bbk/app/dispatcher.rb in bbk-app-1.1.0.199675
- old
+ new
@@ -57,20 +57,10 @@
def register_publisher(publisher)
raise "Publisher support #{DEFAULT_PROTOCOL}" if publisher.protocols.include?(DEFAULT_PROTOCOL)
publishers << publisher
end
- # set default publisher for results with empty scheme or DEFAULT_PROTOCOL scheme
- def default_publisher=(publisher)
- @default_publisher = publisher
- end
-
- # get default publisher
- def default_publisher
- @default_publisher || (publishers.size == 1 ? publishers.first : nil)
- end
-
def register_middleware(middleware)
middlewares << middleware
end
# Run all consumers and blocks on message processing
@@ -220,13 +210,9 @@
# @return [Concurrent::Promises::ResolvableFuture]
def publish_result(result)
route = result.route
logger.debug "Publish result to #{route} ..."
publisher = publishers.find {|pub| pub.protocols.include?(route.scheme) }
- if route.scheme.nil? || route.scheme == DEFAULT_PROTOCOL
- logger.debug "Use default publisher for result with route=#{route}"
- publisher = default_publisher
- end
raise "Not found publisher for scheme #{route.scheme}" if publisher.nil?
# return Concurrent::Promises.resolvable_future
publisher.publish(result)
end