Class: VertxServiceDiscovery::MessageSource

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

Overview

Service type for data producer. Providers are publishing data to a specific event bus address.

Constant Summary

@@j_api_type =
Object.new

Class Method Summary (collapse)

Class Method Details

+ (Boolean) accept?(obj)

Returns:

  • (Boolean)


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

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

+ (Hash) create_record(name = nil, address = nil, type = nil, metadata = nil)

Create a record representing a data producer.

Parameters:

  • name (String) (defaults to: nil)
    the name of the service
  • address (String) (defaults to: nil)
    the address on which the data is sent
  • type (String) (defaults to: nil)
    the type of payload (fully qualified name of the class)
  • metadata (Hash{String => Object}) (defaults to: nil)
    additional metadata

Returns:

  • (Hash)
    the created record

Raises:

  • (ArgumentError)


40
41
42
43
44
45
46
47
48
49
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-service-discovery/message_source.rb', line 40

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

+ (void) getConsumer(discovery, filter, resultHandler) { ... } + (void) getConsumer(discovery, filter, resultHandler) { ... }

This method returns an undefined value.

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

Overloads:

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

    Parameters:

    Yields:

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

    Parameters:

    Yields:

    • The result handler

Raises:

  • (ArgumentError)


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

def self.get_consumer(param_1=nil,param_2=nil)
  if param_1.class.method_defined?(:j_del) && param_2.class == Hash && block_given?
    return Java::IoVertxServicediscoveryTypes::MessageSource.java_method(:getConsumer, [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,::Vertx::MessageConsumer, nil) : nil) }))
  elsif param_1.class.method_defined?(:j_del) && param_2.class == Proc && block_given?
    return Java::IoVertxServicediscoveryTypes::MessageSource.java_method(:getConsumer, [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,::Vertx::MessageConsumer, nil) : nil) }))
  end
  raise ArgumentError, "Invalid arguments when calling get_consumer(#{param_1},#{param_2})"
end

+ (Object) j_api_type



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

def self.j_api_type
  @@j_api_type
end

+ (Object) j_class



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

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

+ (Object) TYPE



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

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

+ (Object) UNKNOWN

Unknown type.


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

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

+ (Object) unwrap(obj)



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

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

+ (Object) wrap(obj)



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

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