Class List Method List File List

# Class: VertxStomp::StompClient

Inherits:
  Object
  - Object
  - VertxStomp::StompClient
  show all
Defined in:
  /Users/julien/java/vertx-aggregator/modules/vertx-stomp/src/main/resources/vertx-stomp/stomp_client.rb

## Overview

Defines a STOMP client.

## Class Method Summary (collapse)

- + (::VertxStomp::StompClient) create(vertx = nil, options = nil)
  Creates a StompClient using the default implementation.

## Instance Method Summary (collapse)

- - (void) close
  Closes the client.
- - (self) connect(param_1 = nil, param_2 = nil, param_3 = nil)
  Connects to the server.
- - (Hash) options
  @return the client's options.
- - (::Vertx::Vertx) vertx
  @return the vert.x instance used by the client.

## Class Method Details

### + (`::VertxStomp::StompClient`) create(vertx = nil, options = nil)

Creates a VertxStomp::StompClient using the default implementation.

Parameters:

- vertx (`::Vertx::Vertx`) (defaults to: `nil`) —
  the vert.x instance to use
- options (`Hash`) (defaults to: `nil`) —
  the options

Returns:

- (`::VertxStomp::StompClient`) —
  the created VertxStomp::StompClient

Raises:

- (`ArgumentError`)

    23
    24
    25
    26
    27
    28
    29
    30
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-stomp/src/main/resources/vertx-stomp/stomp_client.rb', line 23

    def self.create(vertx=nil,options=nil)
      if vertx.class.method_defined?(:j_del) && !block_given? && options == nil
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtStomp::StompClient.java_method(:create, [Java::IoVertxCore::Vertx.java_class]).call(vertx.j_del),::VertxStomp::StompClient)
      elsif vertx.class.method_defined?(:j_del) && options.class == Hash && !block_given?
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtStomp::StompClient.java_method(:create, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxExtStomp::StompClientOptions.java_class]).call(vertx.j_del,Java::IoVertxExtStomp::StompClientOptions.new(::Vertx::Util::Utils.to_json_object(options))),::VertxStomp::StompClient)
      end
      raise ArgumentError, "Invalid arguments when calling create(vertx,options)"
    end

## Instance Method Details

### - (`void`) close

This method returns an undefined value.

Closes the client.

Raises:

- (`ArgumentError`)

    65
    66
    67
    68
    69
    70
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-stomp/src/main/resources/vertx-stomp/stomp_client.rb', line 65

    def close
      if !block_given?
        return @j_del.java_method(:close, []).call()
      end
      raise ArgumentError, "Invalid arguments when calling close()"
    end

### - (`self`) connect(resultHandler) { ... } - (`self`) connect(net, resultHandler) { ... } - (`self`) connect(port, host, resultHandler) { ... } - (`self`) connect(port, host, net, resultHandler) { ... }

Connects to the server.

Overloads:

- - (`self`) connect(resultHandler) { ... }

  Yields:

  - handler called with the connection result
- - (`self`) connect(net, resultHandler) { ... }

  Parameters:

  - net (`::Vertx::NetClient`) —
    the NET client to use

  Yields:

  - handler called with the connection result
- - (`self`) connect(port, host, resultHandler) { ... }

  Parameters:

  - port (`Fixnum`) —
    the server port
  - host (`String`) —
    the server host

  Yields:

  - handler called with the connection result
- - (`self`) connect(port, host, net, resultHandler) { ... }

  Parameters:

  - port (`Fixnum`) —
    the server port
  - host (`String`) —
    the server host
  - net (`::Vertx::NetClient`) —
    the NET client to use

  Yields:

  - handler called with the connection result

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-stomp/src/main/resources/vertx-stomp/stomp_client.rb', line 47

    def connect(param_1=nil,param_2=nil,param_3=nil)
      if block_given? && param_1 == nil && param_2 == nil && param_3 == nil
        @j_del.java_method(:connect, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxStomp::StompClientConnection) : nil) }))
        return self
      elsif param_1.class.method_defined?(:j_del) && block_given? && param_2 == nil && param_3 == nil
        @j_del.java_method(:connect, [Java::IoVertxCoreNet::NetClient.java_class,Java::IoVertxCore::Handler.java_class]).call(param_1.j_del,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxStomp::StompClientConnection) : nil) }))
        return self
      elsif param_1.class == Fixnum && param_2.class == String && block_given? && param_3 == nil
        @j_del.java_method(:connect, [Java::int.java_class,Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(param_1,param_2,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxStomp::StompClientConnection) : nil) }))
        return self
      elsif param_1.class == Fixnum && param_2.class == String && param_3.class.method_defined?(:j_del) && block_given?
        @j_del.java_method(:connect, [Java::int.java_class,Java::java.lang.String.java_class,Java::IoVertxCoreNet::NetClient.java_class,Java::IoVertxCore::Handler.java_class]).call(param_1,param_2,param_3.j_del,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxStomp::StompClientConnection) : nil) }))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling connect(param_1,param_2,param_3)"
    end

### - (`Hash`) options

@return the client's options.

Returns:

- (`Hash`)

Raises:

- (`ArgumentError`)

    73
    74
    75
    76
    77
    78
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-stomp/src/main/resources/vertx-stomp/stomp_client.rb', line 73

    def options
      if !block_given?
        return @j_del.java_method(:options, []).call() != nil ? JSON.parse(@j_del.java_method(:options, []).call().toJson.encode) : nil
      end
      raise ArgumentError, "Invalid arguments when calling options()"
    end

### - (`::Vertx::Vertx`) vertx

@return the vert.x instance used by the client.

Returns:

- (`::Vertx::Vertx`)

Raises:

- (`ArgumentError`)

    81
    82
    83
    84
    85
    86
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-stomp/src/main/resources/vertx-stomp/stomp_client.rb', line 81

    def vertx
      if !block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:vertx, []).call(),::Vertx::Vertx)
      end
      raise ArgumentError, "Invalid arguments when calling vertx()"
    end