Class: VertxStomp::StompClient

Inherits:
Object
  • Object
show all
Defined in:
/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/stomp_client.rb

Overview

Defines a STOMP client.

Class Method Summary (collapse)

Instance Method Summary (collapse)

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:

Raises:

  • (ArgumentError)


23
24
25
26
27
28
29
30
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/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)


105
106
107
108
109
110
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/stomp_client.rb', line 105

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:

    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-stack/stack-docs/target/rb/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

- (self) error_frame_handler { ... }

A general error frame handler. It can be used to catch ERROR frame emitted during the connection process (wrong authentication). This error handler will be pass to all VertxStomp::StompClientConnection created from this client. Obviously, the client can override it when the connection is established.

Yields:

  • the handler

Returns:

  • (self)

Raises:

  • (ArgumentError)


96
97
98
99
100
101
102
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/stomp_client.rb', line 96

def error_frame_handler
  if block_given?
    @j_del.java_method(:errorFrameHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(event != nil ? JSON.parse(event.toJson.encode) : nil) }))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling error_frame_handler()"
end

- (Hash) options

@return the client's options.

Returns:

  • (Hash)

Raises:

  • (ArgumentError)


113
114
115
116
117
118
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/stomp_client.rb', line 113

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

- (self) received_frame_handler { ... }

Configures a received handler that gets notified when a STOMP frame is received by the client. This handler can be used for logging, debugging or ad-hoc behavior. The frame can still be modified at the time.

When a connection is created, the handler is used as VertxStomp::StompClientConnection#received_frame_handler.

Yields:

  • the handler

Returns:

  • (self)

Raises:

  • (ArgumentError)


70
71
72
73
74
75
76
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/stomp_client.rb', line 70

def received_frame_handler
  if block_given?
    @j_del.java_method(:receivedFrameHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(event != nil ? JSON.parse(event.toJson.encode) : nil) }))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling received_frame_handler()"
end

- (::Vertx::Vertx) vertx

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

Returns:

Raises:

  • (ArgumentError)


121
122
123
124
125
126
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/stomp_client.rb', line 121

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

- (self) writing_frame_handler { ... }

Configures a writing handler that gets notified when a STOMP frame is written on the wire. This handler can be used for logging, debugging or ad-hoc behavior. The frame can still be modified at the time.

When a connection is created, the handler is used as VertxStomp::StompClientConnection#writing_frame_handler.

Yields:

  • the handler

Returns:

  • (self)

Raises:

  • (ArgumentError)


84
85
86
87
88
89
90
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/stomp_client.rb', line 84

def writing_frame_handler
  if block_given?
    @j_del.java_method(:writingFrameHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(event != nil ? JSON.parse(event.toJson.encode) : nil) }))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling writing_frame_handler()"
end