Sha256: 531515a891c9be024d44fc580fb843658c9a96e6bc1cf795a00bbc7dce67ae50

Contents?: true

Size: 907 Bytes

Versions: 2

Compression:

Stored size: 907 Bytes

Contents

module Qwirk
  module Adapter
    module JMS
      class Util
        class << self
          def create_message(session, marshaled_object, marshal_type)
            case marshal_type
              when :text
                session.create_text_message(marshaled_object)
              when :bytes
                msg = session.create_bytes_message()
                msg.data = marshaled_object
                msg
              else raise "Invalid marshal type: #{marshal_type}"
            end
          end

          def parse_response(message)
            if error_yaml = message['qwirk:exception']
              return Qwirk::RemoteException.unmarshal(error_yaml)
            end
            marshaler = Qwirk::MarshalStrategy.find(message['qwirk:marshal'] || WorkerConfig.default_marshal_sym)
            return marshaler.unmarshal(message.data)
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
qwirk_jms_adapter-0.2.1-java lib/qwirk/adapter/jms/util.rb
qwirk_jms_adapter-0.2.0-java lib/qwirk/adapter/jms/util.rb