class Azure::ServiceBus::Topic

Public Class Methods

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

Public: Initialize the topic.

Attributes

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

  • options - The resource options Hash

Options

Accepted key/value pairs in options parameter are:

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

  • :maximum_number_of_subscriptions - Number. Specifies the maximum number of subscriptions that can be associated with the topic.

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

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

  • :dead_lettering_on_filter_evaluation_exceptions - Boolean. Determines how the Service Bus handles a message that causes an exception during a subscription’s filter evaluation.

  • :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.

Calls superclass method Azure::ServiceBus::Resource::new
# File lib/azure/service_bus/topic.rb, line 38
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["MaximumNumberOfSubscriptions"] = options[:maximum_number_of_subscriptions].to_s if options.has_key?(:maximum_number_of_subscriptions)
  normalized_options["MaxSizeInMegabytes"] = options[:max_size_in_megabytes].to_s if options.has_key?(:max_size_in_megabytes)
  normalized_options["RequiresDuplicateDetection"] = options[:requires_duplicate_detection].to_s if options.has_key?(:requires_duplicate_detection)
  normalized_options["DeadLetteringOnFilterEvaluationExceptions"] = options[:dead_lettering_on_filter_evaluation_exceptions].to_s if options.has_key?(:dead_lettering_on_filter_evaluation_exceptions)
  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)

  super(name, normalized_options)
end

Public Instance Methods

dead_lettering_on_filter_evaluation_exceptions() click to toggle source

DeadLetteringOnFilterEvaluationExceptions: True, False

Determines how the Service Bus handles a message that causes an exception during a subscription’s filter evaluation. If the value is set to true, the message that caused the exception will be moved to the subscription’s dead-letter queue. Otherwise, it will be discarded. By default this parameter is set to true, allowing the user a chance to investigate the cause of the exception. It can occur from a malformed message or some incorrect assumptions being made in the filter about the form of the message. Settable only at topic creation time.

Default: true

# File lib/azure/service_bus/topic.rb, line 165
def dead_lettering_on_filter_evaluation_exceptions
  to_bool description['DeadLetteringOnFilterEvaluationExceptions']
end
dead_lettering_on_filter_evaluation_exceptions=(val) click to toggle source
# File lib/azure/service_bus/topic.rb, line 169
def dead_lettering_on_filter_evaluation_exceptions=(val)
  _set 'DeadLetteringOnFilterEvaluationExceptions', val
end
default_message_time_to_live() click to toggle source

DefaultMessageTimeToLive: XML datetime

Determines how long a message lives in the associated subscriptions. Subscriptions inherit the TTL from the topic unless they are created explicitly with a smaller TTL. Based on whether dead-lettering is enabled, a message whose TTL has expired will either be moved to the subscription’s associated DeadLtterQueue or will be permanently deleted. The following values are settable at topic creation time:

Range: 1 second - TimeSpan.MaxValue
Default: TimeSpan.MaxValue
# File lib/azure/service_bus/topic.rb, line 91
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/topic.rb, line 95
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/topic.rb, line 119
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/topic.rb, line 123
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/topic.rb, line 147
def enable_batched_operations
  to_bool description['EnableBatchedOperations']
end
enable_batched_operations=(val) click to toggle source
# File lib/azure/service_bus/topic.rb, line 151
def enable_batched_operations=(val)
  _set 'EnableBatchedOperations', val
end
max_size_in_megabytes() click to toggle source

MaxSizeInMegabytes: Number

Specifies the maximum topic size in megabytes. Any attempt to enqueue a message that will cause the topic to exceed this value will fail. All messages that are stored in the topic or any of its subscriptions count towards this value. Multiple copies of a message that reside in one or multiple subscriptions count as a single messages. For example, if message m exists once in subscription s1 and twice in subscription s2, m is counted as a single message. You can only set this parameter at topic creation time using the following values:

Range: 1 - 5*1024 MB
Default: 1*1024
# File lib/azure/service_bus/topic.rb, line 61
def max_size_in_megabytes
  to_i description['MaxSizeInMegabytes']
end
max_size_in_megabytes=(val) click to toggle source
# File lib/azure/service_bus/topic.rb, line 65
def max_size_in_megabytes=(val)
  _set 'MaxSizeInMegabytes', val
end
maximum_number_of_subscriptions() click to toggle source

MaximumNumberOfSubscriptions

Specifies the maximum number of subscriptions that can be associated with the topic.

Range: 1 - 2000 Default: 2000 subscriptions

# File lib/azure/service_bus/topic.rb, line 133
def maximum_number_of_subscriptions
  to_i description['MaximumNumberOfSubscriptions']
end
maximum_number_of_subscriptions=(val) click to toggle source
# File lib/azure/service_bus/topic.rb, line 137
def maximum_number_of_subscriptions=(val)
  _set 'MaximumNumberOfSubscriptions', val
end
ordered_props() click to toggle source
# File lib/azure/service_bus/topic.rb, line 173
def ordered_props
  [
    'DefaultMessageTimeToLive',
    'MaximumNumberOfSubscriptions',
    'MaxSizeInMegabytes',
    'RequiresDuplicateDetection',
    'DeadLetteringOnFilterEvaluationExceptions',
    'DuplicateDetectionHistoryTimeWindow',
    'EnableBatchedOperations',
    'SizeInBytes'
  ]
end
requires_duplicate_detection() click to toggle source

RequiresDuplicateDetection: True, False

If enabled, the topic will detect duplicate messages within the time span specified by the DuplicateDetectionHistoryTimeWindow property. Settable only at topic creation time.

Default: false

# File lib/azure/service_bus/topic.rb, line 105
def requires_duplicate_detection
  to_bool description['RequiresDuplicateDetection']
end
requires_duplicate_detection=(val) click to toggle source
# File lib/azure/service_bus/topic.rb, line 109
def requires_duplicate_detection=(val)
  _set 'RequiresDuplicateDetection', val
end
size_in_bytes() click to toggle source

SizeInBytes: Number

Reflects the actual bytes toward the topic quota that messages in the topic currently occupy. (read-only)

Range: 0 - MaxTopicSizeinMegaBytes

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