Sha256: c436b3d140956a8762cda959e6a104c9a1373bc25c8318aac4504d9380c9f8bc

Contents?: true

Size: 1.36 KB

Versions: 4

Compression:

Stored size: 1.36 KB

Contents

module Stomper
  module Frames
    # Encapsulates a "MESSAGE" server side frame for the Stomp Protocol.
    #
    # See the {Stomp Protocol Specification}[http://stomp.codehaus.org/Protocol]
    # for more details.
    class Message < Stomper::Frames::ServerFrame
      # This class is the factory for all MESSAGE frames received.
      factory_for :message

      # Creates a new message frame with the given +headers+ and +body+
      def initialize(headers, body)
        super('MESSAGE', headers, body)
      end

      # Returns the message id generated by the stomp broker.
      #
      # This is a convenience method for:
      # frame.headers[:'message-id'] or frame.headers['message-id']
      def id
        @headers[:'message-id']
      end

      # Returns the destination from which this message was delivered.
      #
      # This is a convenience method for:
      # frame.headers.destination, frame.headers['destination'], or
      # frame.headers[:destination]
      def destination
        @headers.destination
      end

      # Returns the name of the subscription which is responsible for the
      # client having received this message.
      #
      # This is a convenience method for:
      # frame.headers.subscription, frame.headers['subscription'] or
      # frame.headers[:subscription]
      def subscription
        @headers.subscription
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
stomper-0.4 lib/stomper/frames/message.rb
stomper-0.3.2 lib/stomper/frames/message.rb
stomper-0.3.1 lib/stomper/frames/message.rb
stomper-0.3.0 lib/stomper/frames/message.rb