A message serializer that serializes Messages
with MessagePack
.
The message is converted to a hash with this structure:
{
p: <payload>,
h: {
header1: value1,
header2: value2,
...
}
}
Then it is converted to the MessagePack
format.
Methods
- B
-
- D
-
- L
-
Instance Public methods
dump(message)
Link
Source:
show
|
on GitHub
def dump(message)
raise Errors::ForbiddenClass unless message.is_a?(Message)
ActiveSupport::MessagePack.dump(message_to_hash(message))
end
load(serialized_content)
Link
Source:
show
|
on GitHub
def load(serialized_content)
data = ActiveSupport::MessagePack.load(serialized_content)
hash_to_message(data, 1)
rescue RuntimeError
raise Errors::Decryption
end