class Qpid::Messaging::Duration

A Duration represents a period of time in milliseconds

It defines the following named values as symbols:

:FOREVER

The maximum integer value for the platform. Effectively this will wait forever.

:IMMEDIATE

An alias for 0 milliseconds.

:SECOND

An alias for 1,000 milliseconds.

:MINUTE

And alias for 60,000 millisecons.

Public Class Methods

new(length) click to toggle source

Creates a Duration with the specified length, in milliseconds.

Options

  • length - The duration in milliseconds.

Examples

# Wait up to 10 seconds for an incoming message
receiver.get Qpid::Messaging::Duration.new 10000
# File qpid/ruby/lib/qpid_messaging/duration.rb, line 54
def initialize length
  @duration_impl = Cqpid::Duration.new length
end

Public Instance Methods

milliseconds() click to toggle source

Returns the period of time in milliseconds

Examples

duration = Qpid::Messaging::Duration.new :length => 5000
puts "Waiting #{duration.milliseconds} ms for a message."
msg = receiver.fetch duration
# File qpid/ruby/lib/qpid_messaging/duration.rb, line 70
def milliseconds
  @duration_impl.getMilliseconds
end