Class List Method List File List

# Class: Vertx::MessageProducer

Inherits:
  Object
  - Object
  - Vertx::MessageProducer
  show all
Includes:
  WriteStream
Defined in:
  /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/message_producer.rb

## Overview

Represents a stream of message that can be written to.

## Instance Method Summary (collapse)

- - (String) address
  @return The address to which the producer produces messages.
- - (self) delivery_options(options = nil)
  Update the delivery options of this producer.
- - (self) drain_handler { ... }
- - (self) exception_handler { ... }
- - (self) set_write_queue_max_size(maxSize = nil)
- - (self) write(data = nil)
- - (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.

## Instance Method Details

### - (`String`) address

@return The address to which the producer produces messages.

Returns:

- (`String`)

Raises:

- (`ArgumentError`)

    75
    76
    77
    78
    79
    80
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/message_producer.rb', line 75

    def address
      if !block_given?
        return @j_del.java_method(:address, []).call()
      end
      raise ArgumentError, "Invalid arguments when calling address()"
    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`)

    66
    67
    68
    69
    70
    71
    72
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/message_producer.rb', line 66

    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`)

    56
    57
    58
    59
    60
    61
    62
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/message_producer.rb', line 56

    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

### - (`self`) exception_handler { ... }

Yields:

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    29
    30
    31
    32
    33
    34
    35
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/message_producer.rb', line 29

    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

### - (`self`) set_write_queue_max_size(maxSize = nil)

Parameters:

- maxSize (`Fixnum`) (defaults to: `nil`)

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    47
    48
    49
    50
    51
    52
    53
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/message_producer.rb', line 47

    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`)

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

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

    def write(data=nil)
      if (data.class == String  || data.class == Hash || data.class == Array || data.class == NilClass || data.class == TrueClass || data.class == FalseClass || data.class == Fixnum || data.class == Float) && !block_given?
        @j_del.java_method(:write, [Java::java.lang.Object.java_class]).call(::Vertx::Util::Utils.to_object(data))
        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`)

    21
    22
    23
    24
    25
    26
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/message_producer.rb', line 21

    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