class Azure::ServiceBus::Queue

Public Class Methods

new(name, options = {}) click to toggle source

Public: Initialize the queue.

Attributes

  • name - A String with the name of the queue.

  • options - The resource options Hash

Options

Accepted key/value pairs in options parameter are:

  • :default_message_time_to_live - XML datetime. Determines how long a message lives in the associated subscriptions.

  • :duplicate_detection_history_time_window - XML datetime. Specifies the time span during which the Service Bus will detect message duplication.

  • :enable_batched_operations - Boolean. Enables or disables service side batching behavior when performing operations for the specific queue.

  • :dead_lettering_on_message_expiration: - Boolean. This field controls how the Service Bus handles a message whose TTL has expired.

  • :lock_duration - XML datetime. Determines the amount of time in seconds in which a message should be locked for processing by a receiver.

  • :max_delivery_count - Number. A message is automatically deadlettered after this number of deliveries.

  • :max_size_in_megabytes - Number. Specifies the maximum topic size in megabytes

  • :message_count - Number. Displays the number of messages currently in the queue.

  • :requires_duplicate_detection - Boolean. If enabled, the topic will detect duplicate messages within the time span specified by the DuplicateDetectionHistoryTimeWindow property

  • :requires_session - Boolean. If set to true, the queue will be session-aware and only SessionReceiver will be supported.

  • :size_in_bytes - Number. Reflects the actual bytes toward the topic quota that messages in the topic currently occupy.

Calls superclass method
# File lib/azure/service_bus/queue.rb, line 42
def initialize(name, options = {})
  normalized_options = {}
  normalized_options["DefaultMessageTimeToLive"] = options[:default_message_time_to_live].to_s if options.has_key?(:default_message_time_to_live)
  normalized_options["DuplicateDetectionHistoryTimeWindow"] = options[:duplicate_detection_history_time_window].to_s if options.has_key?(:duplicate_detection_history_time_window)
  normalized_options["EnableBatchedOperations"] = options[:enable_batched_operations].to_s if options.has_key?(:enable_batched_operations)
  normalized_options["DeadLetteringOnMessageExpiration"] = options[:dead_lettering_on_message_expiration].to_s if options.has_key?(:dead_lettering_on_message_expiration)
  normalized_options["LockDuration"] = options[:lock_duration].to_s if options.has_key?(:lock_duration)
  normalized_options["MaxDeliveryCount"] = options[:max_delivery_count].to_s if options.has_key?(:max_delivery_count)
  normalized_options["MaxSizeInMegabytes"] = options[:max_size_in_megabytes].to_s if options.has_key?(:max_size_in_megabytes)
  normalized_options["MessageCount"] = options[:message_count].to_s if options.has_key?(:message_count)
  normalized_options["RequiresDuplicateDetection"] = options[:requires_duplicate_detection].to_s if options.has_key?(:requires_duplicate_detection)
  normalized_options["RequiresSession"] = options[:requires_session].to_s if options.has_key?(:requires_session)
  normalized_options["SizeInBytes"] = options[:size_in_bytes].to_s if options.has_key?(:size_in_bytes)

  super(name, normalized_options)
end

Public Instance Methods

dead_lettering_on_message_expiration() click to toggle source

DeadLetteringOnMessageExpiration: True, False

This field controls how the Service Bus handles a message whose TTL has expired. If it is enabled and a message expires, the Service Bus moves the message from the queue into the queue’s dead-letter sub-queue. If disabled, message will be permanently deleted from the queue. Settable only at queue creation time.

Default: false

# File lib/azure/service_bus/queue.rb, line 107
def dead_lettering_on_message_expiration
  to_bool description['DeadLetteringOnMessageExpiration']
end
default_message_time_to_live() click to toggle source

DefaultMessageTimeToLive: XML datetime

Depending on whether DeadLettering is enabled, a message is automatically moved to the DeadLetterQueue or deleted if it has been stored in the queue for longer than the specified time. This value is overwritten by a TTL specified on the message if and only if the message TTL is smaller than the TTL set on the queue. This value is immutable after the Queue has been created:

Range: 1 second - TimeSpan.MaxValue Default: TimeSpan.MaxValue

# File lib/azure/service_bus/queue.rb, line 164
def default_message_time_to_live
  to_interval description['DefaultMessageTimeToLive']
end
default_message_time_to_live=(val) click to toggle source
# File lib/azure/service_bus/queue.rb, line 168
def default_message_time_to_live=(val)
  _set 'DefaultMessageTimeToLive', val
end
duplicate_detection_history_time_window() click to toggle source

DuplicateDetectionHistoryTimeWindow

Specifies the time span during which the Service Bus will detect message duplication.

Range: 1 second - 7 days Default: 10 minutes

# File lib/azure/service_bus/queue.rb, line 191
def duplicate_detection_history_time_window
  to_interval description['DuplicateDetectionHistoryTimeWindow']
end
duplicate_detection_history_time_window=(val) click to toggle source
# File lib/azure/service_bus/queue.rb, line 195
def duplicate_detection_history_time_window=(val)
  _set 'DuplicateDetectionHistoryTimeWindow', val
end
enable_batched_operations() click to toggle source

EnableBatchedOperations

Enables or disables service side batching behavior when performing operations for the specific queue. When enabled, service bus will collect/batch multiple operations to the backend to be more connection efficient.

If user wants lower operation latency then they can disable this feature.

# File lib/azure/service_bus/queue.rb, line 205
def enable_batched_operations
  to_bool description['EnableBatchedOperations']
end
enable_batched_operations=(val) click to toggle source
# File lib/azure/service_bus/queue.rb, line 209
def enable_batched_operations=(val)
  _set 'EnableBatchedOperations', val
end
enable_dead_lettering_on_message_expiration=(val) click to toggle source
# File lib/azure/service_bus/queue.rb, line 111
def enable_dead_lettering_on_message_expiration=(val)
  _set 'DeadLetteringOnMessageExpiration', val
end
lock_duration() click to toggle source

LockDuration: XML datetime

Determines the amount of time in seconds in which a message should be locked for processing by a receiver. After this period, the message is unlocked and available for consumption by the next receiver. Settable only at queue creation time:

Range: 0 - 5 minutes. 0 means that the message is not locked Default: 30 seconds

# File lib/azure/service_bus/queue.rb, line 78
def lock_duration
  to_interval description['LockDuration']
end
lock_duration=(val) click to toggle source
# File lib/azure/service_bus/queue.rb, line 82
def lock_duration=(val)
  _set 'LockDuration', val
end
max_delivery_count() click to toggle source

MaxDeliveryCount: Number

A message is automatically deadlettered after this number of deliveries.

# File lib/azure/service_bus/queue.rb, line 118
def max_delivery_count
  to_i description['MaxDeliveryCount']
end
max_delivery_count=(val) click to toggle source
# File lib/azure/service_bus/queue.rb, line 122
def max_delivery_count=(val)
  _set 'MaxDeliveryCount', val
end
max_size_in_megabytes() click to toggle source

MaxSizeInMegaBytes: Number

Specifies the maximum queue size in megabytes. Any attempt to enqueue a message that will cause the queue to exceed this value will fail. You can only set this parameter at queue creation time using the following values:

Range: 1 - 1024 (valid values are 1024, 2048, 3072, 4096, 5120) Default: 1*1024 (valid values are 1024, 2048, 3072, 4096, 5120)

# File lib/azure/service_bus/queue.rb, line 133
def max_size_in_megabytes
  to_i description['MaxSizeInMegabytes']
end
max_size_in_megabytes=(val) click to toggle source
# File lib/azure/service_bus/queue.rb, line 137
def max_size_in_megabytes=(val)
  _set 'MaxSizeInMegabytes', val
end
message_count() click to toggle source

MessageCount: Number

Displays the number of messages currently in the queue.

# File lib/azure/service_bus/queue.rb, line 62
def message_count
  to_i description['MessageCount']
end
message_count=(val) click to toggle source
# File lib/azure/service_bus/queue.rb, line 66
def message_count=(val)
  _set 'MessageCount', val
end
ordered_props() click to toggle source
# File lib/azure/service_bus/queue.rb, line 213
def ordered_props
  [
    'LockDuration',
    'MaxSizeInMegabytes',
    'RequiresDuplicateDetection',
    'RequiresSession',
    'DefaultMessageTimeToLive',
    'DeadLetteringOnMessageExpiration',
    'DuplicateDetectionHistoryTimeWindow',
    'MaxDeliveryCount',
    'EnableBatchedOperations',
    'SizeInBytes',
    'MessageCount'
  ]
end
requires_duplicate_detection() click to toggle source

RequiresDuplicateDetection: True, False

Settable only at queue creation time.

Default for durable queue: false

# File lib/azure/service_bus/queue.rb, line 177
def requires_duplicate_detection
  to_bool description['RequiresDuplicateDetection']
end
requires_duplicate_detection=(val) click to toggle source
# File lib/azure/service_bus/queue.rb, line 181
def requires_duplicate_detection=(val)
  _set 'RequiresDuplicateDetection', val
end
requires_session() click to toggle source

RequiresSession: True, False

Settable only at queue creation time. If set to true, the queue will be session-aware and only SessionReceiver will be supported. Session-aware queues are not supported through REST.

Default for durable queue: false

# File lib/azure/service_bus/queue.rb, line 92
def requires_session
  to_bool description['RequiresSession']
end
requires_session=(val) click to toggle source
# File lib/azure/service_bus/queue.rb, line 96
def requires_session=(val)
  _set 'RequiresSession', val
end
size_in_bytes() click to toggle source

SizeinBytes: Number

Reflects the actual bytes that messages in the queue currently occupy toward the queue’s quota.

Range: 0 - MaxTopicSizeinMegaBytes

# File lib/azure/service_bus/queue.rb, line 146
def size_in_bytes
  to_i description['SizeInBytes']
end
size_in_bytes=(val) click to toggle source
# File lib/azure/service_bus/queue.rb, line 150
def size_in_bytes=(val)
  _set 'SizeInBytes', val
end