Sha256: c842ec41ae8a60ce105b7dee6160f8c06669b1a3179dbce45dd85225e4da3cd3

Contents?: true

Size: 753 Bytes

Versions: 6

Compression:

Stored size: 753 Bytes

Contents

module SneakersPacker
  module RpcWorker
    def self.included(klass)
      klass.class_eval do
        include ::Sneakers::Worker
      end
    end

    def packer
      SneakersPacker.message_packer
    end

    def work_with_params(message, delivery_info, metadata)
      #puts "get #{message}"
      request_data, from = packer.unpack_request message
      #puts "call from #{from}"

      #begin
      response_data = call request_data
      result = packer.pack_response response_data, 200
      # rescue Exception => ex
      #   # caught exeption
      #   result = packer.pack_response nil, 500
      # ensure
      publish(result, to_queue: metadata.reply_to, correlation_id: metadata.correlation_id)

      ack!
      #end
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
sneakers_packer-0.2.0 lib/sneakers_packer/rpc_worker.rb
sneakers_packer-0.1.5 lib/sneakers_packer/rpc_worker.rb
sneakers_packer-0.1.4 lib/sneakers_packer/rpc_worker.rb
sneakers_packer-0.1.3 lib/sneakers_packer/rpc_worker.rb
sneakers_packer-0.1.2 lib/sneakers_packer/rpc_worker.rb
sneakers_packer-0.1.1 lib/sneakers_packer/rpc_worker.rb