Sha256: 285e2475b858c3c7d9060005c76a0199cb067b7da197fb34c3808fa6c97b28ae

Contents?: true

Size: 1.55 KB

Versions: 4

Compression:

Stored size: 1.55 KB

Contents

module Stomper
  module Frames
    # Encapsulates a "SUBSCRIBE" frame from the Stomp Protocol.
    #
    # See the {Stomp Protocol Specification}[http://stomp.codehaus.org/Protocol]
    # for more details.
    class Subscribe < Stomper::Frames::ClientFrame
      def initialize(destination, headers={})
        super('SUBSCRIBE', headers)
        @headers['destination'] = destination
        @headers['ack'] ||= 'auto'
      end

      # Returns the ack mode of this subscription. (defaults to 'auto')
      #
      # This is a convenience method, and may also be accessed through
      # frame.headers.ack or frame.headers[:ack] or frame.headers['ack']
      def ack
        @headers['ack']
      end

      # Returns the destination to which we are subscribing.
      #
      # This is a convenience method, and may also be accessed through
      # frame.headers.destination or frame.headers[:destination] or frame.headers['destination']
      def destination
        @headers['destination']
      end

      # Returns the id of this subscription, if it has been set.
      #
      # This is a convenience method, and may also be accessed through
      # frame.headers.id or frame.headers[:id] or frame.headers['id']
      def id
        @headers['id']
      end

      # Returns the selector header of this subscription, if it has been set.
      #
      # This is a convenience method, and may also be accessed through
      # frame.headers.selector or frame.headers[:selector] or frame.headers['selector']
      def selector
        @headers['selector']
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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