Class List Method List File List

# Class: VertxStomp::Frames

Inherits:
  Object
  - Object
  - VertxStomp::Frames
  show all
Defined in:
  /Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/frames.rb

## Overview

Utility methods to build common Hashs. It defines a non-STOMP frame (`PING`) that is used for heartbeats. When such frame is written on the wire it is just the `0` byte.

This class is thread-safe.

## Class Method Summary (collapse)

- + (Hash) create_error_frame(message = nil, headers = nil, body = nil)
- + (Hash) create_receipt_frame(receiptId = nil, headers = nil)
- + (void) handle_receipt(frame = nil, connection = nil)
- + (Hash) ping

## Class Method Details

### + (`Hash`) create_error_frame(message = nil, headers = nil, body = nil)

Parameters:

- message (`String`) (defaults to: `nil`)
- headers (`Hash{String => String}`) (defaults to: `nil`)
- body (`String`) (defaults to: `nil`)

Returns:

- (`Hash`)

Raises:

- (`ArgumentError`)

    24
    25
    26
    27
    28
    29
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/frames.rb', line 24

    def self.create_error_frame(message=nil,headers=nil,body=nil)
      if message.class == String && headers.class == Hash && body.class == String && !block_given?
        return Java::IoVertxExtStomp::Frames.java_method(:createErrorFrame, [Java::java.lang.String.java_class,Java::JavaUtil::Map.java_class,Java::java.lang.String.java_class]).call(message,Hash[headers.map { |k,v| [k,v] }],body) != nil ? JSON.parse(Java::IoVertxExtStomp::Frames.java_method(:createErrorFrame, [Java::java.lang.String.java_class,Java::JavaUtil::Map.java_class,Java::java.lang.String.java_class]).call(message,Hash[headers.map { |k,v| [k,v] }],body).toJson.encode) : nil
      end
      raise ArgumentError, "Invalid arguments when calling create_error_frame(message,headers,body)"
    end

### + (`Hash`) create_receipt_frame(receiptId = nil, headers = nil)

Parameters:

- receiptId (`String`) (defaults to: `nil`)
- headers (`Hash{String => String}`) (defaults to: `nil`)

Returns:

- (`Hash`)

Raises:

- (`ArgumentError`)

    33
    34
    35
    36
    37
    38
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/frames.rb', line 33

    def self.create_receipt_frame(receiptId=nil,headers=nil)
      if receiptId.class == String && headers.class == Hash && !block_given?
        return Java::IoVertxExtStomp::Frames.java_method(:createReceiptFrame, [Java::java.lang.String.java_class,Java::JavaUtil::Map.java_class]).call(receiptId,Hash[headers.map { |k,v| [k,v] }]) != nil ? JSON.parse(Java::IoVertxExtStomp::Frames.java_method(:createReceiptFrame, [Java::java.lang.String.java_class,Java::JavaUtil::Map.java_class]).call(receiptId,Hash[headers.map { |k,v| [k,v] }]).toJson.encode) : nil
      end
      raise ArgumentError, "Invalid arguments when calling create_receipt_frame(receiptId,headers)"
    end

### + (`void`) handle_receipt(frame = nil, connection = nil)

This method returns an undefined value.

Parameters:

- frame (`Hash`) (defaults to: `nil`)
- connection (`::VertxStomp::StompServerConnection`) (defaults to: `nil`)

Raises:

- (`ArgumentError`)

    42
    43
    44
    45
    46
    47
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/frames.rb', line 42

    def self.handle_receipt(frame=nil,connection=nil)
      if frame.class == Hash && connection.class.method_defined?(:j_del) && !block_given?
        return Java::IoVertxExtStomp::Frames.java_method(:handleReceipt, [Java::IoVertxExtStomp::Frame.java_class,Java::IoVertxExtStomp::StompServerConnection.java_class]).call(Java::IoVertxExtStomp::Frame.new(::Vertx::Util::Utils.to_json_object(frame)),connection.j_del)
      end
      raise ArgumentError, "Invalid arguments when calling handle_receipt(frame,connection)"
    end

### + (`Hash`) ping

Returns:

- (`Hash`)

Raises:

- (`ArgumentError`)

    49
    50
    51
    52
    53
    54
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/frames.rb', line 49

    def self.ping
      if !block_given?
        return Java::IoVertxExtStomp::Frames.java_method(:ping, []).call() != nil ? JSON.parse(Java::IoVertxExtStomp::Frames.java_method(:ping, []).call().toJson.encode) : nil
      end
      raise ArgumentError, "Invalid arguments when calling ping()"
    end