public static class ServiceCollectionExtensions
Reference documentation and code samples for the Cloud Pub/Sub v1 API class ServiceCollectionExtensions.
Provides extension methods to configure dependency injection with PubSub.
Namespace
MicrosoftMicrosoft.ExtensionsDependencyInjectionAssembly
Google.Cloud.PubSub.V1.dll
Methods
AddPublisherClient(IServiceCollection, TopicName)
public static IServiceCollection AddPublisherClient(this IServiceCollection services, TopicName topicName)
Adds a singleton PublisherClient associated with the specified TopicName, using default settings to the IServiceCollection.
Parameters | |
---|---|
Name | Description |
services | IServiceCollection The IServiceCollection to add the singleton client to. |
topicName | TopicName The TopicName to publish messages to. Must not be null. |
Returns | |
---|---|
Type | Description |
IServiceCollection | The updated IServiceCollection, for method chaining. |
AddPublisherClient(IServiceCollection, Action<PublisherClientBuilder>)
public static IServiceCollection AddPublisherClient(this IServiceCollection services, Action<PublisherClientBuilder> action)
Adds a singleton PublisherClient to the IServiceCollection as customized by the action
.
Parameters | |
---|---|
Name | Description |
services | IServiceCollection The IServiceCollection to add the singleton client to. |
action | ActionPublisherClientBuilder An action delegate to invoke on the PublisherClientBuilder for configuring the PublisherClient. This is invoked before |
Returns | |
---|---|
Type | Description |
IServiceCollection | The updated IServiceCollection, for method chaining. |
AddPublisherServiceApiClient(IServiceCollection, Action<PublisherServiceApiClientBuilder>)
public static IServiceCollection AddPublisherServiceApiClient(this IServiceCollection services, Action<PublisherServiceApiClientBuilder> action = null)
Adds a singleton PublisherServiceApiClient to services
.
Parameters | |
---|---|
Name | Description |
services | IServiceCollection The service collection to add the client to. The services are used to configure the client when requested. |
action | ActionPublisherServiceApiClientBuilder An optional action to invoke on the client builder. This is invoked before services from
|
Returns | |
---|---|
Type | Description |
IServiceCollection |
AddSchemaServiceClient(IServiceCollection, Action<SchemaServiceClientBuilder>)
public static IServiceCollection AddSchemaServiceClient(this IServiceCollection services, Action<SchemaServiceClientBuilder> action = null)
Adds a singleton SchemaServiceClient to services
.
Parameters | |
---|---|
Name | Description |
services | IServiceCollection The service collection to add the client to. The services are used to configure the client when requested. |
action | ActionSchemaServiceClientBuilder An optional action to invoke on the client builder. This is invoked before services from
|
Returns | |
---|---|
Type | Description |
IServiceCollection |
AddSubscriberClient(IServiceCollection, SubscriptionName)
public static IServiceCollection AddSubscriberClient(this IServiceCollection services, SubscriptionName subscriptionName)
Adds a singleton SubscriberClient associated with the specified SubscriptionName, using default settings to the IServiceCollection.
Parameters | |
---|---|
Name | Description |
services | IServiceCollection The IServiceCollection to add the singleton client to. |
subscriptionName | SubscriptionName The SubscriptionName to receive messages from. Must not be null. |
Returns | |
---|---|
Type | Description |
IServiceCollection | The updated IServiceCollection, for method chaining. |
AddSubscriberClient(IServiceCollection, Action<SubscriberClientBuilder>)
public static IServiceCollection AddSubscriberClient(this IServiceCollection services, Action<SubscriberClientBuilder> action)
Adds a singleton SubscriberClient to the IServiceCollection as customized by the action
.
Parameters | |
---|---|
Name | Description |
services | IServiceCollection The IServiceCollection to add the singleton client to. |
action | ActionSubscriberClientBuilder An action to invoke on the SubscriberClientBuilder for configuring the SubscriberClient. This is invoked before |
Returns | |
---|---|
Type | Description |
IServiceCollection | The updated IServiceCollection, for method chaining. |
AddSubscriberServiceApiClient(IServiceCollection, Action<SubscriberServiceApiClientBuilder>)
public static IServiceCollection AddSubscriberServiceApiClient(this IServiceCollection services, Action<SubscriberServiceApiClientBuilder> action = null)
Adds a singleton SubscriberServiceApiClient to services
.
Parameters | |
---|---|
Name | Description |
services | IServiceCollection The service collection to add the client to. The services are used to configure the client when requested. |
action | ActionSubscriberServiceApiClientBuilder An optional action to invoke on the client builder. This is invoked before services from
|
Returns | |
---|---|
Type | Description |
IServiceCollection |