| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | using System.ComponentModel; |
| | 5 | | using Azure.Core; |
| | 6 | |
|
| | 7 | | namespace Azure.Messaging.ServiceBus |
| | 8 | | { |
| | 9 | | /// <summary> |
| | 10 | | /// The set of options that can be specified when creating a <see cref="ServiceBusReceiver"/> |
| | 11 | | /// to configure its behavior. |
| | 12 | | /// </summary> |
| | 13 | | public class ServiceBusReceiverOptions |
| | 14 | | { |
| | 15 | | /// <summary> |
| | 16 | | /// The number of messages that will be eagerly requested from Queues or Subscriptions and queued locally withou |
| | 17 | | /// whether the receiver is actively receiving, intended to help maximize throughput by allowing the receiver to |
| | 18 | | /// from a local cache rather than waiting on a service request. |
| | 19 | | /// </summary> |
| | 20 | | public int PrefetchCount |
| | 21 | | { |
| | 22 | | get |
| | 23 | | { |
| 116 | 24 | | return _prefetchCount; |
| | 25 | | } |
| | 26 | | set |
| | 27 | | { |
| 82 | 28 | | Argument.AssertAtLeast(value, 0, nameof(PrefetchCount)); |
| 80 | 29 | | _prefetchCount = value; |
| 80 | 30 | | } |
| | 31 | | } |
| | 32 | | private int _prefetchCount = 0; |
| | 33 | |
|
| | 34 | | /// <summary> |
| | 35 | | /// The <see cref="ReceiveMode"/> used to specify how messages are received. Defaults to PeekLock mode. |
| | 36 | | /// </summary> |
| 194 | 37 | | public ReceiveMode ReceiveMode { get; set; } = ReceiveMode.PeekLock; |
| | 38 | |
|
| | 39 | | /// <summary> |
| | 40 | | /// Determines whether the specified <see cref="System.Object" /> is equal to this instance. |
| | 41 | | /// </summary> |
| | 42 | | /// |
| | 43 | | /// <param name="obj">The <see cref="System.Object" /> to compare with this instance.</param> |
| | 44 | | /// |
| | 45 | | /// <returns><c>true</c> if the specified <see cref="System.Object" /> is equal to this instance; otherwise, <c> |
| | 46 | | [EditorBrowsable(EditorBrowsableState.Never)] |
| 0 | 47 | | public override bool Equals(object obj) => base.Equals(obj); |
| | 48 | |
|
| | 49 | | /// <summary> |
| | 50 | | /// Returns a hash code for this instance. |
| | 51 | | /// </summary> |
| | 52 | | /// |
| | 53 | | /// <returns>A hash code for this instance, suitable for use in hashing algorithms and data structures like a ha |
| | 54 | | /// |
| | 55 | | [EditorBrowsable(EditorBrowsableState.Never)] |
| 0 | 56 | | public override int GetHashCode() => base.GetHashCode(); |
| | 57 | |
|
| | 58 | | /// <summary> |
| | 59 | | /// Converts the instance to string representation. |
| | 60 | | /// </summary> |
| | 61 | | /// |
| | 62 | | /// <returns>A <see cref="System.String" /> that represents this instance.</returns> |
| | 63 | | /// |
| | 64 | | [EditorBrowsable(EditorBrowsableState.Never)] |
| 0 | 65 | | public override string ToString() => base.ToString(); |
| | 66 | |
|
| | 67 | | /// <summary> |
| | 68 | | /// Creates a new copy of the current <see cref="ServiceBusReceiverOptions" />, cloning its attributes into a ne |
| | 69 | | /// </summary> |
| | 70 | | /// |
| | 71 | | /// <returns>A new copy of <see cref="ServiceBusReceiverOptions" />.</returns> |
| | 72 | | internal ServiceBusReceiverOptions Clone() => |
| 58 | 73 | | new ServiceBusReceiverOptions |
| 58 | 74 | | { |
| 58 | 75 | | ReceiveMode = ReceiveMode, |
| 58 | 76 | | PrefetchCount = PrefetchCount |
| 58 | 77 | | }; |
| | 78 | | } |
| | 79 | | } |