Sha256: 38a681ae1bad1d796ffb024823e6a6d6ab224af0989c22903bd9b25b05a7cd8a

Contents?: true

Size: 839 Bytes

Versions: 4

Compression:

Stored size: 839 Bytes

Contents

require_dependency "renalware/feeds"

module Renalware
  module Feeds
    # Responsible for co-ordinating the processing sequences of a raw
    # HL7 message.
    #
    class MessageProcessor
      include Wisper::Publisher

      def call(raw_message)
        message_payload = parse_message(raw_message)
        persist_message(message_payload)

        broadcast(:message_processed, message_payload)
      rescue StandardError => exception
        notify_exception(exception)
        raise exception
      end

      private

      def parse_message(raw_message)
        MessageParser.new.parse(raw_message)
      end

      def persist_message(message_payload)
        PersistMessage.new.call(message_payload)
      end

      def notify_exception(exception)
        ExceptionNotifier.new.notify(exception)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
renalware-core-2.0.0.pre.beta7 app/models/renalware/feeds/message_processor.rb
renalware-core-2.0.0.pre.beta6 app/models/renalware/feeds/message_processor.rb
renalware-core-2.0.0.pre.beta5 app/models/renalware/feeds/message_processor.rb
renalware-core-2.0.0.pre.beta4 app/models/renalware/feeds/message_processor.rb