Class: Azure::ServiceBus::Subscription
- Defined in:
- lib/azure/service_bus/subscription.rb
Instance Attribute Summary collapse
-
#topic ⇒ Object
Returns the value of attribute topic.
Attributes inherited from Resource
#author_name, #description, #id, #name, #published, #updated
Instance Method Summary collapse
-
#dead_lettering_on_filter_evaluation_exceptions ⇒ Object
DeadLetteringOnFilterEvaluationExceptions: True, False.
- #dead_lettering_on_filter_evaluation_exceptions=(val) ⇒ Object
-
#dead_lettering_on_message_expiration ⇒ Object
DeadLetteringOnMessageExpiration: True, False.
- #dead_lettering_on_message_expiration=(val) ⇒ Object
-
#default_message_time_to_live ⇒ Object
DefaultMessageTimeToLive: PTnHnMnS.
- #default_message_time_to_live=(val) ⇒ Object
-
#enable_batched_operations ⇒ Object
EnableBatchedOperations.
- #enable_batched_operations=(val) ⇒ Object
-
#initialize(name, options = {}) ⇒ Subscription
constructor
Public: Initialize the subscription.
-
#lock_duration ⇒ Object
LockDuration: XML datetime.
- #lock_duration=(val) ⇒ Object
-
#max_delivery_count ⇒ Object
MaxDeliveryCount.
- #max_delivery_count=(val) ⇒ Object
-
#message_count ⇒ Object
MessageCount.
- #message_count=(val) ⇒ Object
- #ordered_props ⇒ Object
-
#requires_session ⇒ Object
RequiresSession: True, False.
- #requires_session=(val) ⇒ Object
Methods inherited from Resource
Constructor Details
#initialize(name, options = {}) ⇒ Subscription
Public: Initialize the subscription.
Attributes
-
name
- A String with the name of the subscription. -
options
- The resource options Hash
Options
Accepted key/value pairs in options parameter are:
-
:lock_duration
- XML datetime. Determines the amount of time in seconds in which a message should be locked for processing by a receiver. -
:requires_session
- Boolean. If set to true, the queue will be session-aware and only SessionReceiver will be supported. -
:default_message_time_to_live
- XML datetime. Determines how long a message lives in the associated subscriptions. -
:dead_lettering_on_message_expiration:
- Boolean. This field controls how the Service Bus handles a message whose TTL has expired. -
: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. -
:enable_batched_operations
- Boolean. Enables or disables service side batching behavior when performing operations for the specific queue. -
:max_delivery_count
- Number. A message is automatically deadlettered after this number of deliveries. -
:message_count
- Number. Displays the number of messages currently in the queue.
42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/azure/service_bus/subscription.rb', line 42 def initialize(name, = {}) = {} ["LockDuration"] = [:lock_duration].to_s if .has_key?(:lock_duration) ["RequiresSession"] = [:requires_session].to_s if .has_key?(:requires_session) ["DefaultMessageTimeToLive"] = [:default_message_time_to_live].to_s if .has_key?(:default_message_time_to_live) ["DeadLetteringOnMessageExpiration"] = [:dead_lettering_on_message_expiration].to_s if .has_key?(:dead_lettering_on_message_expiration) ["DeadLetteringOnFilterEvaluationExceptions"] = [:dead_lettering_on_filter_evaluation_exceptions].to_s if .has_key?(:dead_lettering_on_filter_evaluation_exceptions) ["EnableBatchedOperations"] = [:enable_batched_operations].to_s if .has_key?(:enable_batched_operations) ["MaxDeliveryCount"] = [:max_delivery_count].to_s if .has_key?(:max_delivery_count) ["MessageCount"] = [:message_count].to_s if .has_key?(:message_count) super(name, ) end |
Instance Attribute Details
#topic ⇒ Object
Returns the value of attribute topic.
21 22 23 |
# File 'lib/azure/service_bus/subscription.rb', line 21 def topic @topic end |
Instance Method Details
#dead_lettering_on_filter_evaluation_exceptions ⇒ Object
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
127 128 129 |
# File 'lib/azure/service_bus/subscription.rb', line 127 def dead_lettering_on_filter_evaluation_exceptions to_bool description['DeadLetteringOnFilterEvaluationExceptions'] end |
#dead_lettering_on_filter_evaluation_exceptions=(val) ⇒ Object
131 132 133 |
# File 'lib/azure/service_bus/subscription.rb', line 131 def dead_lettering_on_filter_evaluation_exceptions=(val) _set 'DeadLetteringOnFilterEvaluationExceptions', val end |
#dead_lettering_on_message_expiration ⇒ Object
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 subscription’s dead-letter sub-queue. If disabled, message will be permanently deleted from the subscription’s main queue. Settable only at subscription creation time.
Default: false
109 110 111 |
# File 'lib/azure/service_bus/subscription.rb', line 109 def to_bool description['DeadLetteringOnMessageExpiration'] end |
#dead_lettering_on_message_expiration=(val) ⇒ Object
113 114 115 |
# File 'lib/azure/service_bus/subscription.rb', line 113 def (val) _set 'DeadLetteringOnMessageExpiration', val end |
#default_message_time_to_live ⇒ Object
DefaultMessageTimeToLive: PTnHnMnS
Determines how long a message lives in the subscription. Based on whether dead-lettering is enabled, a message whose TTL has expired will either be moved to the subscription’s associated DeadLtterQueue or permanently deleted.
Range: 1 second - TimeSpan.MaxValue Default: TimeSpan.MaxValue if the topic also does not specify a TTL. Otherwise the setting from topic is inherited.
93 94 95 |
# File 'lib/azure/service_bus/subscription.rb', line 93 def to_interval description['DefaultMessageTimeToLive'] end |
#default_message_time_to_live=(val) ⇒ Object
97 98 99 |
# File 'lib/azure/service_bus/subscription.rb', line 97 def (val) _set 'DefaultMessageTimeToLive', val end |
#enable_batched_operations ⇒ Object
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.
140 141 142 |
# File 'lib/azure/service_bus/subscription.rb', line 140 def enable_batched_operations to_bool description['EnableBatchedOperations'] end |
#enable_batched_operations=(val) ⇒ Object
144 145 146 |
# File 'lib/azure/service_bus/subscription.rb', line 144 def enable_batched_operations=(val) _set 'EnableBatchedOperations', val end |
#lock_duration ⇒ Object
LockDuration: XML datetime
The default lock duration is applied to subscriptions that do not define a lock duration. Settable only at subscription creation time:
Range: 0 - 5 minutes. 0 means that the message is not locked Default: 30 seconds
63 64 65 |
# File 'lib/azure/service_bus/subscription.rb', line 63 def lock_duration to_interval description['LockDuration'] end |
#lock_duration=(val) ⇒ Object
67 68 69 |
# File 'lib/azure/service_bus/subscription.rb', line 67 def lock_duration=(val) _set 'LockDuration', val end |
#max_delivery_count ⇒ Object
MaxDeliveryCount
The maximum number of times a message SB will try to deliver before being dead lettered or discarded.
151 152 153 |
# File 'lib/azure/service_bus/subscription.rb', line 151 def max_delivery_count to_i description['MaxDeliveryCount'] end |
#max_delivery_count=(val) ⇒ Object
155 156 157 |
# File 'lib/azure/service_bus/subscription.rb', line 155 def max_delivery_count=(val) _set 'MaxDeliveryCount', val end |
#message_count ⇒ Object
MessageCount
Reports the number of messages in the queue as reported by the monitoring system.
162 163 164 |
# File 'lib/azure/service_bus/subscription.rb', line 162 def to_i description['MessageCount'] end |
#message_count=(val) ⇒ Object
166 167 168 |
# File 'lib/azure/service_bus/subscription.rb', line 166 def (val) _set 'MessageCount', val end |
#ordered_props ⇒ Object
170 171 172 173 174 175 176 177 178 179 180 181 |
# File 'lib/azure/service_bus/subscription.rb', line 170 def ordered_props [ "LockDuration", "RequiresSession", "DefaultMessageTimeToLive", "DeadLetteringOnMessageExpiration", "DeadLetteringOnFilterEvaluationExceptions", "MessageCount", "MaxDeliveryCount", "EnableBatchedOperations" ] end |
#requires_session ⇒ Object
RequiresSession: True, False
Settable only at subscription creation time. If set to true, the subscription will be session-aware and only SessionReceiver will be supported. Session-aware subscription are not supported through REST.
Default: false
77 78 79 |
# File 'lib/azure/service_bus/subscription.rb', line 77 def requires_session to_bool description['RequiresSession'] end |
#requires_session=(val) ⇒ Object
81 82 83 |
# File 'lib/azure/service_bus/subscription.rb', line 81 def requires_session=(val) _set 'RequiresSession', val end |