Class: Vertx::MessageProducer

Inherits:
Object
  • Object
show all
Includes:
WriteStream
Defined in:
/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/message_producer.rb

Overview

Represents a stream of message that can be written to.

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Object) DEFAULT_WRITE_QUEUE_MAX_SIZE


126
127
128
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/message_producer.rb', line 126

def self.DEFAULT_WRITE_QUEUE_MAX_SIZE
  Java::IoVertxCoreEventbus::MessageProducer.DEFAULT_WRITE_QUEUE_MAX_SIZE
end

Instance Method Details

- (String) address

Returns The address to which the producer produces messages.

Returns:

  • (String)
    The address to which the producer produces messages.

Raises:

  • (ArgumentError)

109
110
111
112
113
114
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/message_producer.rb', line 109

def address
  if !block_given?
    return @j_del.java_method(:address, []).call()
  end
  raise ArgumentError, "Invalid arguments when calling address()"
end

- (void) close { ... }

This method returns an undefined value.

Same as #close but with an handler called when the operation completes

Yields:

Raises:

  • (ArgumentError)

118
119
120
121
122
123
124
125
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/message_producer.rb', line 118

def close
  if !block_given?
    return @j_del.java_method(:close, []).call()
  elsif block_given?
    return @j_del.java_method(:close, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))
  end
  raise ArgumentError, "Invalid arguments when calling close()"
end

- (self) delivery_options(options = nil)

Update the delivery options of this producer.

Parameters:

  • options (Hash) (defaults to: nil)
    the new options

Returns:

  • (self)

Raises:

  • (ArgumentError)

101
102
103
104
105
106
107
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/message_producer.rb', line 101

def delivery_options(options=nil)
  if options.class == Hash && !block_given?
    @j_del.java_method(:deliveryOptions, [Java::IoVertxCoreEventbus::DeliveryOptions.java_class]).call(Java::IoVertxCoreEventbus::DeliveryOptions.new(::Vertx::Util::Utils.to_json_object(options)))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling delivery_options(#{options})"
end

- (self) drain_handler { ... }

Yields:

Returns:

  • (self)

Raises:

  • (ArgumentError)

91
92
93
94
95
96
97
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/message_producer.rb', line 91

def drain_handler
  if block_given?
    @j_del.java_method(:drainHandler, [Java::IoVertxCore::Handler.java_class]).call(Proc.new { yield })
    return self
  end
  raise ArgumentError, "Invalid arguments when calling drain_handler()"
end

- (void) end(data = nil) { ... }

This method returns an undefined value.

Same as but with an handler called when the operation completes

Parameters:

  • data (Object) (defaults to: nil)

Yields:

Raises:

  • (ArgumentError)

25
26
27
28
29
30
31
32
33
34
35
36
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/message_producer.rb', line 25

def end(data=nil)
  if !block_given? && data == nil
    return @j_del.java_method(:end, []).call()
  elsif @j_arg_T.accept?(data) && !block_given?
    return @j_del.java_method(:end, [Java::java.lang.Object.java_class]).call(@j_arg_T.unwrap(data))
  elsif block_given? && data == nil
    return @j_del.java_method(:end, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))
  elsif @j_arg_T.accept?(data) && block_given?
    return @j_del.java_method(:end, [Java::java.lang.Object.java_class,Java::IoVertxCore::Handler.java_class]).call(@j_arg_T.unwrap(data),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))
  end
  raise ArgumentError, "Invalid arguments when calling end(#{data})"
end

- (self) exception_handler { ... }

Yields:

Returns:

  • (self)

Raises:

  • (ArgumentError)

60
61
62
63
64
65
66
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/message_producer.rb', line 60

def exception_handler
  if block_given?
    @j_del.java_method(:exceptionHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.from_throwable(event)) }))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling exception_handler()"
end

- (::Vertx::MessageProducer) send(message = nil) { ... }

Like #send but specifying a replyHandler that will be called if the recipient subsequently replies to the message.

Parameters:

  • message (Object) (defaults to: nil)
    the message to send

Yields:

  • reply handler will be called when any reply from the recipient is received, may be null

Returns:

Raises:

  • (ArgumentError)

50
51
52
53
54
55
56
57
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/message_producer.rb', line 50

def send(message=nil)
  if @j_arg_T.accept?(message) && !block_given?
    return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:send, [Java::java.lang.Object.java_class]).call(@j_arg_T.unwrap(message)),::Vertx::MessageProducer, nil)
  elsif @j_arg_T.accept?(message) && block_given?
    return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:send, [Java::java.lang.Object.java_class,Java::IoVertxCore::Handler.java_class]).call(@j_arg_T.unwrap(message),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::Vertx::Message, nil) : nil) })),::Vertx::MessageProducer, nil)
  end
  raise ArgumentError, "Invalid arguments when calling send(#{message})"
end

- (self) set_write_queue_max_size(maxSize = nil)

Parameters:

  • maxSize (Fixnum) (defaults to: nil)

Returns:

  • (self)

Raises:

  • (ArgumentError)

82
83
84
85
86
87
88
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/message_producer.rb', line 82

def set_write_queue_max_size(maxSize=nil)
  if maxSize.class == Fixnum && !block_given?
    @j_del.java_method(:setWriteQueueMaxSize, [Java::int.java_class]).call(maxSize)
    return self
  end
  raise ArgumentError, "Invalid arguments when calling set_write_queue_max_size(#{maxSize})"
end

- (self) write(data = nil) { ... }

Parameters:

  • data (Object) (defaults to: nil)

Yields:

Returns:

  • (self)

Raises:

  • (ArgumentError)

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

def write(data=nil)
  if @j_arg_T.accept?(data) && !block_given?
    @j_del.java_method(:write, [Java::java.lang.Object.java_class]).call(@j_arg_T.unwrap(data))
    return self
  elsif @j_arg_T.accept?(data) && block_given?
    @j_del.java_method(:write, [Java::java.lang.Object.java_class,Java::IoVertxCore::Handler.java_class]).call(@j_arg_T.unwrap(data),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling write(#{data})"
end

- (true, false) write_queue_full?

This will return true if there are more bytes in the write queue than the value set using #set_write_queue_max_size

Returns:

  • (true, false)
    true if write queue is full

Raises:

  • (ArgumentError)

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

def write_queue_full?
  if !block_given?
    return @j_del.java_method(:writeQueueFull, []).call()
  end
  raise ArgumentError, "Invalid arguments when calling write_queue_full?()"
end