Class: VertxHealthChecks::HealthCheckHandler

Inherits:
Object
  • Object
show all
Defined in:
/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-health-checks/health_check_handler.rb

Overview

A Vert.x Web handler on which you register health check procedure. It computes the outcome status (`UP` or `DOWN`) . When the handler process a HTTP request, it computes the global outcome and build a HTTP response as follows:

  • 204 - status is `UP` but no procedures installed (no payload)
  • 200 - status is `UP`, the payload contains the result of the installed procedures
  • 503 - status is `DOWN`, the payload contains the result of the installed procedures
  • 500 - status is `DOWN`, the payload contains the result of the installed procedures, one of the procedure has failed

Constant Summary

@@j_api_type =
Object.new

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Boolean) accept?(obj)

Returns:

  • (Boolean)


32
33
34
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-health-checks/health_check_handler.rb', line 32

def @@j_api_type.accept?(obj)
  obj.class == HealthCheckHandler
end

+ (::VertxHealthChecks::HealthCheckHandler) create(vertx) + (::VertxHealthChecks::HealthCheckHandler) create(vertx, provider)

Creates an instance of the default implementation of the VertxHealthChecks::HealthCheckHandler. This function creates a new instance of VertxHealthChecks::HealthChecks.

Overloads:

Returns:



89
90
91
92
93
94
95
96
97
98
99
100
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-health-checks/health_check_handler.rb', line 89

def self.create(*args)
  if args[0].class.method_defined?(:j_del) && !block_given? && args[1] == nil
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtHealthchecks::HealthCheckHandler.java_method(:create, [Java::IoVertxCore::Vertx.java_class]).call(args[0].j_del),::VertxHealthChecks::HealthCheckHandler)
  elsif args[0].class.method_defined?(:j_del) && args[1].class.method_defined?(:j_del) && !block_given?
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtHealthchecks::HealthCheckHandler.java_method(:create, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxExtAuth::AuthProvider.java_class]).call(args[0].j_del,args[1].j_del),::VertxHealthChecks::HealthCheckHandler)
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling create(#{args[0]},#{args[1]})"
  end
end

+ (::VertxHealthChecks::HealthCheckHandler) createWithHealthChecks(hc) + (::VertxHealthChecks::HealthCheckHandler) createWithHealthChecks(hc, provider)

Creates an instance of the default implementation of the VertxHealthChecks::HealthCheckHandler.

Overloads:

Returns:



54
55
56
57
58
59
60
61
62
63
64
65
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-health-checks/health_check_handler.rb', line 54

def self.create_with_health_checks(*args)
  if args[0].class.method_defined?(:j_del) && !block_given? && args[1] == nil
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtHealthchecks::HealthCheckHandler.java_method(:createWithHealthChecks, [Java::IoVertxExtHealthchecks::HealthChecks.java_class]).call(args[0].j_del),::VertxHealthChecks::HealthCheckHandler)
  elsif args[0].class.method_defined?(:j_del) && args[1].class.method_defined?(:j_del) && !block_given?
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtHealthchecks::HealthCheckHandler.java_method(:createWithHealthChecks, [Java::IoVertxExtHealthchecks::HealthChecks.java_class,Java::IoVertxExtAuth::AuthProvider.java_class]).call(args[0].j_del,args[1].j_del),::VertxHealthChecks::HealthCheckHandler)
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling create_with_health_checks(#{args[0]},#{args[1]})"
  end
end

+ (Object) j_api_type



41
42
43
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-health-checks/health_check_handler.rb', line 41

def self.j_api_type
  @@j_api_type
end

+ (Object) j_class



44
45
46
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-health-checks/health_check_handler.rb', line 44

def self.j_class
  Java::IoVertxExtHealthchecks::HealthCheckHandler.java_class
end

+ (Object) unwrap(obj)



38
39
40
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-health-checks/health_check_handler.rb', line 38

def @@j_api_type.unwrap(obj)
  obj.j_del
end

+ (Object) wrap(obj)



35
36
37
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-health-checks/health_check_handler.rb', line 35

def @@j_api_type.wrap(obj)
  HealthCheckHandler.new(obj)
end

Instance Method Details

- (void) handle(event)

This method returns an undefined value.

Something has happened, so handle it.

Parameters:



105
106
107
108
109
110
111
112
113
114
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-health-checks/health_check_handler.rb', line 105

def handle(*args)
  if args[0].class.method_defined?(:j_del) && !block_given?
    return @j_del.java_method(:handle, [Java::IoVertxExtWeb::RoutingContext.java_class]).call(args[0].j_del)
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling handle(#{args[0]})"
  end
end

- (self) register(name, procedure) { ... } - (self) register(name, timeout, procedure) { ... }

Registers a health check procedure.

The procedure is a taking a of => Object} as parameter. Procedures are asynchronous, and must complete or fail the given . If the future object is failed, the procedure outcome is considered as `DOWN`. If the future is completed without any object, the procedure outcome is considered as `UP`. If the future is completed with a (not-null) => Object}, the procedure outcome is the received status.

Overloads:

  • - (self) register(name, procedure) { ... }

    Parameters:

    • name (String)
      the name of the procedure, must not be null or empty

    Yields:

    • the procedure, must not be null
  • - (self) register(name, timeout, procedure) { ... }

    Parameters:

    • name (String)
      the name of the procedure, must not be null or empty
    • timeout (Fixnum)
      the procedure timeout

    Yields:

    • the procedure, must not be null

Returns:

  • (self)


130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-health-checks/health_check_handler.rb', line 130

def register(*args)
  if args[0].class == String && true && args[1] == nil
    @j_del.java_method(:register, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],(Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::Vertx::Promise,::Vertx::Util::data_object_type(Java::IoVertxExtHealthchecks::Status))) unless !block_given? }))
    return self
  elsif args[0].class == String && args[1].class == Fixnum && true
    @j_del.java_method(:register, [Java::java.lang.String.java_class,Java::long.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],args[1],(Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::Vertx::Promise,::Vertx::Util::data_object_type(Java::IoVertxExtHealthchecks::Status))) unless !block_given? }))
    return self
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling register(#{args[0]},#{args[1]})"
  end
end

- (self) unregister(name)

Unregisters a procedure.

Parameters:

  • name (String)
    the name of the procedure

Returns:

  • (self)


70
71
72
73
74
75
76
77
78
79
80
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-health-checks/health_check_handler.rb', line 70

def unregister(*args)
  if args[0].class == String && !block_given?
    @j_del.java_method(:unregister, [Java::java.lang.String.java_class]).call(args[0])
    return self
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling unregister(#{args[0]})"
  end
end