Sha256: ca36b96d258c4d1a8aa0d42e2b788185678f1c2de5a9492254152139098826cb

Contents?: true

Size: 918 Bytes

Versions: 1

Compression:

Stored size: 918 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.from_hash(YAML.load(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

1 entries across 1 versions & 1 rubygems

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