Sha256: 2fe3cad1d6fcf8f36495bf8d76d9abdd440aafffffa17a3ea8c9d1cbae345b3a

Contents?: true

Size: 536 Bytes

Versions: 3

Compression:

Stored size: 536 Bytes

Contents

module RailwayIpc
  class Handler
    include Sneakers::Worker
    class << self
      attr_reader :block
    end

    def self.handle(&block)
      @block = block
    end

    def handle(message)
      RailwayIpc.logger.info(message, "Handling message")
      response = self.class.block.call(message)
      if response.success?
        RailwayIpc.logger.info(message, "Successfully handled message")
        ack!
      else
        RailwayIpc.logger.error(message, "Failed to handle message")
        ack!
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
railway-ipc-0.1.3 lib/railway_ipc/handler.rb
railway-ipc-0.1.2 lib/railway_ipc/handler.rb
railway-ipc-0.1.1 lib/railway_ipc/handler.rb