| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | using Azure.Core.Extensions; |
| | 5 | | using Azure.Messaging.EventHubs.Consumer; |
| | 6 | | using Azure.Messaging.EventHubs.Producer; |
| | 7 | |
|
| | 8 | | namespace Microsoft.Extensions.Azure |
| | 9 | | { |
| | 10 | | /// <summary> |
| | 11 | | /// The set of extensions to add the Event Hub client types to the clients builder |
| | 12 | | /// </summary> |
| | 13 | | public static class EventHubClientBuilderExtensions |
| | 14 | | { |
| | 15 | | /// <summary> |
| | 16 | | /// Registers a <see cref="EventHubProducerClient"/> instance with the provided <paramref name="connectionStri |
| | 17 | | /// </summary> |
| | 18 | | /// |
| | 19 | | public static IAzureClientBuilder<EventHubProducerClient, EventHubProducerClientOptions> AddEventHubProducerClie |
| | 20 | | where TBuilder : IAzureClientFactoryBuilder |
| | 21 | | { |
| 0 | 22 | | return builder.RegisterClientFactory<EventHubProducerClient, EventHubProducerClientOptions>(options => new E |
| | 23 | | } |
| | 24 | |
|
| | 25 | | /// <summary> |
| | 26 | | /// Registers a <see cref="EventHubProducerClient"/> instance with the provided <paramref name="connectionStri |
| | 27 | | /// </summary> |
| | 28 | | /// |
| | 29 | | public static IAzureClientBuilder<EventHubProducerClient, EventHubProducerClientOptions> AddEventHubProducerClie |
| | 30 | | where TBuilder : IAzureClientFactoryBuilder |
| | 31 | | { |
| 0 | 32 | | return builder.RegisterClientFactory<EventHubProducerClient, EventHubProducerClientOptions>(options => new E |
| | 33 | | } |
| | 34 | |
|
| | 35 | | /// <summary> |
| | 36 | | /// Registers a <see cref="EventHubProducerClient"/> instance with the provided <paramref name="fullyQualified |
| | 37 | | /// </summary> |
| | 38 | | /// |
| | 39 | | public static IAzureClientBuilder<EventHubProducerClient, EventHubProducerClientOptions> AddEventHubProducerClie |
| | 40 | | where TBuilder : IAzureClientFactoryBuilderWithCredential |
| | 41 | | { |
| 0 | 42 | | return builder.RegisterClientFactory<EventHubProducerClient, EventHubProducerClientOptions>((options, token) |
| | 43 | | } |
| | 44 | |
|
| | 45 | | /// <summary> |
| | 46 | | /// Registers a <see cref="EventHubProducerClient"/> instance with connection options loaded from the provided |
| | 47 | | /// </summary> |
| | 48 | | /// |
| | 49 | | public static IAzureClientBuilder<EventHubProducerClient, EventHubProducerClientOptions> AddEventHubProducerClie |
| | 50 | | where TBuilder : IAzureClientFactoryBuilderWithConfiguration<TConfiguration> |
| | 51 | | { |
| 0 | 52 | | return builder.RegisterClientFactory<EventHubProducerClient, EventHubProducerClientOptions>(configuration); |
| | 53 | | } |
| | 54 | |
|
| | 55 | | /// <summary> |
| | 56 | | /// Registers a <see cref="EventHubConsumerClientOptions"/> instance with the provided <paramref name="connect |
| | 57 | | /// </summary> |
| | 58 | | /// |
| | 59 | | public static IAzureClientBuilder<EventHubConsumerClient, EventHubConsumerClientOptions> AddEventHubConsumerClie |
| | 60 | | where TBuilder : IAzureClientFactoryBuilder |
| | 61 | | { |
| 0 | 62 | | return builder.RegisterClientFactory<EventHubConsumerClient, EventHubConsumerClientOptions>(options => new E |
| | 63 | | } |
| | 64 | |
|
| | 65 | | /// <summary> |
| | 66 | | /// Registers a <see cref="EventHubConsumerClient"/> instance with the provided <paramref name="connectionStri |
| | 67 | | /// </summary> |
| | 68 | | /// |
| | 69 | | public static IAzureClientBuilder<EventHubConsumerClient, EventHubConsumerClientOptions> AddEventHubConsumerClie |
| | 70 | | where TBuilder : IAzureClientFactoryBuilder |
| | 71 | | { |
| 0 | 72 | | return builder.RegisterClientFactory<EventHubConsumerClient, EventHubConsumerClientOptions>(options => new E |
| | 73 | | } |
| | 74 | |
|
| | 75 | | /// <summary> |
| | 76 | | /// Registers a <see cref="EventHubConsumerClient"/> instance with the provided <paramref name="fullyQualified |
| | 77 | | /// </summary> |
| | 78 | | /// |
| | 79 | | public static IAzureClientBuilder<EventHubConsumerClient, EventHubConsumerClientOptions> AddEventHubConsumerClie |
| | 80 | | where TBuilder : IAzureClientFactoryBuilderWithCredential |
| | 81 | | { |
| 0 | 82 | | return builder.RegisterClientFactory<EventHubConsumerClient, EventHubConsumerClientOptions>((options, token) |
| | 83 | | } |
| | 84 | |
|
| | 85 | | /// <summary> |
| | 86 | | /// Registers a <see cref="EventHubConsumerClient"/> instance with connection options loaded from the provided |
| | 87 | | /// </summary> |
| | 88 | | /// |
| | 89 | | public static IAzureClientBuilder<EventHubConsumerClient, EventHubConsumerClientOptions> AddEventHubConsumerClie |
| | 90 | | where TBuilder : IAzureClientFactoryBuilderWithConfiguration<TConfiguration> |
| | 91 | | { |
| 0 | 92 | | return builder.RegisterClientFactory<EventHubConsumerClient, EventHubConsumerClientOptions>(configuration); |
| | 93 | | } |
| | 94 | | } |
| | 95 | | } |