Eventarc Publishing v1 API - Class PublisherClient (2.0.0-beta07)

public abstract class PublisherClient

Reference documentation and code samples for the Eventarc Publishing v1 API class PublisherClient.

Publisher client wrapper, for convenient use.

Inheritance

object > PublisherClient

Derived Types

Namespace

Google.Cloud.Eventarc.Publishing.V1

Assembly

Google.Cloud.Eventarc.Publishing.V1.dll

Remarks

Eventarc processes events generated by an event provider and delivers them to a subscriber.

An event provider is a software-as-a-service (SaaS) system or product that can generate and deliver events through Eventarc.

A third-party event provider is an event provider from outside of Google.

A partner is a third-party event provider that is integrated with Eventarc.

A subscriber is a GCP customer interested in receiving events.

Channel is a first-class Eventarc resource that is created and managed by the subscriber in their GCP project. A Channel represents a subscriber's intent to receive events from an event provider. A Channel is associated with exactly one event provider.

ChannelConnection is a first-class Eventarc resource that is created and managed by the partner in their GCP project. A ChannelConnection represents a connection between a partner and a subscriber's Channel. A ChannelConnection has a one-to-one mapping with a Channel.

Publisher allows an event provider to publish events to Eventarc.

Properties

DefaultEndpoint

public static string DefaultEndpoint { get; }

The default endpoint for the Publisher service, which is a host of "eventarcpublishing.googleapis.com" and a port of 443.

Property Value
Type Description
string

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default Publisher scopes.

Property Value
Type Description
IReadOnlyListstring
Remarks

The default Publisher scopes are:

GrpcClient

public virtual Publisher.PublisherClient GrpcClient { get; }

The underlying gRPC Publisher client

Property Value
Type Description
PublisherPublisherClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
Type Description
ServiceMetadata

Methods

Create()

public static PublisherClient Create()

Synchronously creates a PublisherClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use PublisherClientBuilder.

Returns
Type Description
PublisherClient

The created PublisherClient.

CreateAsync(CancellationToken)

public static Task<PublisherClient> CreateAsync(CancellationToken cancellationToken = default)

Asynchronously creates a PublisherClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use PublisherClientBuilder.

Parameter
Name Description
cancellationToken CancellationToken

The CancellationToken to use while creating the client.

Returns
Type Description
TaskPublisherClient

The task representing the created PublisherClient.

Publish(PublishRequest, CallSettings)

public virtual PublishResponse Publish(PublishRequest request, CallSettings callSettings = null)

Publish events to a message bus.

Parameters
Name Description
request PublishRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PublishResponse

The RPC response.

Example
// Create client
PublisherClient publisherClient = PublisherClient.Create();
// Initialize request argument(s)
PublishRequest request = new PublishRequest
{
    MessageBus = "",
    ProtoMessage = new CloudEvent(),
};
// Make the request
PublishResponse response = publisherClient.Publish(request);

PublishAsync(PublishRequest, CallSettings)

public virtual Task<PublishResponse> PublishAsync(PublishRequest request, CallSettings callSettings = null)

Publish events to a message bus.

Parameters
Name Description
request PublishRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskPublishResponse

A Task containing the RPC response.

Example
// Create client
PublisherClient publisherClient = await PublisherClient.CreateAsync();
// Initialize request argument(s)
PublishRequest request = new PublishRequest
{
    MessageBus = "",
    ProtoMessage = new CloudEvent(),
};
// Make the request
PublishResponse response = await publisherClient.PublishAsync(request);

PublishAsync(PublishRequest, CancellationToken)

public virtual Task<PublishResponse> PublishAsync(PublishRequest request, CancellationToken cancellationToken)

Publish events to a message bus.

Parameters
Name Description
request PublishRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskPublishResponse

A Task containing the RPC response.

Example
// Create client
PublisherClient publisherClient = await PublisherClient.CreateAsync();
// Initialize request argument(s)
PublishRequest request = new PublishRequest
{
    MessageBus = "",
    ProtoMessage = new CloudEvent(),
};
// Make the request
PublishResponse response = await publisherClient.PublishAsync(request);

PublishChannelConnectionEvents(PublishChannelConnectionEventsRequest, CallSettings)

public virtual PublishChannelConnectionEventsResponse PublishChannelConnectionEvents(PublishChannelConnectionEventsRequest request, CallSettings callSettings = null)

Publish events to a ChannelConnection in a partner's project.

Parameters
Name Description
request PublishChannelConnectionEventsRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PublishChannelConnectionEventsResponse

The RPC response.

Example
// Create client
PublisherClient publisherClient = PublisherClient.Create();
// Initialize request argument(s)
PublishChannelConnectionEventsRequest request = new PublishChannelConnectionEventsRequest
{
    ChannelConnection = "",
    Events = { new Any(), },
    TextEvents = { "", },
};
// Make the request
PublishChannelConnectionEventsResponse response = publisherClient.PublishChannelConnectionEvents(request);

PublishChannelConnectionEventsAsync(PublishChannelConnectionEventsRequest, CallSettings)

public virtual Task<PublishChannelConnectionEventsResponse> PublishChannelConnectionEventsAsync(PublishChannelConnectionEventsRequest request, CallSettings callSettings = null)

Publish events to a ChannelConnection in a partner's project.

Parameters
Name Description
request PublishChannelConnectionEventsRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskPublishChannelConnectionEventsResponse

A Task containing the RPC response.

Example
// Create client
PublisherClient publisherClient = await PublisherClient.CreateAsync();
// Initialize request argument(s)
PublishChannelConnectionEventsRequest request = new PublishChannelConnectionEventsRequest
{
    ChannelConnection = "",
    Events = { new Any(), },
    TextEvents = { "", },
};
// Make the request
PublishChannelConnectionEventsResponse response = await publisherClient.PublishChannelConnectionEventsAsync(request);

PublishChannelConnectionEventsAsync(PublishChannelConnectionEventsRequest, CancellationToken)

public virtual Task<PublishChannelConnectionEventsResponse> PublishChannelConnectionEventsAsync(PublishChannelConnectionEventsRequest request, CancellationToken cancellationToken)

Publish events to a ChannelConnection in a partner's project.

Parameters
Name Description
request PublishChannelConnectionEventsRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskPublishChannelConnectionEventsResponse

A Task containing the RPC response.

Example
// Create client
PublisherClient publisherClient = await PublisherClient.CreateAsync();
// Initialize request argument(s)
PublishChannelConnectionEventsRequest request = new PublishChannelConnectionEventsRequest
{
    ChannelConnection = "",
    Events = { new Any(), },
    TextEvents = { "", },
};
// Make the request
PublishChannelConnectionEventsResponse response = await publisherClient.PublishChannelConnectionEventsAsync(request);

PublishEvents(PublishEventsRequest, CallSettings)

public virtual PublishEventsResponse PublishEvents(PublishEventsRequest request, CallSettings callSettings = null)

Publish events to a subscriber's channel.

Parameters
Name Description
request PublishEventsRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PublishEventsResponse

The RPC response.

Example
// Create client
PublisherClient publisherClient = PublisherClient.Create();
// Initialize request argument(s)
PublishEventsRequest request = new PublishEventsRequest
{
    Channel = "",
    Events = { new Any(), },
    TextEvents = { "", },
};
// Make the request
PublishEventsResponse response = publisherClient.PublishEvents(request);

PublishEventsAsync(PublishEventsRequest, CallSettings)

public virtual Task<PublishEventsResponse> PublishEventsAsync(PublishEventsRequest request, CallSettings callSettings = null)

Publish events to a subscriber's channel.

Parameters
Name Description
request PublishEventsRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskPublishEventsResponse

A Task containing the RPC response.

Example
// Create client
PublisherClient publisherClient = await PublisherClient.CreateAsync();
// Initialize request argument(s)
PublishEventsRequest request = new PublishEventsRequest
{
    Channel = "",
    Events = { new Any(), },
    TextEvents = { "", },
};
// Make the request
PublishEventsResponse response = await publisherClient.PublishEventsAsync(request);

PublishEventsAsync(PublishEventsRequest, CancellationToken)

public virtual Task<PublishEventsResponse> PublishEventsAsync(PublishEventsRequest request, CancellationToken cancellationToken)

Publish events to a subscriber's channel.

Parameters
Name Description
request PublishEventsRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskPublishEventsResponse

A Task containing the RPC response.

Example
// Create client
PublisherClient publisherClient = await PublisherClient.CreateAsync();
// Initialize request argument(s)
PublishEventsRequest request = new PublishEventsRequest
{
    Channel = "",
    Events = { new Any(), },
    TextEvents = { "", },
};
// Make the request
PublishEventsResponse response = await publisherClient.PublishEventsAsync(request);

ShutdownDefaultChannelsAsync()

public static Task ShutdownDefaultChannelsAsync()

Shuts down any channels automatically created by Create() and CreateAsync(CancellationToken). Channels which weren't automatically created are not affected.

Returns
Type Description
Task

A task representing the asynchronous shutdown operation.

Remarks

After calling this method, further calls to Create() and CreateAsync(CancellationToken) will create new channels, which could in turn be shut down by another call to this method.