Class List Method List File List

# Class: VertxCircuitBreaker::HystrixMetricHandler

Inherits:
  Object
  - Object
  - VertxCircuitBreaker::HystrixMetricHandler
  show all
Defined in:
  /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-circuit-breaker/hystrix_metric_handler.rb

## Overview

A Vert.x web handler to expose the circuit breaker to the Hystrix dasbboard. The handler listens to the circuit breaker notifications sent on the event bus.

## Constant Summary

@@j_api_type =

      Object.new

## Class Method Summary (collapse)

- + (Boolean) accept?(obj)
- + (::VertxCircuitBreaker::HystrixMetricHandler) create(vertx = nil, address = nil)
  Creates the handler.
- + (Object) j_api_type
- + (Object) j_class
- + (Object) unwrap(obj)
- + (Object) wrap(obj)

## Instance Method Summary (collapse)

- - (void) handle(event = nil)
  Something has happened, so handle it.

## Class Method Details

### + (`Boolean`) accept?(obj)

Returns:

- (`Boolean`)

    20
    21
    22
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-circuit-breaker/hystrix_metric_handler.rb', line 20

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

### + (`::VertxCircuitBreaker::HystrixMetricHandler`) create(vertx = nil, address = nil)

Creates the handler.

Parameters:

- vertx (`::Vertx::Vertx`) (defaults to: `nil`) —
  the Vert.x instance
- address (`String`) (defaults to: `nil`) —
  the address to listen on the event bus

Returns:

- (`::VertxCircuitBreaker::HystrixMetricHandler`) —
  the handler

Raises:

- (`ArgumentError`)

    48
    49
    50
    51
    52
    53
    54
    55
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-circuit-breaker/hystrix_metric_handler.rb', line 48

    def self.create(vertx=nil,address=nil)
      if vertx.class.method_defined?(:j_del) && !block_given? && address == nil
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxCircuitbreaker::HystrixMetricHandler.java_method(:create, [Java::IoVertxCore::Vertx.java_class]).call(vertx.j_del),::VertxCircuitBreaker::HystrixMetricHandler)
      elsif vertx.class.method_defined?(:j_del) && address.class == String && !block_given?
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxCircuitbreaker::HystrixMetricHandler.java_method(:create, [Java::IoVertxCore::Vertx.java_class,Java::java.lang.String.java_class]).call(vertx.j_del,address),::VertxCircuitBreaker::HystrixMetricHandler)
      end
      raise ArgumentError, "Invalid arguments when calling create(#{vertx},#{address})"
    end

### + (`Object`) j_api_type

    29
    30
    31
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-circuit-breaker/hystrix_metric_handler.rb', line 29

    def self.j_api_type
      @@j_api_type
    end

### + (`Object`) j_class

    32
    33
    34
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-circuit-breaker/hystrix_metric_handler.rb', line 32

    def self.j_class
      Java::IoVertxCircuitbreaker::HystrixMetricHandler.java_class
    end

### + (`Object`) unwrap(obj)

    26
    27
    28
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-circuit-breaker/hystrix_metric_handler.rb', line 26

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

### + (`Object`) wrap(obj)

    23
    24
    25
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-circuit-breaker/hystrix_metric_handler.rb', line 23

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

## Instance Method Details

### - (`void`) handle(event = nil)

This method returns an undefined value.

Something has happened, so handle it.

Parameters:

- event (`::VertxWeb::RoutingContext`) (defaults to: `nil`) —
  the event to handle

Raises:

- (`ArgumentError`)

    38
    39
    40
    41
    42
    43
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-circuit-breaker/hystrix_metric_handler.rb', line 38

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