lib/propono/services/publisher.rb in propono-0.5.6 vs lib/propono/services/publisher.rb in propono-0.6.0

- old
+ new

@@ -1,7 +1,7 @@ module Propono - class PublisherError < Exception + class PublisherError < ProponoError end class Publisher include Sns @@ -26,20 +26,17 @@ private def publish_via_sns topic = TopicCreator.find_or_create(topic_id) - sns.publish(topic.arn, message) + msg = message.is_a?(String) ? message : message.to_json + sns.publish(topic.arn, msg) end def publish_via_udp payload = {topic: topic_id, message: message}.to_json - UDPSocket.new.send(payload, 0, config.udp_host, config.udp_port) + UDPSocket.new.send(payload, 0, Propono.config.udp_host, Propono.config.udp_port) rescue SocketError => e - config.logger.puts "Udp2sqs failed to send : #{e}" - end - - def config - Configuration.instance + Propono.config.logger.error "Propono failed to send : #{e}" end end end