Sha256: 01a6c6c0c4adb471a6c2d074979dd42c880c40504e0ae78c2e68d03075bbdd06

Contents?: true

Size: 624 Bytes

Versions: 7

Compression:

Stored size: 624 Bytes

Contents

module SalesforceStreamer
  class MessageReceiver
    class << self
      # @param topic [String] The unique Salesforce Topic name
      # @param handler [Object] An object that responds to .call(message)
      # @param message [Hash] The event payload
      def call(topic, handler, message)
        if handler.respond_to? :perform_async
          handler.perform_async message
        else
          handler.call message
        end
        ReplayPersistence.record topic, message.dig('event', 'replayId')
      rescue StandardError => e
        Configuration.instance.exception_adapter.call e
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
salesforce_streamer-1.1.3 lib/salesforce_streamer/message_receiver.rb
salesforce_streamer-1.1.1 lib/salesforce_streamer/message_receiver.rb
salesforce_streamer-1.1.0 lib/salesforce_streamer/message_receiver.rb
salesforce_streamer-1.0.0 lib/salesforce_streamer/message_receiver.rb
salesforce_streamer-0.5.0 lib/salesforce_streamer/message_receiver.rb
salesforce_streamer-0.4.1 lib/salesforce_streamer/message_receiver.rb
salesforce_streamer-0.4.0 lib/salesforce_streamer/message_receiver.rb