Class: VertxServiceDiscovery::MongoDataSource

Inherits:
Object
  • Object
show all
Defined in:
/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/mongo_data_source.rb

Constant Summary

@@j_api_type =
Object.new

Class Method Summary (collapse)

Class Method Details

+ (Boolean) accept?(obj)

Returns:

  • (Boolean)


18
19
20
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/mongo_data_source.rb', line 18

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

+ (Hash) create_record(name = nil, location = nil, metadata = nil)

Convenient method to create a record for a Mongo data source.

Parameters:

  • name (String) (defaults to: nil)
    the service name
  • location (Hash{String => Object}) (defaults to: nil)
    the location of the service (e.g. url, port...)
  • metadata (Hash{String => Object}) (defaults to: nil)
    additional metadata

Returns:

  • (Hash)
    the created record

Raises:

  • (ArgumentError)


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

def self.create_record(name=nil,location=nil,=nil)
  if name.class == String && location.class == Hash && .class == Hash && !block_given?
    return Java::IoVertxServicediscoveryTypes::MongoDataSource.java_method(:createRecord, [Java::java.lang.String.java_class,Java::IoVertxCoreJson::JsonObject.java_class,Java::IoVertxCoreJson::JsonObject.java_class]).call(name,::Vertx::Util::Utils.to_json_object(location),::Vertx::Util::Utils.to_json_object()) != nil ? JSON.parse(Java::IoVertxServicediscoveryTypes::MongoDataSource.java_method(:createRecord, [Java::java.lang.String.java_class,Java::IoVertxCoreJson::JsonObject.java_class,Java::IoVertxCoreJson::JsonObject.java_class]).call(name,::Vertx::Util::Utils.to_json_object(location),::Vertx::Util::Utils.to_json_object()).toJson.encode) : nil
  end
  raise ArgumentError, "Invalid arguments when calling create_record(#{name},#{location},#{})"
end

+ (void) getMongoClient(discovery, filter, resultHandler) { ... } + (void) getMongoClient(discovery, filter, resultHandler) { ... } + (void) getMongoClient(discovery, filter, consumerConfiguration, resultHandler) { ... }

This method returns an undefined value.

Convenient method that looks for a Mongo datasource source and provides the configured VertxMongo::MongoClient. The async result is marked as failed is there are no matching services, or if the lookup fails.

Overloads:

  • + (void) getMongoClient(discovery, filter, resultHandler) { ... }

    Parameters:

    Yields:

    • The result handler
  • + (void) getMongoClient(discovery, filter, resultHandler) { ... }

    Parameters:

    Yields:

    • The result handler
  • + (void) getMongoClient(discovery, filter, consumerConfiguration, resultHandler) { ... }

    Parameters:

    • discovery (::VertxServiceDiscovery::ServiceDiscovery)
      The service discovery instance
    • filter (Hash{String => Object})
      The filter, optional
    • consumerConfiguration (Hash{String => Object})
      the consumer configuration

    Yields:

    • the result handler

Raises:

  • (ArgumentError)


60
61
62
63
64
65
66
67
68
69
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/mongo_data_source.rb', line 60

def self.get_mongo_client(param_1=nil,param_2=nil,param_3=nil)
  if param_1.class.method_defined?(:j_del) && param_2.class == Hash && block_given? && param_3 == nil
    return Java::IoVertxServicediscoveryTypes::MongoDataSource.java_method(:getMongoClient, [Java::IoVertxServicediscovery::ServiceDiscovery.java_class,Java::IoVertxCoreJson::JsonObject.java_class,Java::IoVertxCore::Handler.java_class]).call(param_1.j_del,::Vertx::Util::Utils.to_json_object(param_2),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxMongo::MongoClient) : nil) }))
  elsif param_1.class.method_defined?(:j_del) && param_2.class == Proc && block_given? && param_3 == nil
    return Java::IoVertxServicediscoveryTypes::MongoDataSource.java_method(:getMongoClient, [Java::IoVertxServicediscovery::ServiceDiscovery.java_class,Java::JavaUtilFunction::Function.java_class,Java::IoVertxCore::Handler.java_class]).call(param_1.j_del,(Proc.new { |event| param_2.call(event != nil ? JSON.parse(event.toJson.encode) : nil) }),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxMongo::MongoClient) : nil) }))
  elsif param_1.class.method_defined?(:j_del) && param_2.class == Hash && param_3.class == Hash && block_given?
    return Java::IoVertxServicediscoveryTypes::MongoDataSource.java_method(:getMongoClient, [Java::IoVertxServicediscovery::ServiceDiscovery.java_class,Java::IoVertxCoreJson::JsonObject.java_class,Java::IoVertxCoreJson::JsonObject.java_class,Java::IoVertxCore::Handler.java_class]).call(param_1.j_del,::Vertx::Util::Utils.to_json_object(param_2),::Vertx::Util::Utils.to_json_object(param_3),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxMongo::MongoClient) : nil) }))
  end
  raise ArgumentError, "Invalid arguments when calling get_mongo_client(#{param_1},#{param_2},#{param_3})"
end

+ (Object) j_api_type



27
28
29
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/mongo_data_source.rb', line 27

def self.j_api_type
  @@j_api_type
end

+ (Object) j_class



30
31
32
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/mongo_data_source.rb', line 30

def self.j_class
  Java::IoVertxServicediscoveryTypes::MongoDataSource.java_class
end

+ (Object) TYPE



74
75
76
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/mongo_data_source.rb', line 74

def self.TYPE
  Java::IoVertxServicediscoveryTypes::MongoDataSource.TYPE
end

+ (Object) UNKNOWN

Unknown type.


71
72
73
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/mongo_data_source.rb', line 71

def self.UNKNOWN
  Java::IoVertxServicediscoveryTypes::MongoDataSource.UNKNOWN
end

+ (Object) unwrap(obj)



24
25
26
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/mongo_data_source.rb', line 24

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

+ (Object) wrap(obj)



21
22
23
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/mongo_data_source.rb', line 21

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