Class: TorqueBox::Messaging::MarshalMessage

Inherits:
Message
  • Object
show all
Defined in:
messaging/lib/torquebox/messaging/marshal_message.rb

Constant Summary

ENCODING =
:marshal
JMS_TYPE =
:bytes

Constants inherited from Message

TorqueBox::Messaging::Message::DEFAULT_DECODE_ENCODING, TorqueBox::Messaging::Message::DEFAULT_ENCODE_ENCODING, TorqueBox::Messaging::Message::ENCODING_PROPERTY

Instance Attribute Summary

Attributes inherited from Message

#:jms_message

Instance Method Summary (collapse)

Methods inherited from Message

class_for_encoding, encoding_map, extract_encoding_from_message, inherited, #initialize, #initialize_from_message, #method_missing, new, #populate_message_headers, #populate_message_properties, register_encoding, #respond_to?, #set_encoding

Constructor Details

This class inherits a constructor from TorqueBox::Messaging::Message

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class TorqueBox::Messaging::Message

Instance Method Details

- (Object) decode



30
31
32
33
34
35
36
37
# File 'messaging/lib/torquebox/messaging/marshal_message.rb', line 30

def decode
  if (length = @jms_message.get_body_length) > 0
    bytes = Java::byte[length].new
    @jms_message.read_bytes( bytes )
    @jms_message.reset
    TorqueBox::Codecs.decode(String.from_java_bytes(bytes), ENCODING)
  end
end

- (Object) encode(message)



26
27
28
# File 'messaging/lib/torquebox/messaging/marshal_message.rb', line 26

def encode(message)
  @jms_message.write_bytes(TorqueBox::Codecs.encode(message, ENCODING).to_java_bytes)
end