Class List Method List File List

# Class: VertxStomp::Destination

Inherits:
  Object
  - Object
  - VertxStomp::Destination
  show all
Defined in:
  /Users/julien/java/vertx-aggregator/modules/vertx-stomp/src/main/resources/vertx-stomp/destination.rb

## Overview

Represents a STOMP destination. Depending on the implementation, the message delivery is different. Queue are sending message to only one subscribers, while topics are broadcasting the message to all subscribers.

Implementations must be thread-safe.

## Class Method Summary (collapse)

- + (::VertxStomp::Destination) bridge(vertx = nil, options = nil)
- + (::VertxStomp::Destination) queue(vertx = nil, destination = nil)
- + (::VertxStomp::Destination) topic(vertx = nil, destination = nil)

## Instance Method Summary (collapse)

- - (true, false) ack?(connection = nil, frame = nil)
  Handles a ACK frame.
- - (String) destination
  @return the destination address.
- - (self) dispatch(connection = nil, frame = nil)
  Dispatches the given frame.
- - (Array<String>) get_subscriptions(connection = nil)
  Gets all subscription ids for the given destination hold by the given client.
- - (true, false) matches?(address = nil)
  Checks whether or not the given address matches with the current destination.
- - (true, false) nack?(connection = nil, frame = nil)
  Handles a NACK frame.
- - (Fixnum) number_of_subscriptions
  Gets the number of subscriptions attached to the current Destination.
- - (self) subscribe(connection = nil, frame = nil)
  Handles a subscription request to the current Destination.
- - (true, false) unsubscribe?(connection = nil, frame = nil)
  Handles a un-subscription request to the current Destination.
- - (self) unsubscribe_connection(connection = nil)
  Removes all subscriptions of the given connection.

## Class Method Details

### + (`::VertxStomp::Destination`) bridge(vertx = nil, options = nil)

Parameters:

- vertx (`::Vertx::Vertx`) (defaults to: `nil`)
- options (`Hash`) (defaults to: `nil`)

Returns:

- (`::VertxStomp::Destination`)

Raises:

- (`ArgumentError`)

    43
    44
    45
    46
    47
    48
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-stomp/src/main/resources/vertx-stomp/destination.rb', line 43

    def self.bridge(vertx=nil,options=nil)
      if vertx.class.method_defined?(:j_del) && options.class == Hash && !block_given?
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtStomp::Destination.java_method(:bridge, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxExtStomp::BridgeOptions.java_class]).call(vertx.j_del,Java::IoVertxExtStomp::BridgeOptions.new(::Vertx::Util::Utils.to_json_object(options))),::VertxStomp::Destination)
      end
      raise ArgumentError, "Invalid arguments when calling bridge(vertx,options)"
    end

### + (`::VertxStomp::Destination`) queue(vertx = nil, destination = nil)

Parameters:

- vertx (`::Vertx::Vertx`) (defaults to: `nil`)
- destination (`String`) (defaults to: `nil`)

Returns:

- (`::VertxStomp::Destination`)

Raises:

- (`ArgumentError`)

    34
    35
    36
    37
    38
    39
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-stomp/src/main/resources/vertx-stomp/destination.rb', line 34

    def self.queue(vertx=nil,destination=nil)
      if vertx.class.method_defined?(:j_del) && destination.class == String && !block_given?
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtStomp::Destination.java_method(:queue, [Java::IoVertxCore::Vertx.java_class,Java::java.lang.String.java_class]).call(vertx.j_del,destination),::VertxStomp::Destination)
      end
      raise ArgumentError, "Invalid arguments when calling queue(vertx,destination)"
    end

### + (`::VertxStomp::Destination`) topic(vertx = nil, destination = nil)

Parameters:

- vertx (`::Vertx::Vertx`) (defaults to: `nil`)
- destination (`String`) (defaults to: `nil`)

Returns:

- (`::VertxStomp::Destination`)

Raises:

- (`ArgumentError`)

    25
    26
    27
    28
    29
    30
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-stomp/src/main/resources/vertx-stomp/destination.rb', line 25

    def self.topic(vertx=nil,destination=nil)
      if vertx.class.method_defined?(:j_del) && destination.class == String && !block_given?
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtStomp::Destination.java_method(:topic, [Java::IoVertxCore::Vertx.java_class,Java::java.lang.String.java_class]).call(vertx.j_del,destination),::VertxStomp::Destination)
      end
      raise ArgumentError, "Invalid arguments when calling topic(vertx,destination)"
    end

## Instance Method Details

### - (`true`, `false`) ack?(connection = nil, frame = nil)

Handles a `ACK` frame.

Parameters:

- connection (`::VertxStomp::StompServerConnection`) (defaults to: `nil`) —
  the connection
- frame (`Hash`) (defaults to: `nil`) —
  the `ACK` frame

Returns:

- (`true`, `false`) —
  `true` if the destination has handled the frame (meaning it has sent the message with id)

Raises:

- (`ArgumentError`)

    103
    104
    105
    106
    107
    108
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-stomp/src/main/resources/vertx-stomp/destination.rb', line 103

    def ack?(connection=nil,frame=nil)
      if connection.class.method_defined?(:j_del) && frame.class == Hash && !block_given?
        return @j_del.java_method(:ack, [Java::IoVertxExtStomp::StompServerConnection.java_class,Java::IoVertxExtStomp::Frame.java_class]).call(connection.j_del,Java::IoVertxExtStomp::Frame.new(::Vertx::Util::Utils.to_json_object(frame)))
      end
      raise ArgumentError, "Invalid arguments when calling ack?(connection,frame)"
    end

### - (`String`) destination

@return the destination address.

Returns:

- (`String`)

Raises:

- (`ArgumentError`)

    51
    52
    53
    54
    55
    56
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-stomp/src/main/resources/vertx-stomp/destination.rb', line 51

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

### - (`self`) dispatch(connection = nil, frame = nil)

Dispatches the given frame.

Parameters:

- connection (`::VertxStomp::StompServerConnection`) (defaults to: `nil`) —
  the connection
- frame (`Hash`) (defaults to: `nil`) —
  the frame

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    61
    62
    63
    64
    65
    66
    67
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-stomp/src/main/resources/vertx-stomp/destination.rb', line 61

    def dispatch(connection=nil,frame=nil)
      if connection.class.method_defined?(:j_del) && frame.class == Hash && !block_given?
        @j_del.java_method(:dispatch, [Java::IoVertxExtStomp::StompServerConnection.java_class,Java::IoVertxExtStomp::Frame.java_class]).call(connection.j_del,Java::IoVertxExtStomp::Frame.new(::Vertx::Util::Utils.to_json_object(frame)))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling dispatch(connection,frame)"
    end

### - (`Array<String>`) get_subscriptions(connection = nil)

Gets all subscription ids for the given destination hold by the given client

Parameters:

- connection (`::VertxStomp::StompServerConnection`) (defaults to: `nil`) —
  the connection (client)

Returns:

- (`Array<String>`) —
  the list of subscription id, empty if none

Raises:

- (`ArgumentError`)

    122
    123
    124
    125
    126
    127
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-stomp/src/main/resources/vertx-stomp/destination.rb', line 122

    def get_subscriptions(connection=nil)
      if connection.class.method_defined?(:j_del) && !block_given?
        return @j_del.java_method(:getSubscriptions, [Java::IoVertxExtStomp::StompServerConnection.java_class]).call(connection.j_del).to_a.map { |elt| elt }
      end
      raise ArgumentError, "Invalid arguments when calling get_subscriptions(connection)"
    end

### - (`true`, `false`) matches?(address = nil)

Checks whether or not the given address matches with the current destination.

Parameters:

- address (`String`) (defaults to: `nil`) —
  the address

Returns:

- (`true`, `false`) —
  `true` if it matches, `false` otherwise.

Raises:

- (`ArgumentError`)

    139
    140
    141
    142
    143
    144
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-stomp/src/main/resources/vertx-stomp/destination.rb', line 139

    def matches?(address=nil)
      if address.class == String && !block_given?
        return @j_del.java_method(:matches, [Java::java.lang.String.java_class]).call(address)
      end
      raise ArgumentError, "Invalid arguments when calling matches?(address)"
    end

### - (`true`, `false`) nack?(connection = nil, frame = nil)

Handles a `NACK` frame.

Parameters:

- connection (`::VertxStomp::StompServerConnection`) (defaults to: `nil`) —
  the connection
- frame (`Hash`) (defaults to: `nil`) —
  the `NACK` frame

Returns:

- (`true`, `false`) —
  `true` if the destination has handled the frame (meaning it has sent the message with id)

Raises:

- (`ArgumentError`)

    113
    114
    115
    116
    117
    118
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-stomp/src/main/resources/vertx-stomp/destination.rb', line 113

    def nack?(connection=nil,frame=nil)
      if connection.class.method_defined?(:j_del) && frame.class == Hash && !block_given?
        return @j_del.java_method(:nack, [Java::IoVertxExtStomp::StompServerConnection.java_class,Java::IoVertxExtStomp::Frame.java_class]).call(connection.j_del,Java::IoVertxExtStomp::Frame.new(::Vertx::Util::Utils.to_json_object(frame)))
      end
      raise ArgumentError, "Invalid arguments when calling nack?(connection,frame)"
    end

### - (`Fixnum`) number_of_subscriptions

Gets the number of subscriptions attached to the current VertxStomp::Destination.

Returns:

- (`Fixnum`) —
  the number of subscriptions.

Raises:

- (`ArgumentError`)

    130
    131
    132
    133
    134
    135
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-stomp/src/main/resources/vertx-stomp/destination.rb', line 130

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

### - (`self`) subscribe(connection = nil, frame = nil)

Handles a subscription request to the current VertxStomp::Destination.

Parameters:

- connection (`::VertxStomp::StompServerConnection`) (defaults to: `nil`) —
  the connection
- frame (`Hash`) (defaults to: `nil`) —
  the `SUBSCRIBE` frame

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    72
    73
    74
    75
    76
    77
    78
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-stomp/src/main/resources/vertx-stomp/destination.rb', line 72

    def subscribe(connection=nil,frame=nil)
      if connection.class.method_defined?(:j_del) && frame.class == Hash && !block_given?
        @j_del.java_method(:subscribe, [Java::IoVertxExtStomp::StompServerConnection.java_class,Java::IoVertxExtStomp::Frame.java_class]).call(connection.j_del,Java::IoVertxExtStomp::Frame.new(::Vertx::Util::Utils.to_json_object(frame)))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling subscribe(connection,frame)"
    end

### - (`true`, `false`) unsubscribe?(connection = nil, frame = nil)

Handles a un-subscription request to the current VertxStomp::Destination.

Parameters:

- connection (`::VertxStomp::StompServerConnection`) (defaults to: `nil`) —
  the connection
- frame (`Hash`) (defaults to: `nil`) —
  the `UNSUBSCRIBE` frame

Returns:

- (`true`, `false`) —
  `true` if the un-subscription has been handled, `false` otherwise.

Raises:

- (`ArgumentError`)

    83
    84
    85
    86
    87
    88
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-stomp/src/main/resources/vertx-stomp/destination.rb', line 83

    def unsubscribe?(connection=nil,frame=nil)
      if connection.class.method_defined?(:j_del) && frame.class == Hash && !block_given?
        return @j_del.java_method(:unsubscribe, [Java::IoVertxExtStomp::StompServerConnection.java_class,Java::IoVertxExtStomp::Frame.java_class]).call(connection.j_del,Java::IoVertxExtStomp::Frame.new(::Vertx::Util::Utils.to_json_object(frame)))
      end
      raise ArgumentError, "Invalid arguments when calling unsubscribe?(connection,frame)"
    end

### - (`self`) unsubscribe_connection(connection = nil)

Removes all subscriptions of the given connection

Parameters:

- connection (`::VertxStomp::StompServerConnection`) (defaults to: `nil`) —
  the connection

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    92
    93
    94
    95
    96
    97
    98
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-stomp/src/main/resources/vertx-stomp/destination.rb', line 92

    def unsubscribe_connection(connection=nil)
      if connection.class.method_defined?(:j_del) && !block_given?
        @j_del.java_method(:unsubscribeConnection, [Java::IoVertxExtStomp::StompServerConnection.java_class]).call(connection.j_del)
        return self
      end
      raise ArgumentError, "Invalid arguments when calling unsubscribe_connection(connection)"
    end