Module: Stomper::Extensions::Common::V1_1

Defined in:
lib/stomper/extensions/common.rb

Overview

Stomp Protocol 1.1 extensions to the common interface.

Instance Method Summary collapse

Instance Method Details

#ack(message, headers = {}) ⇒ Stomper::Frame #ack(message, subscription_id, headers = {}) ⇒ Stomper::Frame #ack(message_id, subscription_id, headers = {}) ⇒ Stomper::Frame

Acknowledge that a MESSAGE frame has been received and successfully processed. The Stomp 1.1 protocol now requires that both ID of the message and the ID of the subscription the message arrived on must be specified in the ACK frame’s headers.

Examples:

Gonna need some examples for this one…

Overloads:

  • #ack(message, headers = {}) ⇒ Stomper::Frame

    Transmit an ACK frame fro the MESSAGE frame. The appropriate subscription ID will be determined from the MESSAGE frame’s subscription header value.

    Parameters:

    • message (Stomper::Frame)

      the MESSAGE frame to acknowledge

    • headers ({Object => String}) (defaults to: {})

      optional headers to include with the ACK frame

  • #ack(message, subscription_id, headers = {}) ⇒ Stomper::Frame

    Transmit an ACK frame for the MESSAGE frame, but use the supplied subscription ID instead of trying to determine it from the MESSAGE frame’s headers. You should use this method of the broker you are connected to does not include a subscribe header on MESSAGE frames.

    Parameters:

    • message (Stomper::Frame)

      the MESSAGE frame to acknowledge

    • subscription_id (String)

      the ID of the subscription MESSAGE was delivered on.

    • headers ({Object => String}) (defaults to: {})

      optional headers to include with the ACK frame

  • #ack(message_id, subscription_id, headers = {}) ⇒ Stomper::Frame

    Transmit an ACK frame for the MESSAGE frame with an ID of message_id delivered on the subscription with an ID of subscription_id.

    Parameters:

    • message_id (String)

      the ID of the MESSAGE frame to acknowledge

    • subscription_id (String)

      the ID of the subscription MESSAGE was delivered on.

    • headers ({Object => String}) (defaults to: {})

      optional headers to include with the ACK frame

Returns:

Raises:

  • (ArgumentError)

    if the message or subscription IDs cannot be determined



197
198
199
# File 'lib/stomper/extensions/common.rb', line 197

def ack(message_or_id, *args)
  transmit create_ack_or_nack('ACK', message_or_id, args)
end

#nack(message, headers = {}) ⇒ Stomper::Frame #nack(message, subscription_id, headers = {}) ⇒ Stomper::Frame #nack(message_id, subscription_id, headers = {}) ⇒ Stomper::Frame

Inform the broker that a MESSAGE frame was not processed. A NACK frame is, in effect, the opposite of an ACK frame. The NACK command is a new feature introduced in Stomp 1.1, hence why it is unavailable to Stomp 1.0 connections.

Examples:

Gonna need some examples for this one…

Overloads:

  • #nack(message, headers = {}) ⇒ Stomper::Frame

    Transmit a NACK frame fro the MESSAGE frame. The appropriate subscription ID will be determined from the MESSAGE frame’s subscription header value.

    Parameters:

    • message (Stomper::Frame)

      the MESSAGE frame to un-acknowledge

    • headers ({Object => String}) (defaults to: {})

      optional headers to include with the NACK frame

  • #nack(message, subscription_id, headers = {}) ⇒ Stomper::Frame

    Transmit a NACK frame for the MESSAGE frame, but use the supplied subscription ID instead of trying to determine it from the MESSAGE frame’s headers. You should use this method of the broker you are connected to does not include a subscribe header on MESSAGE frames.

    Parameters:

    • message (Stomper::Frame)

      the MESSAGE frame to un-acknowledge

    • subscription_id (String)

      the ID of the subscription MESSAGE was delivered on.

    • headers ({Object => String}) (defaults to: {})

      optional headers to include with the NACK frame

  • #nack(message_id, subscription_id, headers = {}) ⇒ Stomper::Frame

    Transmit a NACK frame for the MESSAGE frame with an ID of message_id delivered on the subscription with an ID of subscription_id.

    Parameters:

    • message_id (String)

      the ID of the MESSAGE frame to un-acknowledge

    • subscription_id (String)

      the ID of the subscription MESSAGE was delivered on.

    • headers ({Object => String}) (defaults to: {})

      optional headers to include with the NACK frame

Returns:

Raises:

  • (ArgumentError)

    if the message or subscription IDs cannot be determined



229
230
231
# File 'lib/stomper/extensions/common.rb', line 229

def nack(message_or_id, *args)
  transmit create_ack_or_nack('NACK', message_or_id, args)
end