# Cloud Pub/Sub v1 API - Class PublisherClient.Settings (3.36.0)

3.36.0 (latest) 3.35.0 3.34.0 3.33.0 3.32.0 3.31.0 3.30.0 3.29.0 3.28.0 3.27.0 3.26.0 3.25.0 3.24.0 3.23.0 3.22.0 3.21.0 3.20.0 3.19.0 3.18.0 3.17.0 3.16.0 3.15.0 3.14.0 3.13.0 3.12.0 3.11.0 3.10.1 3.9.1 3.8.0 3.7.0 3.6.0 3.5.1 3.4.0 3.3.0 3.2.0 3.1.0 3.0.0 2.10.0 2.9.0 2.8.0 2.7.0 2.6.0 2.5.0 2.4.0 2.3.0

    public sealed class PublisherClient.Settings

Reference documentation and code samples for the Cloud Pub/Sub v1 API class PublisherClient.Settings.

Settings for the [PublisherClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.PublisherClient).

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> PublisherClient.Settings

## Inherited Members

[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Namespace

[Google.Cloud.PubSub.V1](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1)

## Assembly

Google.Cloud.PubSub.V1.dll

## Constructors

### Settings()

    public Settings()

Create a new instance.

## Properties

### BatchingSettings

    public BatchingSettings BatchingSettings { get; set; }

[BatchingSettings](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.PublisherClient.Settings#Google_Cloud_PubSub_V1_PublisherClient_Settings_BatchingSettings) that control how messages are batched when sending.
If `null`, defaults to [DefaultBatchingSettings](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.PublisherClient#Google_Cloud_PubSub_V1_PublisherClient_DefaultBatchingSettings).

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.BatchingSettings.html` |   |

### CompressionBytesThreshold

    public long? CompressionBytesThreshold { get; set; }

Specifies the threshold for the number of bytes in a message batch before compression is applied.
This property comes into play only when [EnableCompression](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.PublisherClient.Settings#Google_Cloud_PubSub_V1_PublisherClient_Settings_EnableCompression) is set to `true`.
If the number of bytes in a batch is less than this value, compression will not be applied even
if [EnableCompression](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.PublisherClient.Settings#Google_Cloud_PubSub_V1_PublisherClient_Settings_EnableCompression) is `true`.
If `null`, defaults to [DefaultCompressionBytesThreshold](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.PublisherClient#Google_Cloud_PubSub_V1_PublisherClient_DefaultCompressionBytesThreshold).

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.int64` |   |

### DisposeTimeout

    public TimeSpan? DisposeTimeout { get; set; }

Represents a time interval to wait for the [PublisherClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.PublisherClient) to send any pending messages
after the [DisposeAsync()](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.PublisherClient#Google_Cloud_PubSub_V1_PublisherClient_DisposeAsync) method has been called. If this time interval expires, the
clean shutdown process will be aborted, and there may be locally queued messages that remain unsent.
If `null`, defaults to [DefaultDisposeTimeout](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.PublisherClient#Google_Cloud_PubSub_V1_PublisherClient_DefaultDisposeTimeout).

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.timespan` |   |

### EnableCompression

    public bool EnableCompression { get; set; }

Enables publish message compression. If set to `true`, messages will be compressed before being sent to the server
by the [PublisherClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.PublisherClient).

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.boolean` |   |

### EnableMessageOrdering

    public bool EnableMessageOrdering { get; set; }

Enable message ordering. It is invalid to set [OrderingKey](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.PubsubMessage#Google_Cloud_PubSub_V1_PubsubMessage_OrderingKey) in a message
if this has not been set to `true`.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.boolean` |   |

### Scheduler

    public IScheduler Scheduler { get; set; }

The [IScheduler](https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.IScheduler.html) to use.
If `null`, defaults to [SystemScheduler](https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.SystemScheduler.html). Usually only useful for testing.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.IScheduler.html` |   |

## Methods

### Clone()

    public PublisherClient.Settings Clone()

Create a clone of this object.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.PublisherClienthttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.PublisherClient.Settings` | A clone of this object. |