| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | using System.ComponentModel; |
| | 5 | | using Azure.Core; |
| | 6 | | using Azure.Messaging.EventHubs.Core; |
| | 7 | |
|
| | 8 | | namespace Azure.Messaging.EventHubs.Producer |
| | 9 | | { |
| | 10 | | /// <summary> |
| | 11 | | /// The set of options that can be specified when creating an <see cref="EventHubProducerClient" /> |
| | 12 | | /// to configure its behavior. |
| | 13 | | /// </summary> |
| | 14 | | /// |
| | 15 | | public class EventHubProducerClientOptions |
| | 16 | | { |
| | 17 | | /// <summary>The set of options to use for configuring the connection to the Event Hubs service.</summary> |
| 164 | 18 | | private EventHubConnectionOptions _connectionOptions = new EventHubConnectionOptions(); |
| | 19 | |
|
| | 20 | | /// <summary>The set of options to govern retry behavior and try timeouts.</summary> |
| 164 | 21 | | private EventHubsRetryOptions _retryOptions = new EventHubsRetryOptions(); |
| | 22 | |
|
| | 23 | | /// <summary> |
| | 24 | | /// The options used for configuring the connection to the Event Hubs service. |
| | 25 | | /// </summary> |
| | 26 | | /// |
| | 27 | | public EventHubConnectionOptions ConnectionOptions |
| | 28 | | { |
| 48 | 29 | | get => _connectionOptions; |
| | 30 | | set |
| | 31 | | { |
| 4 | 32 | | Argument.AssertNotNull(value, nameof(ConnectionOptions)); |
| 2 | 33 | | _connectionOptions = value; |
| 2 | 34 | | } |
| | 35 | | } |
| | 36 | |
|
| | 37 | | /// <summary> |
| | 38 | | /// The set of options to use for determining whether a failed operation should be retried and, |
| | 39 | | /// if so, the amount of time to wait between retry attempts. These options also control the |
| | 40 | | /// amount of time allowed for publishing events and other interactions with the Event Hubs service. |
| | 41 | | /// </summary> |
| | 42 | | /// |
| | 43 | | public EventHubsRetryOptions RetryOptions |
| | 44 | | { |
| 148 | 45 | | get => _retryOptions; |
| | 46 | | set |
| | 47 | | { |
| 18 | 48 | | Argument.AssertNotNull(value, nameof(RetryOptions)); |
| 16 | 49 | | _retryOptions = value; |
| 16 | 50 | | } |
| | 51 | | } |
| | 52 | |
|
| | 53 | | /// <summary> |
| | 54 | | /// Determines whether the specified <see cref="System.Object" /> is equal to this instance. |
| | 55 | | /// </summary> |
| | 56 | | /// |
| | 57 | | /// <param name="obj">The <see cref="System.Object" /> to compare with this instance.</param> |
| | 58 | | /// |
| | 59 | | /// <returns><c>true</c> if the specified <see cref="System.Object" /> is equal to this instance; otherwise, <c> |
| | 60 | | /// |
| | 61 | | [EditorBrowsable(EditorBrowsableState.Never)] |
| 0 | 62 | | public override bool Equals(object obj) => base.Equals(obj); |
| | 63 | |
|
| | 64 | | /// <summary> |
| | 65 | | /// Returns a hash code for this instance. |
| | 66 | | /// </summary> |
| | 67 | | /// |
| | 68 | | /// <returns>A hash code for this instance, suitable for use in hashing algorithms and data structures like a ha |
| | 69 | | /// |
| | 70 | | [EditorBrowsable(EditorBrowsableState.Never)] |
| 0 | 71 | | public override int GetHashCode() => base.GetHashCode(); |
| | 72 | |
|
| | 73 | | /// <summary> |
| | 74 | | /// Converts the instance to string representation. |
| | 75 | | /// </summary> |
| | 76 | | /// |
| | 77 | | /// <returns>A <see cref="System.String" /> that represents this instance.</returns> |
| | 78 | | /// |
| | 79 | | [EditorBrowsable(EditorBrowsableState.Never)] |
| 0 | 80 | | public override string ToString() => base.ToString(); |
| | 81 | |
|
| | 82 | | /// <summary> |
| | 83 | | /// Creates a new copy of the current <see cref="EventHubProducerClientOptions" />, cloning its attributes int |
| | 84 | | /// </summary> |
| | 85 | | /// |
| | 86 | | /// <returns>A new copy of <see cref="EventHubProducerClientOptions" />.</returns> |
| | 87 | | /// |
| | 88 | | internal EventHubProducerClientOptions Clone() => |
| 14 | 89 | | new EventHubProducerClientOptions |
| 14 | 90 | | { |
| 14 | 91 | | _connectionOptions = ConnectionOptions.Clone(), |
| 14 | 92 | | _retryOptions = RetryOptions.Clone() |
| 14 | 93 | | }; |
| | 94 | | } |
| | 95 | | } |