Class Qpid::Proton::Message
In: lib/core/message.rb
Parent: Object

Messsage data and headers that can sent or received on a {Link}

{body} is the main message content. {properties} is a {Hash} of extra properties that can be attached to the message.

@example Create a message containing a Unicode string

  msg = Qpid::Proton::Message.new "this is a string"

@example Create a message containing binary data

  msg = Qpid::Proton::Message.new
  msg.body = Qpid::Proton::BinaryString.new(File.binread("/home/qpid/binfile.tar.gz"))

Methods

Included Modules

Util::Deprecation Util::Wrapper

Constants

PROTON_METHOD_PREFIX = "pn_message"   @private

Attributes

annotations  [RW]  @return [Hash] Delivery annotations for this message.
body  [RW]  @return [Object] body of the message.
instructions  [RW]  @return [Hash] Delivery instructions for this message.
properties  [RW]  @return [Hash] Application properties for the message

Public Class methods

Creates a new Message instance. @param body the body of the message, equivalent to calling m.body=(body) @param opts [Hash] additional options, equivalent to +Message#key=value+ for each +key=>value+

Public Instance methods

Equivalent to +{properties}[name]+

Equivalent to +{properties}[name] = value+

Returns the destination address.

Sets the destination address.

Options

Clears the state of the Message. This allows a single instance of Message to be reused.

@deprecated use {body}

@deprecated use {body=}

Returns the content encoding type.

Sets the content encoding type.

Options

Returns the content type

Sets the content type.

Options

Returns the correlation id.

Sets the correlation id.

Options

  • id - the correlation id

Returns the creation time.

Sets the creation time.

Options

  • time - the creation time

Decodes a message from AMQP binary data. @param encoded [String] the encoded bytes @return[Integer] the number of bytes consumed

Equivalent to +{properties}.delete(name)+

Returns the delivery count for the message.

This is the number of delivery attempts for the given message.

Sets the delivery count for the message.

See ::delivery_count for more details.

Options

  • count - the delivery count

Returns the durable property.

The durable property indicates that the emessage should be held durably by any intermediaries taking responsibility for the message.

Examples

 msg = Qpid::Proton::Message.new
 msg.durable = true

Sets the durable flag.

See ::durable for more details on message durability.

Options

Encodes the message.

Returns the most recent error number.

Returns the most recent error message.

Returns whether there is currently an error reported.

Returns the expiration time.

Sets the expiration time.

Options

  • time - the expiry time

Sets whether this is the first time the message was acquired.

See ::first_acquirer? for more details.

Options

  • state - true if claiming the message

Returns whether this is the first acquirer.

Returns the group id.

Sets the group id.

Options

Returns the group sequence number.

Sets the group sequence number.

Options

  • seq - the sequence number

Returns the message id.

Sets the message id.

Options

Returns the priority.

Sets the priority.

+NOTE:+ Priority values are limited to the range [0,255].

Options

Returns the reply-to address

Sets the reply-to address.

Options

Returns the reply-to group id.

Sets the reply-to group id.

Options

Returns the subject

Sets the subject.

Options

Returns the time-to-live, in milliseconds.

Sets the time-to-live for the message.

Options

  • time - the time in milliseconds

Returns the user id.

Sets the user id.

Options

[Validate]