Class: VertxStomp::Destination

Inherits:
Object
  • Object
show all
Defined in:
/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/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.

Constant Summary

@@j_api_type =
Object.new

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Boolean) accept?(obj)

Returns:

  • (Boolean)


23
24
25
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/destination.rb', line 23

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

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

Parameters:

  • vertx (::Vertx::Vertx) (defaults to: nil)
  • options (Hash) (defaults to: nil)

Returns:

Raises:

  • (ArgumentError)


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

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

+ (Object) j_api_type



32
33
34
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/destination.rb', line 32

def self.j_api_type
  @@j_api_type
end

+ (Object) j_class



35
36
37
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/destination.rb', line 35

def self.j_class
  Java::IoVertxExtStomp::Destination.java_class
end

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

Parameters:

  • vertx (::Vertx::Vertx) (defaults to: nil)
  • destination (String) (defaults to: nil)

Returns:

Raises:

  • (ArgumentError)


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

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:

Raises:

  • (ArgumentError)


41
42
43
44
45
46
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/destination.rb', line 41

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

+ (Object) unwrap(obj)



29
30
31
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/destination.rb', line 29

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

+ (Object) wrap(obj)



26
27
28
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/destination.rb', line 26

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

Instance Method Details

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

Handles a ACK frame.

Parameters:

Returns:

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

Raises:

  • (ArgumentError)


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

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

Returns the destination address.

Returns:

  • (String)
    the destination address.

Raises:

  • (ArgumentError)


66
67
68
69
70
71
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/destination.rb', line 66

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:

Returns:

  • (self)

Raises:

  • (ArgumentError)


76
77
78
79
80
81
82
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/destination.rb', line 76

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:

Returns:

  • (Array<String>)
    the list of subscription id, empty if none

Raises:

  • (ArgumentError)


137
138
139
140
141
142
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/destination.rb', line 137

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)


154
155
156
157
158
159
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/destination.rb', line 154

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:

Returns:

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

Raises:

  • (ArgumentError)


128
129
130
131
132
133
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/destination.rb', line 128

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)


145
146
147
148
149
150
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/destination.rb', line 145

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:

Returns:

  • (self)

Raises:

  • (ArgumentError)


87
88
89
90
91
92
93
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/destination.rb', line 87

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:

Returns:

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

Raises:

  • (ArgumentError)


98
99
100
101
102
103
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/destination.rb', line 98

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:

Returns:

  • (self)

Raises:

  • (ArgumentError)


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

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