# mulesoft Google Pub/Sub Connector - Full Documentation --- product: Google Pub/Sub Connector version: 1.0 --- # Google Pub/Sub Connector 1.0 > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Anypoint Connector for Google Pub/Sub (Google Pub/Sub Connector) enables you to access the Google Pub/Sub messaging platform. This connector exposes operations provided by the Google Pub/Sub client libraries. For compatibility information and fixed issues, refer to the Google Pub/Sub Connector Release Notes. ## Before You Begin To use this connector, you must be familiar with: - The Google Pub/Sub API - Anypoint Connectors - Mule runtime engine (Mule) - Elements and global elements in a Mule flow - Creating a Mule app using Anypoint Studio or Anypoint Code Builder Before creating an app, you must have: - Credentials to access the target resource - Anypoint Studio or Anypoint Code Builder ## Common Use Cases for the Connector Some common use cases for Google Pub/Sub Connector include: - Publishing messages - Listening to messages - Managing snapshots - Replaying messages ## Authentication Types Google Pub/Sub Connector uses the PubSub Connection authentication method, in which you create a service account and obtain credentials. For more information, refer to [Google Cloud Service Accounts](https://docs.cloud.google.com/iam/docs/service-account-overview). ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Use Exchange to Discover Connectors, Templates, and Examples](https://docs.mulesoft.com/connectors/introduction/intro-use-exchange) - [Google Pub/Sub Connector Reference](https://docs.mulesoft.com/google-pubsub-connector/1.0/google-pubsub-connector-reference) - [Salesforce Help](https://help.salesforce.com) --- product: Google Pub/Sub Connector version: 1.0 --- # Google Pub/Sub Connector 1.0 Examples > For the full documentation index, see: https://docs.mulesoft.com/llms.txt These examples show you how to use Google Pub/Sub Connector to perform the following actions: - [Create a snapshot](#create-snapshot) - [Patch a snapshot](#patch-snapshot) - [Get a snapshot](#get-snapshot) - [Delete a snapshot](#delete-snapshot) - [Publish a message](#publish-message) ## Configure a PubSub Connection Because this connector uses PubSub to secure connections, you must specify the PubSub Connection field values. To do this: - [Create a configuration file for a PubSub Connection.](#create-config-file) - [Configure the PubSub Connection global elements.](#configure-pubsub-global) - [Configure a global element for the properties file.](#configure-global) ### Create a Configuration File for a PubSub Connection Create a configuration file that includes properties for a PubSub Connection: 1. Create a file named `mule-app.properties` in the `/src/main/resources/` folder. 2. In the `mule-app.properties` file, create a set of properties for `PubSub Connection`, similar to the ones that follow, replacing the bracketed text (including the brackets) with the correct values for your configuration: config.private\_key\_id= config.private\_key= config.client\_id= config.client\_email= config.default\_project\_id= For more information about creating a properties file, refer to [Configuring Property Placeholders](https://docs.mulesoft.com/mule-runtime/latest/mule-app-properties-to-configure). ### Configure the PubSub Connection Global Elements Configure global elements for the `PubSub Connection` file: 1. Create a new Mule project. 2. In the **Mule Palette** view, click **Search in Exchange** and enter `google pubsub`. 3. Add **Google Pub/Sub Connector** to the **Selected modules** section and click **Finish**. 4. Click the **Global Elements** tab and click **Create**. 5. Select **Connector Configuration > Google PubSub Configuration** and click **OK**. 6. Enter the following values:
FieldValue

Name

Google_Pub_Sub_Configuration

Private key id

${config.private_key_id}

Private key

${config.private_key}

Client id

${config.client_id}

Client email

${config.client_email}

Default Project Id

${config.default_project_id}

Default Subscription Name

orders-subscription

Default Topic Name

orders-topic

7. Click **OK**. ### Configure a Global Element for the Properties File Configure a global element for the `mule-app.properties` file so that Mule knows where to find it: 1. Click the **Global Elements** tab and click **Create**. 2. In the **Choose Global Type** dialog, select **Configuration properties** and click **OK**. 3. In the **File** field, enter `mule.app.properties`. 4. Click **OK**. ## Create a Snapshot This Mule flow creates a snapshot from the requested subscription. This example uses the following operations: - **HTTP Listener** Accepts data from HTTP requests - **Create snapshot** Creates a snapshot - **Logger** Shows the HTTP response from the **Create snapshot** operation - **Transform Message** Outputs the results of the **Create snapshot** operation in JSON format ![Studio Flow for the Create Snapshot Operation](/mulesoft/current/en-us/google-pubsub-connector/1.0/_images/create-snapshot-flow.png) ### XML for This Example Paste this code into the Studio XML editor to quickly load the flow for this example into your Mule app: ```xml ``` ### Steps for Running This Example 1. Verify that your connector is configured. 2. Save the project. 3. From a web browser, test the application by entering `[http://localhost:8081/](http://localhost:8081/)`. You should see the **Create Snapshot** form with pre-populated **Snapshot Name** and **Subscription Name** fields. ![Create Snapshot Form](/mulesoft/current/en-us/google-pubsub-connector/1.0/_images/create-snapshot.png) 4. Click **Create Snapshot**. You should see an alert that the snapshot was successfully created. ## Patch a Snapshot This Mule flow updates an existing snapshot. This example uses the following operations: - **HTTP Listener** Accepts data from HTTP requests - **Patch snapshot** Updates a snapshot - **Transform Message** Outputs the results of the **Patch snapshot** operation in JSON format - **Logger** Shows the HTTP response from the **Patch snapshot** operation ![Studio Flow for the Patch Snapshot Operation](/mulesoft/current/en-us/google-pubsub-connector/1.0/_images/patch-snapshot-flow.png) ### XML for This Example Paste this code into the Studio XML editor to quickly load the flow for this example into your Mule app: ```xml >/snapshots/<>", "topic": "projects/<>/topic/<>" "expireTime": "2099-01-01T00:00:00Z", "labels": { "label1": "test-patch-snapshot" } }]]]> ``` ## Get a Snapshot This Mule flow retrieves an existing snapshot. This example uses the following operations: - **HTTP Listener** Accepts data from HTTP requests - **Get snapshot** Retrieves a snapshot - **Logger** Shows the HTTP response from the **Get snapshot** operation - **Transform Message** Outputs the results of the **Get snapshot** operation in JSON format ![Studio Flow for the Get Snapshot Operation](/mulesoft/current/en-us/google-pubsub-connector/1.0/_images/get-snapshot-flow.png) ### XML for This Example Paste this code into the Studio XML editor to quickly load the flow for this example into your Mule app: ```xml ``` ### Steps for Running This Example 1. Verify that your connector is configured. 2. Save the project. 3. From a web browser, test the application by entering `[http://localhost:8081/](http://localhost:8081/)`. You should see the **Get Snapshot** form with a pre-populated **Snapshot Name** field. ![Get Snapshot Form](/mulesoft/current/en-us/google-pubsub-connector/1.0/_images/get-snapshot.png) 4. Click **Get Snapshot**. You should see an alert that the snapshot was successfully retrieved. ## Delete a Snapshot This Mule flow deletes an existing snapshot. This example uses the following operations: - **HTTP Listener** Accepts data from HTTP requests - **Delete snapshot** Deletes a snapshot ![Studio Flow for the Delete Snapshot Operation](/mulesoft/current/en-us/google-pubsub-connector/1.0/_images/delete-snapshot-flow.png) ### XML for This Example Paste this code into the Studio XML editor to quickly load the flow for this example into your Mule app: ```xml ``` ### Steps for Running This Example 1. Verify that your connector is configured. 2. Save the project. 3. From a web browser, test the application by entering `[http://localhost:8081/](http://localhost:8081/)`. You should see the **Delete Snapshot** form with a pre-populated **Snapshot Name** field. ![Delete Snapshot Form](/mulesoft/current/en-us/google-pubsub-connector/1.0/_images/delete-snapshot.png) 4. Click **Delete Snapshot**. You should see an alert that the snapshot was successfully deleted. ## Publish a Message This Mule flow publishes a single message to a selected topic. This example uses the following operations: - **HTTP Listener** Accepts data from HTTP requests - **Publish Message** Publishes a message ![Studio Flow for the Publish Message Operation](/mulesoft/current/en-us/google-pubsub-connector/1.0/_images/publish-message-flow.png) ### XML for This Example Paste this code into the Studio XML editor to quickly load the flow for this example into your Mule app: ```xml ``` ### Steps for Running This Example 1. Verify that your connector is configured. 2. Save the project. 3. From a web browser, test the application by entering `[http://localhost:8081/](http://localhost:8081/)`. You should see the **Publish Message** form with pre-populated **Topic Name**, **Ordering Key**, and **Message** fields. ![Publish Message form](/mulesoft/current/en-us/google-pubsub-connector/1.0/_images/publish-message.png) 4. Click **Publish Message**. You should see an alert that the snapshot was successfully published. ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Salesforce Help](https://help.salesforce.com) --- product: Google Pub/Sub Connector version: 1.0 --- # Google Pub/Sub Connector 1.0 Reference > For the full documentation index, see: https://docs.mulesoft.com/llms.txt ## Configurations --- ### Configuration #### Parameters
NameTypeDescriptionDefault ValueRequired

Name

String

Name for this configuration. Connectors reference the configuration with this name.

x

Connection

Connection types for this configuration.

x

Default Project Id

String

Globally unique identifier for your project. Used in operations. It can be overridden at the config level.

Default Subscription Name

String

Default subscription for your project. Used in operations. It can be overridden at the config level.

Default Topic Name

String

Default topic for your project. Used in operations. It can be overridden at the config level.

Name

String

ID used to reference this configuration.

x

Expiration Policy

Configures the minimum amount of time that a dynamic configuration instance can remain idle before Mule considers it eligible for expiration.

#### Connection Types ##### PubSub Connection ###### Parameters
NameTypeDescriptionDefault ValueRequired

Private key ID

String

ID of the private key for the service account. It is a part of the service-credentials created in PubSub.

x

Client ID

String

ID of the client for the service account. It is a part of the service-credentials created in PubSub.

x

Client email

String

Client email for the service account. It is a part of the service-credentials created in PubSub.

x

Private key

String

Private key for the service account. It is a part of the service-credentials created in PubSub.

x

Message Count Batch Size

Number

Maximum number of messages in the batch. After the maximum number of messages is reached, the elements are wrapped up in a batch and sent.

10

Request Size Threshold

Number

Maximum memory size of the messages in the batch. After the maximum memory size is reached, the elements are wrapped up in a batch and sent.

1

Request Size Threshold Unit

Enumeration, one of:

  • BYTE

  • KB

  • MB

  • GB

Data unit for the Request Size Threshold field.

KB

Publish Delay Threshold

Number

Maximum delay threshold to use for batching. After the maximum amount of time has elapsed (counting from the first element added), the elements are wrapped up in a batch and sent. This value must not be set too high, especially for the MILLISECONDS time unit. Otherwise, calls might appear to never complete.

10

Publish Delay Threshold Time Unit

Enumeration, one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

Time unit for the Publish Delay Threshold field.

MILLISECONDS

Enable batching

Boolean

Flag for enabling or disabling publish request batching.

false

Limit Exceeded Behavior

Enumeration, one of:

  • THROW_EXCEPTION

  • BLOCK

  • IGNORE

If not set to IGNORE, flow control enables you to control the publishing behavior by specifying limits for Max Outstanding Request Size and Max Outstanding Element Count.

  • THROW_EXCEPTION

    If the memory size or the amount of outstanding elements (messages where no Ack() or Nack() was performed) exceeds the specified limits, the publisher throws a FlowControlException.

  • BLOCK

    If the memory size or the amount of outstanding elements (messages where no Ack() or Nack() was performed) exceeds the specified limits, the publisher does not publish more messages.

  • IGNORE

    The publisher does not account for specified limits and does not control the message publishing rate.

Max Outstanding Request Size

Number

Maximum amount of memory accumulated by the request before enforcing flow control.

100

Max Outstanding Request Size Unit

Enumeration, one of:

  • BYTE

  • KB

  • MB

  • GB

Data unit for the Max Outstanding Request Size field.

MB

Max Outstanding Element Count

Number

Maximum number of outstanding elements to keep in memory before enforcing flow control.

100

Reconnection

Configures a reconnection strategy to use when a connector operation fails to connect to an external server.

## Supported Operations - [Create Snapshot](#CreateSnapshot) - [Delete Snapshot](#DeleteSnapshot) - [Get Snapshot](#GetSnapshot) - [Get Snapshot List](#GetSnapshotList) - [Patch Snapshot](#PatchSnapshot) - [Publish Message](#PublishMessage) - [Seek Messages](#SeekMessages) ## Associated Sources - [On message listener](#MessageListener) ## Operations ## Create Snapshot `` Creates a snapshot from the requested subscription. Use snapshots in seek operations, which manage message acknowledgments in bulk. This operation enables you to set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot. ### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Snapshot Name

String

Project-wide unique identifier for a snapshot.

x

Labels

Object

Key-value pairs that help users to organize Google Cloud resources. Attaching labels to resources filters them based on the labels.

Config Ref

ConfigurationProvider

Name of the configuration used to execute this component.

x

Project ID

String

Globally unique identifier for your project.

Subscription Name

String

Project-wide unique identifier for the subscription.

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The outcome of the expression is stored in the Target Variable field.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

### Output

Type

Snapshot

### For Configurations - [Configuration](#Config) ### Throws - PUBSUB:ALREADY\_EXISTS - PUBSUB:BAD\_GATEWAY - PUBSUB:CANCELLED - PUBSUB:CONNECTIVITY - PUBSUB:DEADLINE\_EXCEEDED - PUBSUB:FAILED\_PRECONDITION - PUBSUB:INVALID\_ARGUMENT - PUBSUB:NOT\_FOUND - PUBSUB:PERMISSION\_DENIED - PUBSUB:RETRY\_EXHAUSTED - PUBSUB:UNAVAILABLE ## Delete Snapshot `` Deletes an existing snapshot. ### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Config Ref

ConfigurationProvider

Name of the configuration used to execute this component.

x

Project ID

String

Globally unique identifier for your project.

Snapshot Name

String

Project-wide unique identifier for a snapshot.

x

Reconnection Strategy

Retry strategy in case of connectivity errors.

### For Configurations - [Configuration](#Config) ### Throws - PUBSUB:BAD\_GATEWAY - PUBSUB:CANCELLED - PUBSUB:CONNECTIVITY - PUBSUB:DEADLINE\_EXCEEDED - PUBSUB:FAILED\_PRECONDITION - PUBSUB:INVALID\_ARGUMENT - PUBSUB:NOT\_FOUND - PUBSUB:PERMISSION\_DENIED - PUBSUB:RETRY\_EXHAUSTED - PUBSUB:UNAVAILABLE ## Get Snapshot `` Retrieves a snapshot. ### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Config Ref

ConfigurationProvider

Name of the configuration used to execute this component.

x

Project ID

String

Globally unique identifier for your project.

Snapshot Name

String

Project-wide unique identifier for a snapshot.

x

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The outcome of the expression is stored in the Target Variable field.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

### Output

Type

Snapshot

### For Configurations - [Configuration](#Config) ### Throws - PUBSUB:BAD\_GATEWAY - PUBSUB:CANCELLED - PUBSUB:CONNECTIVITY - PUBSUB:DEADLINE\_EXCEEDED - PUBSUB:FAILED\_PRECONDITION - PUBSUB:INVALID\_ARGUMENT - PUBSUB:NOT\_FOUND - PUBSUB:PERMISSION\_DENIED - PUBSUB:RETRY\_EXHAUSTED - PUBSUB:UNAVAILABLE ## Get Snapshot List `` Retrieves a list of existing snapshots from a selected project. ### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Project Id

String

Globally unique identifier for your project.

Config Ref

ConfigurationProvider

Name of the configuration used to execute this component.

x

Streaming Strategy

Configures how Mule processes streams. The default is to use repeatable streams.

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The outcome of the expression is stored in the Target Variable field.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

### Output

Type

Array of Snapshot

### For Configurations - [Configuration](#Config) ### Throws - PUBSUB:BAD\_GATEWAY - PUBSUB:CANCELLED - PUBSUB:DEADLINE\_EXCEEDED - PUBSUB:FAILED\_PRECONDITION - PUBSUB:INVALID\_ARGUMENT - PUBSUB:NOT\_FOUND - PUBSUB:PERMISSION\_DENIED - PUBSUB:UNAVAILABLE ## Patch Snapshot `` Updates an existing snapshot. The name and the topic of the snapshot are not mutable fields and cannot be updated. ### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Snapshot

Snapshot object with updated fields (labels or expireTime).

#[payload]

Update Mask

String

Indicates which fields in the provided snapshot to update. Must be specified and non-empty. This is a comma-separated list of fully qualified names of fields.

x

Config Ref

ConfigurationProvider

Name of the configuration used to execute this component.

x

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The outcome of the expression is stored in the Target Variable field.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

### Output

Type

Snapshot

### For Configurations - [Configuration](#Config) ### Throws - PUBSUB:BAD\_GATEWAY - PUBSUB:CANCELLED - PUBSUB:CONNECTIVITY - PUBSUB:DEADLINE\_EXCEEDED - PUBSUB:FAILED\_PRECONDITION - PUBSUB:INVALID\_ARGUMENT - PUBSUB:NOT\_FOUND - PUBSUB:PERMISSION\_DENIED - PUBSUB:RETRY\_EXHAUSTED - PUBSUB:UNAVAILABLE ## Publish Message `` Publishes a single message. This operation is non-blocking. When batching is enabled, the message is stored only locally until any of the batching restrictions are reached. This operation may lead to high throughput. When using the **Ordering Key** field, processing messages in the order they were called is not guaranteed, especially in threaded environments. If you must maintain a strict order, set **Max Concurrency** to `1` in your source flow settings and add a delay in the for-each loops that contain order critical **Publish** calls. This operation returns the `messageId`, which is the unique identifier of the sent message in the topic. ### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Ordering Key

String

If specified, this field identifies related messages in which the publish order must be respected when the subscriber enables message ordering.

Config Ref

ConfigurationProvider

Name of the configuration used to execute this component.

x

Project ID

String

Globally unique identifier for your project.

Topic Name

String

Project-wide unique identifier for the topic.

Message

Binary

Message content published to the topic. If not empty, the message must contain at least one attribute.

Attributes

Object

Attributes for this message. If empty, the message must contain non-empty data. Can be used to filter messages on the subscription.

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The outcome of the expression is stored in the Target Variable field.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

### Output

Type

String

### For Configurations - [Configuration](#Config) ### Throws - PUBSUB:BAD\_GATEWAY - PUBSUB:CANCELLED - PUBSUB:CONNECTIVITY - PUBSUB:DEADLINE\_EXCEEDED - PUBSUB:FAILED\_PRECONDITION - PUBSUB:INVALID\_ARGUMENT - PUBSUB:MAX\_OUTSTANDING\_BATCH\_SIZE\_REACHED - PUBSUB:MAX\_OUTSTANDING\_ELEMENT\_COUNT\_REACHED - PUBSUB:NOT\_FOUND - PUBSUB:PERMISSION\_DENIED - PUBSUB:RETRY\_EXHAUSTED - PUBSUB:UNAVAILABLE ## Seek Messages `` Supports the bulk acknowledging or un-acknowledging of messages to a given snapshot or point of time based on the provided seek target. Seeking to a point in time marks every message received by Pub/Sub before the time as acknowledged, and all messages received after the time as unacknowledged. You can replay and reprocess previously acknowledged messages when seeking to a time in the past or purge messages when seeking to a time in the future. Seeking to a snapshot enables you to redeliver only the messages in the snapshot that match the filter of the subscription making the seek request. Once a snapshot is created, it retains all messages that were unacknowledged in the source subscription at the time of the snapshot’s creation and any messages published to the topic thereafter. You can replay these unacknowledged messages by using a snapshot to seek to any of the topic’s subscriptions. If you seek to a snapshot using a subscription with a filter, the Pub/Sub service redelivers only the messages in the snapshot that match the filter of the subscription making the seek request. ### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Config Ref

ConfigurationProvider

Name of the configuration used to execute this component.

x

Project ID

String

Globally unique identifier for your project.

Subscription Name

String

Project-wide unique identifier for the subscription.

Snapshot Name

String

Snapshot to seek to. The snapshot’s topic must be the same as that of the provided subscription.

Timestamp

DateTime

Specific time to seek to. Messages retained in the subscription that were published before this time are marked as acknowledged, and messages retained in the subscription that were published after this time are marked as unacknowledged.


This operation affects only messages retained in the subscription (configured by the combination of Message Retention Duration and Retain Acked Messages). For example, if the time corresponds to a point before the message retention window (or to a point before the system’s notion of the subscription creation time), only retained messages are marked as unacknowledged, and already-expunged messages are not restored.


A timestamp is in RFC3339 UTC Zulu format, with nanosecond resolution and up to nine fractional digits, such as 2014-10-02T15:01:23Z and 2014-10-02T15:01:23.045123456Z.

Reconnection Strategy

Retry strategy in case of connectivity errors.

### For Configurations - [Configuration](#Config) ### Throws - PUBSUB:BAD\_GATEWAY - PUBSUB:CANCELLED - PUBSUB:CONNECTIVITY - PUBSUB:DEADLINE\_EXCEEDED - PUBSUB:FAILED\_PRECONDITION - PUBSUB:INVALID\_ARGUMENT - PUBSUB:NOT\_FOUND - PUBSUB:PERMISSION\_DENIED - PUBSUB:RETRY\_EXHAUSTED - PUBSUB:UNAVAILABLE ## Sources ## On message listener `` Asynchronous message listener that consumes messages from one subscriber. ### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Consumer count

Number

Provides a specified amount of executor service for processing messages.

5

Config Ref

ConfigurationProvider

Name of the configuration used to execute this component.

x

Primary Node Only

Boolean

Determines whether to execute this source on only the primary node when running Mule instances in a cluster.

On Capacity Overload

Enumeration, one of:

  • WAIT

  • DROP

  • FAIL

Strategy that the runtime applies when the flow receives more messages than it has the capacity to handle.

WAIT

Streaming Strategy

Configures how Mule processes streams. The default is to use repeatable streams.

Redelivery Policy

Defines a policy for processing the redelivery of the same message.

Project ID

String

Globally unique identifier for your project.

Subscription Name

String

Project-wide unique identifier for the subscription.

Limit Exceeded Behavior

Enumeration, one of:

  • THROW_EXCEPTION

  • BLOCK

  • IGNORE

If not set to IGNORE, flow control enables you to control the publishing behavior by specifying limits for Max Outstanding Request Size and Max Outstanding Element Count.

  • THROW_EXCEPTION

    If the memory size or the amount of outstanding elements (messages where no Ack() or Nack() was performed) exceeds the specified limits, the receiver throws a FlowControlException.

  • BLOCK

    If the memory size or the amount of outstanding elements (messages where no Ack() or Nack() was performed) exceeds the specified limits, the receiver does not receive more messages.

  • IGNORE

    The receiver does not account for specified limits and does not control the message delivery rate.

Max Outstanding Request Size

Number

Maximum amount of memory accumulated by the request before enforcing flow control.

100

Max Outstanding Request Size Unit

Enumeration, one of:

  • BYTE

  • KB

  • MB

  • GB

Data unit for the Max Outstanding Request Size field.

MB

Max Outstanding Element Count

Number

Maximum number of outstanding elements to keep in the memory before enforcing flow control.

100

Reconnection Strategy

Retry strategy in case of connectivity errors.

### Output

Type

Any

Attributes Type

Object

### For Configurations - [Configuration](#Config) ## Types ### Reconnection Configures a reconnection strategy for an operation.
FieldTypeDescriptionDefault ValueRequired

Fails Deployment

Boolean

What to do if, when an app is deployed, a connectivity test does not pass after exhausting the associated reconnection strategy:

  • true

    Allow the deployment to fail.

  • false

    Ignore the results of the connectivity test.

Reconnection Strategy

Reconnection strategy to use.

### Reconnect Configures a standard reconnection strategy, which specifies how often to reconnect and how many reconnection attempts the connector source or operation can make.
FieldTypeDescriptionDefault ValueRequired

Frequency

Number

How often to attempt to reconnect, in milliseconds.

Blocking

Boolean

If false, the reconnection strategy will run in a separate, non-blocking thread.

Count

Number

How many reconnection attempts the Mule app can make.

### Reconnect Forever Configures a forever reconnection strategy by which the connector source or operation attempts to reconnect at a specified frequency for as long as the Mule app runs.
FieldTypeDescriptionDefault ValueRequired

Frequency

Number

How often to attempt to reconnect, in milliseconds.

Blocking

Boolean

If false, the reconnection strategy will run in a separate, non-blocking thread.

### Expiration Policy
FieldTypeDescriptionDefault ValueRequired

Max Idle Time

Number

Configures the maximum amount of time that a dynamic configuration instance can remain idle before Mule considers it eligible for expiration.

Time Unit

Enumeration, one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

Time unit for the Max Idle Time field.

### Repeatable In Memory Stream Configures the in-memory streaming strategy by which the request fails if the data exceeds the MAX buffer size. Always run performance tests to find the optimal buffer size for your specific use case.
FieldTypeDescriptionDefault ValueRequired

Initial Buffer Size

Number

Initial amount of memory to allocate to the data stream. If the streamed data exceeds this value, the buffer expands by Buffer Size Increment, with an upper limit of Max In Memory Size value.

Buffer Size Increment

Number

Amount by which the buffer size expands if it exceeds its initial size. Setting a value of 0 or lower specifies that the buffer can’t expand.

Max Buffer Size

Number

Maximum size of the buffer. If the buffer size exceeds this value, Mule raises a STREAM_MAXIMUM_SIZE_EXCEEDED error. A value of less than or equal to 0 means no limit.

Buffer Unit

Enumeration, one of:

  • BYTE

  • KB

  • MB

  • GB

Unit for the Initial Buffer Size, Buffer Size Increment, and Buffer Unit fields.

### Repeatable File Store Stream Configures the repeatable file-store streaming strategy by which Mule keeps a portion of the stream content in memory. If the stream content is larger than the configured buffer size, Mule backs up the buffer’s content to disk and then clears the memory.
FieldTypeDescriptionDefault ValueRequired

In Memory Size

Number

Maximum amount of memory that the stream can use for data. If the amount of memory exceeds this value, Mule buffers the content to disk. To optimize performance:

  • Configure a larger buffer size to avoid the number of times Mule needs to write the buffer on disk. This increases performance, but it also limits the number of concurrent requests your application can process, because it requires additional memory.

  • Configure a smaller buffer size to decrease memory load at the expense of response time.

Buffer Unit

Enumeration, one of:

  • BYTE

  • KB

  • MB

  • GB

Unit for the In Memory Size field.

### Redelivery Policy Configures the redelivery policy for executing requests that generate errors. You can add a redelivery policy to any source in a flow.
FieldTypeDescriptionDefault ValueRequired

Max Redelivery Count

Number

Maximum number of times that a redelivered request can be processed unsuccessfully before returning a REDELIVERY_EXHAUSTED error.

Message Digest Algorithm

String

Secure hashing algorithm to use if the Use Secure Hash field is true. If the payload of the message is a Java object, Mule ignores this value and returns the value that the payload’s hashCode() returned.

Message Identifier

Defines which strategy is used to identify the messages.

Object Store

ObjectStore

Configures the object store that stores the redelivery counter for each message.

### Redelivery Policy Message Identifier Configures how to identify a redelivered message and how to find out when the message was redelivered.
FieldTypeDescriptionDefault ValueRequired

Use Secure Hash

Boolean

If true, Mule uses a secure hash algorithm to identify a redelivered message.

Id Expression

String

One or more expressions that determine when a message was redelivered. You can set this property only if the Use Secure Hash field is false.

### Snapshot Snapshot resource. You can use snapshots in seek operations, which manage message acknowledgments in bulk. This type enables you to set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot.
FieldTypeDescriptionDefault ValueRequired

Name

String

Name of the snapshot.

Topic

String

Name of the topic from which the snapshot retains messages.

Expire Time

DateTime

Time length for which the snapshot is guaranteed to exist. The lifetime for a newly-created snapshot is based on the oldest unacked message in the source subscription’s backlog, however, the snapshot can exist for a maximum of seven days.


Consider a subscription with an oldest unacked message that is three days old. If a snapshot is created from this subscription, the snapshot will expire in four days. The service will refuse to create a snapshot that will expire in less than one hour after creation.


A timestamp is in RFC3339 UTC Zulu format, with nanosecond resolution and up to nine fractional digits, such as 2014-10-02T15:01:23Z and 2014-10-02T15:01:23.045123456Z.

Labels

Any

Object containing a list of key-value pairs, such as { "name": "wrench", "mass": "1.3kg", "count": "3" }.

### Repeatable In Memory Iterable
FieldTypeDescriptionDefault ValueRequired

Initial Buffer Size

Number

The number of instances to initially keep in memory to consume the stream and provide random access to it. If the stream contains more data than can fit into this buffer, then the buffer expands according to the Buffer Size Increment field, with an upper limit of Max In Memory Size.

100

Buffer Size Increment

Number

This is by how much the buffer size expands if it exceeds its initial size. Setting a value of zero or lower means that the buffer should not expand, meaning that a STREAM_MAXIMUM_SIZE_EXCEEDED error is raised when the buffer gets full.

100

Max Buffer Size

Number

The maximum amount of memory to use. If more than that is used then a STREAM_MAXIMUM_SIZE_EXCEEDED error is raised. A value lower than or equal to zero means no limit.

### Repeatable File Store Iterable
FieldTypeDescriptionDefault ValueRequired

In Memory Objects

Number

The maximum amount of instances to keep in memory. If more than that is required, content on the disk is buffered.

Buffer Unit

Enumeration, one of:

  • BYTE

  • KB

  • MB

  • GB

Unit for the In Memory Objects field.

## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Salesforce Help](https://help.salesforce.com) --- product: Google Pub/Sub Connector version: 1.0 --- # Google Pub/Sub Connector 1.0 XML and Maven Support > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Although you can manually code a Mule app in XML, it is more efficient to use Anypoint Studio: - If you manually code a Mule runtime engine (Mule) app in XML, either from the Anypoint Studio XML editor or from a text editor, you can access the connector from your app by adding reference statements to both your XML Mule flow and the Apache Maven `pom.xml` file. - If you add the connector in Studio, Studio automatically populates the XML code with the connector’s namespace and schema location and it also adds a dependency to the `pom.xml` file. ## Add a Namespace for the Connector Paste the following code inside the `` tag of the header of your configuration XML: ```xml http://www.mulesoft.org/schema/mule/google-pubsub http://www.mulesoft.org/schema/mule/google-pubsub/current/mule-google-pubsub.xsd ``` This example shows how the namespace statements are placed in the XML block: ```xml ``` ## Add a POM File Dependency The Apache Maven `pom.xml` file generated by Anypoint Studio contains dependencies for a Mule app. When you code a Mule app manually, include this XML snippet in your `pom.xml` file to enable access to this connector: ```xml com.mulesoft.connectors mule4-google-pubsub-connector x.x.x mule-plugin ``` Replace `x.x.x` with the version that corresponds to the connector you are using. To obtain the most up-to-date `pom.xml` file information: 1. Go to [Anypoint Exchange](https://www.mulesoft.com/exchange/). 2. In Exchange, click **Login** and supply your Anypoint Platform username and password. 3. In Exchange, search for `google-pubsub`. 4. Select the connector. 5. Click **Dependency Snippets** near the upper right of the screen. ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Salesforce Help](https://help.salesforce.com) --- product: Google Pub/Sub Connector version: 1.1 --- # Google Pub/Sub Connector 1.1 > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Anypoint Connector for Google Pub/Sub (Google Pub/Sub Connector) enables you to access the Google Pub/Sub messaging platform. This connector exposes operations provided by the Google Pub/Sub client libraries. For compatibility information and fixed issues, refer to the Google Pub/Sub Connector Release Notes. ## Before You Begin To use this connector, you must be familiar with: - The Google Pub/Sub API - Anypoint Connectors - Mule runtime engine (Mule) - Elements and global elements in a Mule flow - Creating a Mule app using Anypoint Studio or Anypoint Code Builder Before creating an app, you must have: - Credentials to access the target resource - Anypoint Studio or Anypoint Code Builder ## Common Use Cases for the Connector Some common use cases for Google Pub/Sub Connector include: - Publishing messages - Listening to messages - Managing snapshots - Replaying messages ## Authentication Types Google Pub/Sub Connector uses the PubSub Connection authentication method, in which you create a service account and obtain credentials. For more information, refer to [Google Cloud Service Accounts](https://docs.cloud.google.com/iam/docs/service-account-overview). ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Use Exchange to Discover Connectors, Templates, and Examples](https://docs.mulesoft.com/connectors/introduction/intro-use-exchange) - [Google Pub/Sub Connector Reference](https://docs.mulesoft.com/google-pubsub-connector/1.1/google-pubsub-connector-reference) - [Salesforce Help](https://help.salesforce.com) --- product: Google Pub/Sub Connector version: 1.1 --- # Google Pub/Sub Connector 1.1 Examples > For the full documentation index, see: https://docs.mulesoft.com/llms.txt These examples show you how to use Google Pub/Sub Connector to perform the following actions: - [Create a snapshot](#create-snapshot) - [Patch a snapshot](#patch-snapshot) - [Get a snapshot](#get-snapshot) - [Delete a snapshot](#delete-snapshot) - [Publish a message](#publish-message) ## Configure a PubSub Connection Because this connector uses PubSub to secure connections, you must specify the PubSub Connection field values. To do this: - [Create a configuration file for a PubSub Connection.](#create-config-file) - [Configure the PubSub Connection global elements.](#configure-pubsub-global) - [Configure a global element for the properties file.](#configure-global) ### Create a Configuration File for a PubSub Connection Create a configuration file that includes properties for a PubSub Connection: 1. Create a file named `mule-app.properties` in the `/src/main/resources/` folder. 2. In the `mule-app.properties` file, create a set of properties for `PubSub Connection`, similar to the ones that follow, replacing the bracketed text (including the brackets) with the correct values for your configuration: config.private\_key\_id= config.private\_key= config.client\_id= config.client\_email= config.default\_project\_id= For more information about creating a properties file, refer to [Configuring Property Placeholders](https://docs.mulesoft.com/mule-runtime/latest/mule-app-properties-to-configure). ### Configure the PubSub Connection Global Elements Configure global elements for the `PubSub Connection` file: 1. Create a new Mule project. 2. In the **Mule Palette** view, click **Search in Exchange** and enter `google pubsub`. 3. Add **Google Pub/Sub Connector** to the **Selected modules** section and click **Finish**. 4. Click the **Global Elements** tab and click **Create**. 5. Select **Connector Configuration > Google PubSub Configuration** and click **OK**. 6. Enter the following values:
FieldValue

Name

Google_Pub_Sub_Configuration

Private key id

${config.private_key_id}

Private key

${config.private_key}

Client id

${config.client_id}

Client email

${config.client_email}

Default Project Id

${config.default_project_id}

Default Subscription Name

orders-subscription

Default Topic Name

orders-topic

7. Click **OK**. ### Configure a Global Element for the Properties File Configure a global element for the `mule-app.properties` file so that Mule knows where to find it: 1. Click the **Global Elements** tab and click **Create**. 2. In the **Choose Global Type** dialog, select **Configuration properties** and click **OK**. 3. In the **File** field, enter `mule.app.properties`. 4. Click **OK**. ## Create a Snapshot This Mule flow creates a snapshot from the requested subscription. This example uses the following operations: - **HTTP Listener** Accepts data from HTTP requests - **Create snapshot** Creates a snapshot - **Logger** Shows the HTTP response from the **Create snapshot** operation - **Transform Message** Outputs the results of the **Create snapshot** operation in JSON format ![Studio Flow for the Create Snapshot Operation](/mulesoft/current/en-us/google-pubsub-connector/1.1/_images/create-snapshot-flow.png) ### XML for This Example Paste this code into the Studio XML editor to quickly load the flow for this example into your Mule app: ```xml ``` ### Steps for Running This Example 1. Verify that your connector is configured. 2. Save the project. 3. From a web browser, test the application by entering `[http://localhost:8081/](http://localhost:8081/)`. You should see the **Create Snapshot** form with pre-populated **Snapshot Name** and **Subscription Name** fields. ![Create Snapshot Form](/mulesoft/current/en-us/google-pubsub-connector/1.1/_images/create-snapshot.png) 4. Click **Create Snapshot**. You should see an alert that the snapshot was successfully created. ## Patch a Snapshot This Mule flow updates an existing snapshot. This example uses the following operations: - **HTTP Listener** Accepts data from HTTP requests - **Patch snapshot** Updates a snapshot - **Transform Message** Outputs the results of the **Patch snapshot** operation in JSON format - **Logger** Shows the HTTP response from the **Patch snapshot** operation ![Studio Flow for the Patch Snapshot Operation](/mulesoft/current/en-us/google-pubsub-connector/1.1/_images/patch-snapshot-flow.png) ### XML for This Example Paste this code into the Studio XML editor to quickly load the flow for this example into your Mule app: ```xml >/snapshots/<>", "topic": "projects/<>/topic/<>" "expireTime": "2099-01-01T00:00:00Z", "labels": { "label1": "test-patch-snapshot" } }]]]> ``` ## Get a Snapshot This Mule flow retrieves an existing snapshot. This example uses the following operations: - **HTTP Listener** Accepts data from HTTP requests - **Get snapshot** Retrieves a snapshot - **Logger** Shows the HTTP response from the **Get snapshot** operation - **Transform Message** Outputs the results of the **Get snapshot** operation in JSON format ![Studio Flow for the Get Snapshot Operation](/mulesoft/current/en-us/google-pubsub-connector/1.1/_images/get-snapshot-flow.png) ### XML for This Example Paste this code into the Studio XML editor to quickly load the flow for this example into your Mule app: ```xml ``` ### Steps for Running This Example 1. Verify that your connector is configured. 2. Save the project. 3. From a web browser, test the application by entering `[http://localhost:8081/](http://localhost:8081/)`. You should see the **Get Snapshot** form with a pre-populated **Snapshot Name** field. ![Get Snapshot Form](/mulesoft/current/en-us/google-pubsub-connector/1.1/_images/get-snapshot.png) 4. Click **Get Snapshot**. You should see an alert that the snapshot was successfully retrieved. ## Delete a Snapshot This Mule flow deletes an existing snapshot. This example uses the following operations: - **HTTP Listener** Accepts data from HTTP requests - **Delete snapshot** Deletes a snapshot ![Studio Flow for the Delete Snapshot Operation](/mulesoft/current/en-us/google-pubsub-connector/1.1/_images/delete-snapshot-flow.png) ### XML for This Example Paste this code into the Studio XML editor to quickly load the flow for this example into your Mule app: ```xml ``` ### Steps for Running This Example 1. Verify that your connector is configured. 2. Save the project. 3. From a web browser, test the application by entering `[http://localhost:8081/](http://localhost:8081/)`. You should see the **Delete Snapshot** form with a pre-populated **Snapshot Name** field. ![Delete Snapshot Form](/mulesoft/current/en-us/google-pubsub-connector/1.1/_images/delete-snapshot.png) 4. Click **Delete Snapshot**. You should see an alert that the snapshot was successfully deleted. ## Publish a Message This Mule flow publishes a single message to a selected topic. This example uses the following operations: - **HTTP Listener** Accepts data from HTTP requests - **Publish Message** Publishes a message ![Studio Flow for the Publish Message Operation](/mulesoft/current/en-us/google-pubsub-connector/1.1/_images/publish-message-flow.png) ### XML for This Example Paste this code into the Studio XML editor to quickly load the flow for this example into your Mule app: ```xml ``` ### Steps for Running This Example 1. Verify that your connector is configured. 2. Save the project. 3. From a web browser, test the application by entering `[http://localhost:8081/](http://localhost:8081/)`. You should see the **Publish Message** form with pre-populated **Topic Name**, **Ordering Key**, and **Message** fields. ![Publish Message form](/mulesoft/current/en-us/google-pubsub-connector/1.1/_images/publish-message.png) 4. Click **Publish Message**. You should see an alert that the snapshot was successfully published. ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Salesforce Help](https://help.salesforce.com) --- product: Google Pub/Sub Connector version: 1.1 --- # Google Pub/Sub Connector 1.1 Reference > For the full documentation index, see: https://docs.mulesoft.com/llms.txt ## Configurations --- ### Configuration #### Parameters
NameTypeDescriptionDefault ValueRequired

Name

String

Name for this configuration. Connectors reference the configuration with this name.

x

Connection

Connection types for this configuration.

x

Default Project Id

String

Globally unique identifier for your project. Used in operations. It can be overridden at the config level.

Default Subscription Name

String

Default subscription for your project. Used in operations. It can be overridden at the config level.

Default Topic Name

String

Default topic for your project. Used in operations. It can be overridden at the config level.

Name

String

ID used to reference this configuration.

x

Expiration Policy

Configures the minimum amount of time that a dynamic configuration instance can remain idle before Mule considers it eligible for expiration.

#### Connection Types ##### PubSub Connection ###### Parameters
NameTypeDescriptionDefault ValueRequired

Private key ID

String

ID of the private key for the service account. It is a part of the service-credentials created in PubSub.

x

Client ID

String

ID of the client for the service account. It is a part of the service-credentials created in PubSub.

x

Client email

String

Client email for the service account. It is a part of the service-credentials created in PubSub.

x

Private key

String

Private key for the service account. It is a part of the service-credentials created in PubSub.

x

Message Count Batch Size

Number

Maximum number of messages in the batch. After the maximum number of messages is reached, the elements are wrapped up in a batch and sent.

10

Request Size Threshold

Number

Maximum memory size of the messages in the batch. After the maximum memory size is reached, the elements are wrapped up in a batch and sent.

1

Request Size Threshold Unit

Enumeration, one of:

  • BYTE

  • KB

  • MB

  • GB

Data unit for the Request Size Threshold field.

KB

Publish Delay Threshold

Number

Maximum delay threshold to use for batching. After the maximum amount of time has elapsed (counting from the first element added), the elements are wrapped up in a batch and sent. This value must not be set too high, especially for the MILLISECONDS time unit. Otherwise, calls might appear to never complete.

10

Publish Delay Threshold Time Unit

Enumeration, one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

Time unit for the Publish Delay Threshold field.

MILLISECONDS

Enable batching

Boolean

Flag for enabling or disabling publish request batching.

false

Limit Exceeded Behavior

Enumeration, one of:

  • THROW_EXCEPTION

  • BLOCK

  • IGNORE

If not set to IGNORE, flow control enables you to control the publishing behavior by specifying limits for Max Outstanding Request Size and Max Outstanding Element Count.

  • THROW_EXCEPTION

    If the memory size or the amount of outstanding elements (messages where no Ack() or Nack() was performed) exceeds the specified limits, the publisher throws a FlowControlException.

  • BLOCK

    If the memory size or the amount of outstanding elements (messages where no Ack() or Nack() was performed) exceeds the specified limits, the publisher does not publish more messages.

  • IGNORE

    The publisher does not account for specified limits and does not control the message publishing rate.

Max Outstanding Request Size

Number

Maximum amount of memory accumulated by the request before enforcing flow control.

100

Max Outstanding Request Size Unit

Enumeration, one of:

  • BYTE

  • KB

  • MB

  • GB

Data unit for the Max Outstanding Request Size field.

MB

Max Outstanding Element Count

Number

Maximum number of outstanding elements to keep in memory before enforcing flow control.

100

Reconnection

Configures a reconnection strategy to use when a connector operation fails to connect to an external server.

## Supported Operations - [Create Snapshot](#CreateSnapshot) - [Delete Snapshot](#DeleteSnapshot) - [Get Snapshot](#GetSnapshot) - [Get Snapshot List](#GetSnapshotList) - [Patch Snapshot](#PatchSnapshot) - [Publish Message](#PublishMessage) - [Seek Messages](#SeekMessages) ## Associated Sources - [On message listener](#MessageListener) ## Operations ## Create Snapshot `` Creates a snapshot from the requested subscription. Use snapshots in seek operations, which manage message acknowledgments in bulk. This operation enables you to set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot. ### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Snapshot Name

String

Project-wide unique identifier for a snapshot.

x

Labels

Object

Key-value pairs that help users to organize Google Cloud resources. Attaching labels to resources filters them based on the labels.

Config Ref

ConfigurationProvider

Name of the configuration used to execute this component.

x

Project ID

String

Globally unique identifier for your project.

Subscription Name

String

Project-wide unique identifier for the subscription.

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The outcome of the expression is stored in the Target Variable field.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

### Output

Type

Snapshot

### For Configurations - [Configuration](#Config) ### Throws - PUBSUB:ALREADY\_EXISTS - PUBSUB:BAD\_GATEWAY - PUBSUB:CANCELLED - PUBSUB:CONNECTIVITY - PUBSUB:DEADLINE\_EXCEEDED - PUBSUB:FAILED\_PRECONDITION - PUBSUB:INVALID\_ARGUMENT - PUBSUB:NOT\_FOUND - PUBSUB:PERMISSION\_DENIED - PUBSUB:RETRY\_EXHAUSTED - PUBSUB:UNAVAILABLE ## Delete Snapshot `` Deletes an existing snapshot. ### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Config Ref

ConfigurationProvider

Name of the configuration used to execute this component.

x

Project ID

String

Globally unique identifier for your project.

Snapshot Name

String

Project-wide unique identifier for a snapshot.

x

Reconnection Strategy

Retry strategy in case of connectivity errors.

### For Configurations - [Configuration](#Config) ### Throws - PUBSUB:BAD\_GATEWAY - PUBSUB:CANCELLED - PUBSUB:CONNECTIVITY - PUBSUB:DEADLINE\_EXCEEDED - PUBSUB:FAILED\_PRECONDITION - PUBSUB:INVALID\_ARGUMENT - PUBSUB:NOT\_FOUND - PUBSUB:PERMISSION\_DENIED - PUBSUB:RETRY\_EXHAUSTED - PUBSUB:UNAVAILABLE ## Get Snapshot `` Retrieves a snapshot. ### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Config Ref

ConfigurationProvider

Name of the configuration used to execute this component.

x

Project ID

String

Globally unique identifier for your project.

Snapshot Name

String

Project-wide unique identifier for a snapshot.

x

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The outcome of the expression is stored in the Target Variable field.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

### Output

Type

Snapshot

### For Configurations - [Configuration](#Config) ### Throws - PUBSUB:BAD\_GATEWAY - PUBSUB:CANCELLED - PUBSUB:CONNECTIVITY - PUBSUB:DEADLINE\_EXCEEDED - PUBSUB:FAILED\_PRECONDITION - PUBSUB:INVALID\_ARGUMENT - PUBSUB:NOT\_FOUND - PUBSUB:PERMISSION\_DENIED - PUBSUB:RETRY\_EXHAUSTED - PUBSUB:UNAVAILABLE ## Get Snapshot List `` Retrieves a list of existing snapshots from a selected project. ### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Project Id

String

Globally unique identifier for your project.

Config Ref

ConfigurationProvider

Name of the configuration used to execute this component.

x

Streaming Strategy

Configures how Mule processes streams. The default is to use repeatable streams.

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The outcome of the expression is stored in the Target Variable field.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

### Output

Type

Array of Snapshot

### For Configurations - [Configuration](#Config) ### Throws - PUBSUB:BAD\_GATEWAY - PUBSUB:CANCELLED - PUBSUB:DEADLINE\_EXCEEDED - PUBSUB:FAILED\_PRECONDITION - PUBSUB:INVALID\_ARGUMENT - PUBSUB:NOT\_FOUND - PUBSUB:PERMISSION\_DENIED - PUBSUB:UNAVAILABLE ## Patch Snapshot `` Updates an existing snapshot. The name and the topic of the snapshot are not mutable fields and cannot be updated. ### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Snapshot

Snapshot object with updated fields (labels or expireTime).

#[payload]

Update Mask

String

Indicates which fields in the provided snapshot to update. Must be specified and non-empty. This is a comma-separated list of fully qualified names of fields.

x

Config Ref

ConfigurationProvider

Name of the configuration used to execute this component.

x

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The outcome of the expression is stored in the Target Variable field.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

### Output

Type

Snapshot

### For Configurations - [Configuration](#Config) ### Throws - PUBSUB:BAD\_GATEWAY - PUBSUB:CANCELLED - PUBSUB:CONNECTIVITY - PUBSUB:DEADLINE\_EXCEEDED - PUBSUB:FAILED\_PRECONDITION - PUBSUB:INVALID\_ARGUMENT - PUBSUB:NOT\_FOUND - PUBSUB:PERMISSION\_DENIED - PUBSUB:RETRY\_EXHAUSTED - PUBSUB:UNAVAILABLE ## Publish Message `` Publishes a single message. This operation is non-blocking. When batching is enabled, the message is stored only locally until any of the batching restrictions are reached. This operation may lead to high throughput. When using the **Ordering Key** field, processing messages in the order they were called is not guaranteed, especially in threaded environments. If you must maintain a strict order, set **Max Concurrency** to `1` in your source flow settings and add a delay in the for-each loops that contain order critical **Publish** calls. This operation returns the `messageId`, which is the unique identifier of the sent message in the topic. ### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Ordering Key

String

If specified, this field identifies related messages in which the publish order must be respected when the subscriber enables message ordering.

Config Ref

ConfigurationProvider

Name of the configuration used to execute this component.

x

Project ID

String

Globally unique identifier for your project.

Topic Name

String

Project-wide unique identifier for the topic.

Message

Binary

Message content published to the topic. If not empty, the message must contain at least one attribute.

Attributes

Object

Attributes for this message. If empty, the message must contain non-empty data. Can be used to filter messages on the subscription.

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The outcome of the expression is stored in the Target Variable field.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

### Output

Type

String

### For Configurations - [Configuration](#Config) ### Throws - PUBSUB:BAD\_GATEWAY - PUBSUB:CANCELLED - PUBSUB:CONNECTIVITY - PUBSUB:DEADLINE\_EXCEEDED - PUBSUB:FAILED\_PRECONDITION - PUBSUB:INVALID\_ARGUMENT - PUBSUB:MAX\_OUTSTANDING\_BATCH\_SIZE\_REACHED - PUBSUB:MAX\_OUTSTANDING\_ELEMENT\_COUNT\_REACHED - PUBSUB:NOT\_FOUND - PUBSUB:PERMISSION\_DENIED - PUBSUB:RETRY\_EXHAUSTED - PUBSUB:UNAVAILABLE ## Seek Messages `` Supports the bulk acknowledging or un-acknowledging of messages to a given snapshot or point of time based on the provided seek target. Seeking to a point in time marks every message received by Pub/Sub before the time as acknowledged, and all messages received after the time as unacknowledged. You can replay and reprocess previously acknowledged messages when seeking to a time in the past or purge messages when seeking to a time in the future. Seeking to a snapshot enables you to redeliver only the messages in the snapshot that match the filter of the subscription making the seek request. Once a snapshot is created, it retains all messages that were unacknowledged in the source subscription at the time of the snapshot’s creation and any messages published to the topic thereafter. You can replay these unacknowledged messages by using a snapshot to seek to any of the topic’s subscriptions. If you seek to a snapshot using a subscription with a filter, the Pub/Sub service redelivers only the messages in the snapshot that match the filter of the subscription making the seek request. ### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Config Ref

ConfigurationProvider

Name of the configuration used to execute this component.

x

Project ID

String

Globally unique identifier for your project.

Subscription Name

String

Project-wide unique identifier for the subscription.

Snapshot Name

String

Snapshot to seek to. The snapshot’s topic must be the same as that of the provided subscription.

Timestamp

DateTime

Specific time to seek to. Messages retained in the subscription that were published before this time are marked as acknowledged, and messages retained in the subscription that were published after this time are marked as unacknowledged.


This operation affects only messages retained in the subscription (configured by the combination of Message Retention Duration and Retain Acked Messages). For example, if the time corresponds to a point before the message retention window (or to a point before the system’s notion of the subscription creation time), only retained messages are marked as unacknowledged, and already-expunged messages are not restored.


A timestamp is in RFC3339 UTC Zulu format, with nanosecond resolution and up to nine fractional digits, such as 2014-10-02T15:01:23Z and 2014-10-02T15:01:23.045123456Z.

Reconnection Strategy

Retry strategy in case of connectivity errors.

### For Configurations - [Configuration](#Config) ### Throws - PUBSUB:BAD\_GATEWAY - PUBSUB:CANCELLED - PUBSUB:CONNECTIVITY - PUBSUB:DEADLINE\_EXCEEDED - PUBSUB:FAILED\_PRECONDITION - PUBSUB:INVALID\_ARGUMENT - PUBSUB:NOT\_FOUND - PUBSUB:PERMISSION\_DENIED - PUBSUB:RETRY\_EXHAUSTED - PUBSUB:UNAVAILABLE ## Sources ## On message listener `` Asynchronous message listener that consumes messages from one subscriber. ### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Consumer count

Number

Provides a specified amount of executor service for processing messages.

5

Config Ref

ConfigurationProvider

Name of the configuration used to execute this component.

x

Primary Node Only

Boolean

Determines whether to execute this source on only the primary node when running Mule instances in a cluster.

On Capacity Overload

Enumeration, one of:

  • WAIT

  • DROP

  • FAIL

Strategy that the runtime applies when the flow receives more messages than it has the capacity to handle.

WAIT

Streaming Strategy

Configures how Mule processes streams. The default is to use repeatable streams.

Redelivery Policy

Defines a policy for processing the redelivery of the same message.

Project ID

String

Globally unique identifier for your project.

Subscription Name

String

Project-wide unique identifier for the subscription.

Limit Exceeded Behavior

Enumeration, one of:

  • THROW_EXCEPTION

  • BLOCK

  • IGNORE

If not set to IGNORE, flow control enables you to control the publishing behavior by specifying limits for Max Outstanding Request Size and Max Outstanding Element Count.

  • THROW_EXCEPTION

    If the memory size or the amount of outstanding elements (messages where no Ack() or Nack() was performed) exceeds the specified limits, the receiver throws a FlowControlException.

  • BLOCK

    If the memory size or the amount of outstanding elements (messages where no Ack() or Nack() was performed) exceeds the specified limits, the receiver does not receive more messages.

  • IGNORE

    The receiver does not account for specified limits and does not control the message delivery rate.

Max Outstanding Request Size

Number

Maximum amount of memory accumulated by the request before enforcing flow control.

100

Max Outstanding Request Size Unit

Enumeration, one of:

  • BYTE

  • KB

  • MB

  • GB

Data unit for the Max Outstanding Request Size field.

MB

Max Outstanding Element Count

Number

Maximum number of outstanding elements to keep in the memory before enforcing flow control.

100

Reconnection Strategy

Retry strategy in case of connectivity errors.

### Output

Type

Any

Attributes Type

Object

### For Configurations - [Configuration](#Config) ## Types ### Reconnection Configures a reconnection strategy for an operation.
FieldTypeDescriptionDefault ValueRequired

Fails Deployment

Boolean

What to do if, when an app is deployed, a connectivity test does not pass after exhausting the associated reconnection strategy:

  • true

    Allow the deployment to fail.

  • false

    Ignore the results of the connectivity test.

Reconnection Strategy

Reconnection strategy to use.

### Reconnect Configures a standard reconnection strategy, which specifies how often to reconnect and how many reconnection attempts the connector source or operation can make.
FieldTypeDescriptionDefault ValueRequired

Frequency

Number

How often to attempt to reconnect, in milliseconds.

Blocking

Boolean

If false, the reconnection strategy will run in a separate, non-blocking thread.

Count

Number

How many reconnection attempts the Mule app can make.

### Reconnect Forever Configures a forever reconnection strategy by which the connector source or operation attempts to reconnect at a specified frequency for as long as the Mule app runs.
FieldTypeDescriptionDefault ValueRequired

Frequency

Number

How often to attempt to reconnect, in milliseconds.

Blocking

Boolean

If false, the reconnection strategy will run in a separate, non-blocking thread.

### Expiration Policy
FieldTypeDescriptionDefault ValueRequired

Max Idle Time

Number

Configures the maximum amount of time that a dynamic configuration instance can remain idle before Mule considers it eligible for expiration.

Time Unit

Enumeration, one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

Time unit for the Max Idle Time field.

### Repeatable In Memory Stream Configures the in-memory streaming strategy by which the request fails if the data exceeds the MAX buffer size. Always run performance tests to find the optimal buffer size for your specific use case.
FieldTypeDescriptionDefault ValueRequired

Initial Buffer Size

Number

Initial amount of memory to allocate to the data stream. If the streamed data exceeds this value, the buffer expands by Buffer Size Increment, with an upper limit of Max In Memory Size value.

Buffer Size Increment

Number

Amount by which the buffer size expands if it exceeds its initial size. Setting a value of 0 or lower specifies that the buffer can’t expand.

Max Buffer Size

Number

Maximum size of the buffer. If the buffer size exceeds this value, Mule raises a STREAM_MAXIMUM_SIZE_EXCEEDED error. A value of less than or equal to 0 means no limit.

Buffer Unit

Enumeration, one of:

  • BYTE

  • KB

  • MB

  • GB

Unit for the Initial Buffer Size, Buffer Size Increment, and Buffer Unit fields.

### Repeatable File Store Stream Configures the repeatable file-store streaming strategy by which Mule keeps a portion of the stream content in memory. If the stream content is larger than the configured buffer size, Mule backs up the buffer’s content to disk and then clears the memory.
FieldTypeDescriptionDefault ValueRequired

In Memory Size

Number

Maximum amount of memory that the stream can use for data. If the amount of memory exceeds this value, Mule buffers the content to disk. To optimize performance:

  • Configure a larger buffer size to avoid the number of times Mule needs to write the buffer on disk. This increases performance, but it also limits the number of concurrent requests your application can process, because it requires additional memory.

  • Configure a smaller buffer size to decrease memory load at the expense of response time.

Buffer Unit

Enumeration, one of:

  • BYTE

  • KB

  • MB

  • GB

Unit for the In Memory Size field.

### Redelivery Policy Configures the redelivery policy for executing requests that generate errors. You can add a redelivery policy to any source in a flow.
FieldTypeDescriptionDefault ValueRequired

Max Redelivery Count

Number

Maximum number of times that a redelivered request can be processed unsuccessfully before returning a REDELIVERY_EXHAUSTED error.

Message Digest Algorithm

String

Secure hashing algorithm to use if the Use Secure Hash field is true. If the payload of the message is a Java object, Mule ignores this value and returns the value that the payload’s hashCode() returned.

Message Identifier

Defines which strategy is used to identify the messages.

Object Store

ObjectStore

Configures the object store that stores the redelivery counter for each message.

### Redelivery Policy Message Identifier Configures how to identify a redelivered message and how to find out when the message was redelivered.
FieldTypeDescriptionDefault ValueRequired

Use Secure Hash

Boolean

If true, Mule uses a secure hash algorithm to identify a redelivered message.

Id Expression

String

One or more expressions that determine when a message was redelivered. You can set this property only if the Use Secure Hash field is false.

### Snapshot Snapshot resource. You can use snapshots in seek operations, which manage message acknowledgments in bulk. This type enables you to set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot.
FieldTypeDescriptionDefault ValueRequired

Expire Time

DateTime

Time length for which the snapshot is guaranteed to exist. The lifetime for a newly-created snapshot is based on the oldest unacked message in the source subscription’s backlog, however, the snapshot can exist for a maximum of seven days.


Consider a subscription with an oldest unacked message that is three days old. If a snapshot is created from this subscription, the snapshot will expire in four days. The service will refuse to create a snapshot that will expire in less than one hour after creation.


A timestamp is in RFC3339 UTC Zulu format, with nanosecond resolution and up to nine fractional digits, such as 2014-10-02T15:01:23Z and 2014-10-02T15:01:23.045123456Z.

Labels

Any

Object containing a list of key-value pairs, such as { "name": "wrench", "mass": "1.3kg", "count": "3" }.

Name

String

Name of the snapshot.

Topic

String

Name of the topic from which the snapshot retains messages.

### Repeatable In Memory Iterable
FieldTypeDescriptionDefault ValueRequired

Initial Buffer Size

Number

The number of instances to initially keep in memory to consume the stream and provide random access to it. If the stream contains more data than can fit into this buffer, then the buffer expands according to the Buffer Size Increment field, with an upper limit of Max In Memory Size.

100

Buffer Size Increment

Number

This is by how much the buffer size expands if it exceeds its initial size. Setting a value of zero or lower means that the buffer should not expand, meaning that a STREAM_MAXIMUM_SIZE_EXCEEDED error is raised when the buffer gets full.

100

Max Buffer Size

Number

The maximum amount of memory to use. If more than that is used then a STREAM_MAXIMUM_SIZE_EXCEEDED error is raised. A value lower than or equal to zero means no limit.

### Repeatable File Store Iterable
FieldTypeDescriptionDefault ValueRequired

In Memory Objects

Number

The maximum amount of instances to keep in memory. If more than that is required, content on the disk is buffered.

Buffer Unit

Enumeration, one of:

  • BYTE

  • KB

  • MB

  • GB

Unit for the In Memory Objects field.

## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Salesforce Help](https://help.salesforce.com) --- product: Google Pub/Sub Connector version: 1.1 --- # Google Pub/Sub Connector 1.1 XML and Maven Support > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Although you can manually code a Mule app in XML, it is more efficient to use Anypoint Studio: - If you manually code a Mule runtime engine (Mule) app in XML, either from the Anypoint Studio XML editor or from a text editor, you can access the connector from your app by adding reference statements to both your XML Mule flow and the Apache Maven `pom.xml` file. - If you add the connector in Studio, Studio automatically populates the XML code with the connector’s namespace and schema location and it also adds a dependency to the `pom.xml` file. ## Add a Namespace for the Connector Paste the following code inside the `` tag of the header of your configuration XML: ```xml http://www.mulesoft.org/schema/mule/google-pubsub http://www.mulesoft.org/schema/mule/google-pubsub/current/mule-google-pubsub.xsd ``` This example shows how the namespace statements are placed in the XML block: ```xml ``` ## Add a POM File Dependency The Apache Maven `pom.xml` file generated by Anypoint Studio contains dependencies for a Mule app. When you code a Mule app manually, include this XML snippet in your `pom.xml` file to enable access to this connector: ```xml com.mulesoft.connectors mule4-google-pubsub-connector x.x.x mule-plugin ``` Replace `x.x.x` with the version that corresponds to the connector you are using. To obtain the most up-to-date `pom.xml` file information: 1. Go to [Anypoint Exchange](https://www.mulesoft.com/exchange/). 2. In Exchange, click **Login** and supply your Anypoint Platform username and password. 3. In Exchange, search for `google-pubsub`. 4. Select the connector. 5. Click **Dependency Snippets** near the upper right of the screen. ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Salesforce Help](https://help.salesforce.com) --- product: Google Pub/Sub Connector version: 1.2 --- # Google Pub/Sub Connector 1.2 > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Anypoint Connector for Google Pub/Sub (Google Pub/Sub Connector) enables you to access the Google Pub/Sub messaging platform. This connector exposes operations provided by the Google Pub/Sub client libraries. For compatibility information and fixed issues, refer to the Google Pub/Sub Connector Release Notes. ## Before You Begin To use this connector, you must be familiar with: - The Google Pub/Sub API - Anypoint Connectors - Mule runtime engine (Mule) - Elements and global elements in a Mule flow - Creating a Mule app using Anypoint Studio or Anypoint Code Builder Before creating an app, you must have: - Credentials to access the target resource - Anypoint Studio or Anypoint Code Builder ## Common Use Cases for the Connector Some common use cases for Google Pub/Sub Connector include: - Publishing messages - Listening to messages - Managing snapshots - Replaying messages ## Authentication Types Google Pub/Sub Connector uses the PubSub Connection authentication method, in which you create a service account and obtain credentials. For more information, refer to [Google Cloud Service Accounts](https://docs.cloud.google.com/iam/docs/service-account-overview). ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Use Exchange to Discover Connectors, Templates, and Examples](https://docs.mulesoft.com/connectors/introduction/intro-use-exchange) - [Google Pub/Sub Connector Reference](https://docs.mulesoft.com/google-pubsub-connector/1.2/google-pubsub-connector-reference) - [Salesforce Help](https://help.salesforce.com) --- product: Google Pub/Sub Connector version: 1.2 --- # Google Pub/Sub Connector 1.2 Examples > For the full documentation index, see: https://docs.mulesoft.com/llms.txt These examples show you how to use Google Pub/Sub Connector to perform the following actions: - [Create a snapshot](#create-snapshot) - [Patch a snapshot](#patch-snapshot) - [Get a snapshot](#get-snapshot) - [Delete a snapshot](#delete-snapshot) - [Publish a message](#publish-message) ## Configure a PubSub Connection Because this connector uses PubSub to secure connections, you must specify the PubSub Connection field values. To do this: - [Create a configuration file for a PubSub Connection.](#create-config-file) - [Configure the PubSub Connection global elements.](#configure-pubsub-global) - [Configure a global element for the properties file.](#configure-global) ### Create a Configuration File for a PubSub Connection Create a configuration file that includes properties for a PubSub Connection: 1. Create a file named `mule-app.properties` in the `/src/main/resources/` folder. 2. In the `mule-app.properties` file, create a set of properties for `PubSub Connection`, similar to the ones that follow, replacing the bracketed text (including the brackets) with the correct values for your configuration: config.private\_key\_id= config.private\_key= config.client\_id= config.client\_email= config.default\_project\_id= For more information about creating a properties file, refer to [Configuring Property Placeholders](https://docs.mulesoft.com/mule-runtime/latest/mule-app-properties-to-configure). ### Configure the PubSub Connection Global Elements Configure global elements for the `PubSub Connection` file: 1. Create a new Mule project. 2. In the **Mule Palette** view, click **Search in Exchange** and enter `google pubsub`. 3. Add **Google Pub/Sub Connector** to the **Selected modules** section and click **Finish**. 4. Click the **Global Elements** tab and click **Create**. 5. Select **Connector Configuration > Google PubSub Configuration** and click **OK**. 6. Enter the following values:
FieldValue

Name

Google_Pub_Sub_Configuration

Private key id

${config.private_key_id}

Private key

${config.private_key}

Client id

${config.client_id}

Client email

${config.client_email}

Default Project Id

${config.default_project_id}

Default Subscription Name

orders-subscription

Default Topic Name

orders-topic

7. Click **OK**. ### Configure a Global Element for the Properties File Configure a global element for the `mule-app.properties` file so that Mule knows where to find it: 1. Click the **Global Elements** tab and click **Create**. 2. In the **Choose Global Type** dialog, select **Configuration properties** and click **OK**. 3. In the **File** field, enter `mule.app.properties`. 4. Click **OK**. ## Create a Snapshot This Mule flow creates a snapshot from the requested subscription. This example uses the following operations: - **HTTP Listener** Accepts data from HTTP requests - **Create snapshot** Creates a snapshot - **Logger** Shows the HTTP response from the **Create snapshot** operation - **Transform Message** Outputs the results of the **Create snapshot** operation in JSON format ![Studio Flow for the Create Snapshot Operation](/mulesoft/current/en-us/google-pubsub-connector/1.2/_images/create-snapshot-flow.png) ### XML for This Example Paste this code into the Studio XML editor to quickly load the flow for this example into your Mule app: ```xml ``` ### Steps for Running This Example 1. Verify that your connector is configured. 2. Save the project. 3. From a web browser, test the application by entering `[http://localhost:8081/](http://localhost:8081/)`. You should see the **Create Snapshot** form with pre-populated **Snapshot Name** and **Subscription Name** fields. ![Create Snapshot Form](/mulesoft/current/en-us/google-pubsub-connector/1.2/_images/create-snapshot.png) 4. Click **Create Snapshot**. You should see an alert that the snapshot was successfully created. ## Patch a Snapshot This Mule flow updates an existing snapshot. This example uses the following operations: - **HTTP Listener** Accepts data from HTTP requests - **Patch snapshot** Updates a snapshot - **Transform Message** Outputs the results of the **Patch snapshot** operation in JSON format - **Logger** Shows the HTTP response from the **Patch snapshot** operation ![Studio Flow for the Patch Snapshot Operation](/mulesoft/current/en-us/google-pubsub-connector/1.2/_images/patch-snapshot-flow.png) ### XML for This Example Paste this code into the Studio XML editor to quickly load the flow for this example into your Mule app: ```xml >/snapshots/<>", "topic": "projects/<>/topic/<>" "expireTime": "2099-01-01T00:00:00Z", "labels": { "label1": "test-patch-snapshot" } }]]]> ``` ## Get a Snapshot This Mule flow retrieves an existing snapshot. This example uses the following operations: - **HTTP Listener** Accepts data from HTTP requests - **Get snapshot** Retrieves a snapshot - **Logger** Shows the HTTP response from the **Get snapshot** operation - **Transform Message** Outputs the results of the **Get snapshot** operation in JSON format ![Studio Flow for the Get Snapshot Operation](/mulesoft/current/en-us/google-pubsub-connector/1.2/_images/get-snapshot-flow.png) ### XML for This Example Paste this code into the Studio XML editor to quickly load the flow for this example into your Mule app: ```xml ``` ### Steps for Running This Example 1. Verify that your connector is configured. 2. Save the project. 3. From a web browser, test the application by entering `[http://localhost:8081/](http://localhost:8081/)`. You should see the **Get Snapshot** form with a pre-populated **Snapshot Name** field. ![Get Snapshot Form](/mulesoft/current/en-us/google-pubsub-connector/1.2/_images/get-snapshot.png) 4. Click **Get Snapshot**. You should see an alert that the snapshot was successfully retrieved. ## Delete a Snapshot This Mule flow deletes an existing snapshot. This example uses the following operations: - **HTTP Listener** Accepts data from HTTP requests - **Delete snapshot** Deletes a snapshot ![Studio Flow for the Delete Snapshot Operation](/mulesoft/current/en-us/google-pubsub-connector/1.2/_images/delete-snapshot-flow.png) ### XML for This Example Paste this code into the Studio XML editor to quickly load the flow for this example into your Mule app: ```xml ``` ### Steps for Running This Example 1. Verify that your connector is configured. 2. Save the project. 3. From a web browser, test the application by entering `[http://localhost:8081/](http://localhost:8081/)`. You should see the **Delete Snapshot** form with a pre-populated **Snapshot Name** field. ![Delete Snapshot Form](/mulesoft/current/en-us/google-pubsub-connector/1.2/_images/delete-snapshot.png) 4. Click **Delete Snapshot**. You should see an alert that the snapshot was successfully deleted. ## Publish a Message This Mule flow publishes a single message to a selected topic. This example uses the following operations: - **HTTP Listener** Accepts data from HTTP requests - **Publish Message** Publishes a message ![Studio Flow for the Publish Message Operation](/mulesoft/current/en-us/google-pubsub-connector/1.2/_images/publish-message-flow.png) ### XML for This Example Paste this code into the Studio XML editor to quickly load the flow for this example into your Mule app: ```xml ``` ### Steps for Running This Example 1. Verify that your connector is configured. 2. Save the project. 3. From a web browser, test the application by entering `[http://localhost:8081/](http://localhost:8081/)`. You should see the **Publish Message** form with pre-populated **Topic Name**, **Ordering Key**, and **Message** fields. ![Publish Message form](/mulesoft/current/en-us/google-pubsub-connector/1.2/_images/publish-message.png) 4. Click **Publish Message**. You should see an alert that the snapshot was successfully published. ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Salesforce Help](https://help.salesforce.com) --- product: Google Pub/Sub Connector version: 1.2 --- # Google Pub/Sub Connector 1.2 Reference > For the full documentation index, see: https://docs.mulesoft.com/llms.txt ## Configurations --- ### Configuration #### Parameters
NameTypeDescriptionDefault ValueRequired

Name

String

Name for this configuration. Connectors reference the configuration with this name.

x

Connection

Connection types for this configuration.

x

Default Project Id

String

Globally unique identifier for your project. Used in operations. It can be overridden at the config level.

Default Subscription Name

String

Default subscription for your project. Used in operations. It can be overridden at the config level.

Default Topic Name

String

Default topic for your project. Used in operations. It can be overridden at the config level.

Default Snapshot Name

String

Default snapshot for your project. Used in operations. It can be overridden at the operation config level.

Name

String

ID used to reference this configuration.

x

Expiration Policy

Configures the minimum amount of time that a dynamic configuration instance can remain idle before Mule considers it eligible for expiration.

#### Connection Types ##### PubSub Connection ###### Parameters
NameTypeDescriptionDefault ValueRequired

Authentication Method

String

Authentication method to use for Google Cloud authentication. Supports Workload Identity Federation with MuleSoft IdP and Service Account Credentials authentication methods.

MuleSoft IdP Configuration

MuleSoft Identity Provider configuration for WIF authentication. Used when Authentication Method is Workload Identity Federation with MuleSoft IdP. Supports both manual configuration and WIF config file input with enhanced stream-based processing.

Private key ID

String

ID of the private key for the service account. It is a part of the service-credentials created in PubSub. Used when Authentication Method is Service Account Credentials.

x

Client ID

String

ID of the client for the service account. It is a part of the service-credentials created in PubSub.

x

Client email

String

Client email for the service account. It is a part of the service-credentials created in PubSub.

x

Private key

String

Private key for the service account. It is a part of the service-credentials created in PubSub.

x

Override Host

String

Override host for the Google Pub/Sub API endpoint. If specified along with port, all API calls are directed to this host instead of the default public endpoint.

Override Port

Number

Override port for the Google Pub/Sub API endpoint. If specified along with host, all API calls are directed to this port instead of the default public endpoint.

Message Count Batch Size

Number

Maximum number of messages in the batch. After the maximum number of messages is reached, the elements are wrapped up in a batch and sent.

10

Request Size Threshold

Number

Maximum memory size of the messages in the batch. After the maximum memory size is reached, the elements are wrapped up in a batch and sent.

1

Request Size Threshold Unit

Enumeration, one of:

  • BYTE

  • KB

  • MB

  • GB

Data unit for the Request Size Threshold field.

KB

Publish Delay Threshold

Number

Maximum delay threshold to use for batching. After the maximum amount of time has elapsed (counting from the first element added), the elements are wrapped up in a batch and sent. This value must not be set too high, especially for the MILLISECONDS time unit. Otherwise, calls might appear to never complete.

10

Publish Delay Threshold Time Unit

Enumeration, one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

Time unit for the Publish Delay Threshold field.

MILLISECONDS

Enable batching

Boolean

Flag for enabling or disabling publish request batching.

false

Limit Exceeded Behavior

Enumeration, one of:

  • THROW_EXCEPTION

  • BLOCK

  • IGNORE

If not set to IGNORE, flow control enables you to control the publishing behavior by specifying limits for Max Outstanding Request Size and Max Outstanding Element Count.

  • THROW_EXCEPTION

    If the memory size or the amount of outstanding elements (messages where no Ack() or Nack() was performed) exceeds the specified limits, the publisher throws a FlowControlException.

  • BLOCK

    If the memory size or the amount of outstanding elements (messages where no Ack() or Nack() was performed) exceeds the specified limits, the publisher does not publish more messages.

  • IGNORE

    The publisher does not account for specified limits and does not control the message publishing rate.

Max Outstanding Request Size

Number

Maximum amount of memory accumulated by the request before enforcing flow control.

100

Max Outstanding Request Size Unit

Enumeration, one of:

  • BYTE

  • KB

  • MB

  • GB

Data unit for the Max Outstanding Request Size field.

MB

Max Outstanding Element Count

Number

Maximum number of outstanding elements to keep in memory before enforcing flow control.

100

Reconnection

Configures a reconnection strategy to use when a connector operation fails to connect to an external server.

## Supported Operations - [Acknowledge Message](#AcknowledgeMessage) - [Create Snapshot](#CreateSnapshot) - [Delete Snapshot](#DeleteSnapshot) - [Get Snapshot](#GetSnapshot) - [Get Snapshot List](#GetSnapshotList) - [NACK Message](#NackMessage) - [Patch Snapshot](#PatchSnapshot) - [Publish Message](#PublishMessage) - [Seek Messages](#SeekMessages) ## Associated Sources - [On message listener](#MessageListener) ## Operations ## Acknowledge Message `` Acknowledges a message using the provided acknowledgment ID. Use this operation in manual acknowledgment mode to explicitly acknowledge messages. ### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

The name of the configuration to use.

x

Acknowledgment ID

String

The unique acknowledgment ID received in the message attributes.

x

Config Ref

ConfigurationProvider

The name of the configuration to use to execute this component.

x

Reconnection Strategy

Retry strategy in case of connectivity errors.

### For Configurations - [Configuration](#Config) ### Throws - PUBSUB:CONNECTIVITY - PUBSUB:RETRY\_EXHAUSTED ## Create Snapshot `` Creates a snapshot from the requested subscription. Use snapshots in seek operations, which manage message acknowledgments in bulk. This operation enables you to set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot. ### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Snapshot Name

String

Project-wide unique identifier for a snapshot.

x

Labels

Object

Key-value pairs that help users to organize Google Cloud resources. Attaching labels to resources filters them based on the labels.

Config Ref

ConfigurationProvider

Name of the configuration used to execute this component.

x

Project ID

String

Globally unique identifier for your project.

Subscription Name

String

Project-wide unique identifier for the subscription.

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The outcome of the expression is stored in the Target Variable field.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

### Output

Type

Snapshot

### For Configurations - [Configuration](#Config) ### Throws - PUBSUB:ALREADY\_EXISTS - PUBSUB:BAD\_GATEWAY - PUBSUB:CANCELLED - PUBSUB:CONNECTIVITY - PUBSUB:DEADLINE\_EXCEEDED - PUBSUB:FAILED\_PRECONDITION - PUBSUB:INTERNAL - PUBSUB:INVALID\_ARGUMENT - PUBSUB:NOT\_FOUND - PUBSUB:PERMISSION\_DENIED - PUBSUB:RETRY\_EXHAUSTED - PUBSUB:UNAVAILABLE ## Delete Snapshot `` Deletes an existing snapshot. ### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Config Ref

ConfigurationProvider

Name of the configuration used to execute this component.

x

Project ID

String

Globally unique identifier for your project.

Snapshot Name

String

Project-wide unique identifier for a snapshot.

x

Reconnection Strategy

Retry strategy in case of connectivity errors.

### For Configurations - [Configuration](#Config) ### Throws - PUBSUB:BAD\_GATEWAY - PUBSUB:CANCELLED - PUBSUB:CONNECTIVITY - PUBSUB:DEADLINE\_EXCEEDED - PUBSUB:FAILED\_PRECONDITION - PUBSUB:INTERNAL - PUBSUB:INVALID\_ARGUMENT - PUBSUB:NOT\_FOUND - PUBSUB:PERMISSION\_DENIED - PUBSUB:RETRY\_EXHAUSTED - PUBSUB:UNAVAILABLE ## Get Snapshot `` Retrieves a snapshot. ### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Config Ref

ConfigurationProvider

Name of the configuration used to execute this component.

x

Project ID

String

Globally unique identifier for your project.

Snapshot Name

String

Project-wide unique identifier for a snapshot.

x

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The outcome of the expression is stored in the Target Variable field.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

### Output

Type

Snapshot

### For Configurations - [Configuration](#Config) ### Throws - PUBSUB:BAD\_GATEWAY - PUBSUB:CANCELLED - PUBSUB:CONNECTIVITY - PUBSUB:DEADLINE\_EXCEEDED - PUBSUB:FAILED\_PRECONDITION - PUBSUB:INTERNAL - PUBSUB:INVALID\_ARGUMENT - PUBSUB:NOT\_FOUND - PUBSUB:PERMISSION\_DENIED - PUBSUB:RETRY\_EXHAUSTED - PUBSUB:UNAVAILABLE ## Get Snapshot List `` Retrieves a list of existing snapshots from a selected project. ### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Project Id

String

Globally unique identifier for your project.

Config Ref

ConfigurationProvider

Name of the configuration used to execute this component.

x

Streaming Strategy

Configures how Mule processes streams. The default is to use repeatable streams.

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The outcome of the expression is stored in the Target Variable field.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

### Output

Type

Array of Snapshot

### For Configurations - [Configuration](#Config) ### Throws - PUBSUB:BAD\_GATEWAY - PUBSUB:CANCELLED - PUBSUB:DEADLINE\_EXCEEDED - PUBSUB:FAILED\_PRECONDITION - PUBSUB:INTERNAL - PUBSUB:INVALID\_ARGUMENT - PUBSUB:NOT\_FOUND - PUBSUB:PERMISSION\_DENIED - PUBSUB:UNAVAILABLE ## NACK Message `` Negatively acknowledges (NACKs) a message using the provided acknowledgment ID. This causes the message to redeliver. ### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

The name of the configuration to use.

x

Acknowledgment ID

String

The unique acknowledgment ID received in the message attributes.

x

Config Ref

ConfigurationProvider

The name of the configuration to use to execute this component.

Reconnection Strategy

Retry strategy in case of connectivity errors.

### For Configurations - [Configuration](#Config) ### Throws - PUBSUB:CONNECTIVITY - PUBSUB:RETRY\_EXHAUSTED ## Patch Snapshot `` Updates an existing snapshot. The name and the topic of the snapshot are not mutable fields and cannot be updated. ### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Snapshot

Snapshot object with updated fields (labels or expireTime).

#[payload]

Update Mask

String

Indicates which fields in the provided snapshot to update. Must be specified and non-empty. This is a comma-separated list of fully qualified names of fields.

x

Config Ref

ConfigurationProvider

Name of the configuration used to execute this component.

x

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The outcome of the expression is stored in the Target Variable field.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

### Output

Type

Snapshot

### For Configurations - [Configuration](#Config) ### Throws - PUBSUB:BAD\_GATEWAY - PUBSUB:CANCELLED - PUBSUB:CONNECTIVITY - PUBSUB:DEADLINE\_EXCEEDED - PUBSUB:FAILED\_PRECONDITION - PUBSUB:INTERNAL - PUBSUB:INVALID\_ARGUMENT - PUBSUB:NOT\_FOUND - PUBSUB:PERMISSION\_DENIED - PUBSUB:RETRY\_EXHAUSTED - PUBSUB:UNAVAILABLE ## Publish Message `` Publishes a single message. This operation is non-blocking. When batching is enabled, the message is stored only locally until any of the batching restrictions are reached. This operation may lead to high throughput. When using the **Ordering Key** field, processing messages in the order they were called is not guaranteed, especially in threaded environments. If you must maintain a strict order, set **Max Concurrency** to `1` in your source flow settings and add a delay in the for-each loops that contain order critical **Publish** calls. This operation returns the `messageId`, which is the unique identifier of the sent message in the topic. ### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Ordering Key

String

If specified, this field identifies related messages in which the publish order must be respected when the subscriber enables message ordering.

Config Ref

ConfigurationProvider

Name of the configuration used to execute this component.

x

Project ID

String

Globally unique identifier for your project.

Topic Name

String

Project-wide unique identifier for the topic.

Message

Binary

Message content published to the topic. If not empty, the message must contain at least one attribute.

Attributes

Object

Attributes for this message. If empty, the message must contain non-empty data. Can be used to filter messages on the subscription.

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The outcome of the expression is stored in the Target Variable field.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

### Output

Type

String

### For Configurations - [Configuration](#Config) ### Throws - PUBSUB:BAD\_GATEWAY - PUBSUB:CANCELLED - PUBSUB:CONNECTIVITY - PUBSUB:DEADLINE\_EXCEEDED - PUBSUB:FAILED\_PRECONDITION - PUBSUB:INTERNAL - PUBSUB:INVALID\_ARGUMENT - PUBSUB:MAX\_OUTSTANDING\_BATCH\_SIZE\_REACHED - PUBSUB:MAX\_OUTSTANDING\_ELEMENT\_COUNT\_REACHED - PUBSUB:NOT\_FOUND - PUBSUB:PERMISSION\_DENIED - PUBSUB:RETRY\_EXHAUSTED - PUBSUB:UNAVAILABLE ## Seek Messages `` Supports the bulk acknowledging or un-acknowledging of messages to a given snapshot or point of time based on the provided seek target. Seeking to a point in time marks every message received by Pub/Sub before the time as acknowledged, and all messages received after the time as unacknowledged. You can replay and reprocess previously acknowledged messages when seeking to a time in the past or purge messages when seeking to a time in the future. Seeking to a snapshot enables you to redeliver only the messages in the snapshot that match the filter of the subscription making the seek request. Once a snapshot is created, it retains all messages that were unacknowledged in the source subscription at the time of the snapshot’s creation and any messages published to the topic thereafter. You can replay these unacknowledged messages by using a snapshot to seek to any of the topic’s subscriptions. If you seek to a snapshot using a subscription with a filter, the Pub/Sub service redelivers only the messages in the snapshot that match the filter of the subscription making the seek request. ### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Config Ref

ConfigurationProvider

Name of the configuration used to execute this component.

x

Project ID

String

Globally unique identifier for your project.

Subscription Name

String

Project-wide unique identifier for the subscription.

Snapshot Name

String

Snapshot to seek to. The snapshot’s topic must be the same as that of the provided subscription.

Timestamp

DateTime

Specific time to seek to. Messages retained in the subscription that were published before this time are marked as acknowledged, and messages retained in the subscription that were published after this time are marked as unacknowledged.


This operation affects only messages retained in the subscription (configured by the combination of Message Retention Duration and Retain Acked Messages). For example, if the time corresponds to a point before the message retention window (or to a point before the system’s notion of the subscription creation time), only retained messages are marked as unacknowledged, and already-expunged messages are not restored.


A timestamp is in RFC3339 UTC Zulu format, with nanosecond resolution and up to nine fractional digits, such as 2014-10-02T15:01:23Z and 2014-10-02T15:01:23.045123456Z.

Reconnection Strategy

Retry strategy in case of connectivity errors.

### For Configurations - [Configuration](#Config) ### Throws - PUBSUB:BAD\_GATEWAY - PUBSUB:CANCELLED - PUBSUB:CONNECTIVITY - PUBSUB:DEADLINE\_EXCEEDED - PUBSUB:FAILED\_PRECONDITION - PUBSUB:INTERNAL - PUBSUB:INVALID\_ARGUMENT - PUBSUB:NOT\_FOUND - PUBSUB:PERMISSION\_DENIED - PUBSUB:RETRY\_EXHAUSTED - PUBSUB:UNAVAILABLE ## Sources ## On message listener `` Asynchronous message listener that consumes messages from one subscriber. ### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Consumer count

Number

Provides a specified amount of executor service for processing messages.

5

Acknowledgment Mode

Enumeration, one of:

  • AUTO

  • MANUAL

Acknowledgment mode for message processing:

  • AUTO

    Messages are automatically acknowledged on success and NACKed on error.

  • MANUAL

    Messages must be explicitly acknowledged using the Acknowledge Message operation.

AUTO

Config Ref

ConfigurationProvider

Name of the configuration used to execute this component.

x

Primary Node Only

Boolean

Determines whether to execute this source on only the primary node when running Mule instances in a cluster.

On Capacity Overload

Enumeration, one of:

  • WAIT

  • DROP

  • FAIL

Strategy that the runtime applies when the flow receives more messages than it has the capacity to handle.

WAIT

Streaming Strategy

Configures how Mule processes streams. The default is to use repeatable streams.

Redelivery Policy

Defines a policy for processing the redelivery of the same message.

Project ID

String

Globally unique identifier for your project.

Subscription Name

String

Project-wide unique identifier for the subscription.

Limit Exceeded Behavior

Enumeration, one of:

  • THROW_EXCEPTION

  • BLOCK

  • IGNORE

If not set to IGNORE, flow control enables you to control the publishing behavior by specifying limits for Max Outstanding Request Size and Max Outstanding Element Count.

  • THROW_EXCEPTION

    If the memory size or the amount of outstanding elements (messages where no Ack() or Nack() was performed) exceeds the specified limits, the receiver throws a FlowControlException.

  • BLOCK

    If the memory size or the amount of outstanding elements (messages where no Ack() or Nack() was performed) exceeds the specified limits, the receiver does not receive more messages.

  • IGNORE

    The receiver does not account for specified limits and does not control the message delivery rate.

Max Outstanding Request Size

Number

Maximum amount of memory accumulated by the request before enforcing flow control.

100

Max Outstanding Request Size Unit

Enumeration, one of:

  • BYTE

  • KB

  • MB

  • GB

Data unit for the Max Outstanding Request Size field.

MB

Max Outstanding Element Count

Number

Maximum number of outstanding elements to keep in the memory before enforcing flow control.

100

Reconnection Strategy

Retry strategy in case of connectivity errors.

### Output

Type

Any

Attributes Type

Object

### For Configurations - [Configuration](#Config) ## Types ### Wif MuleSoft Idp Config Configuration for **Workload Identity Federation with MuleSoft IdP** authentication.
FieldTypeDescriptionDefault ValueRequired

Wif Config File Path

String

Path to the WIF configuration file. If provided, other fields are populated from this file.

x

Client Id

String

Client ID of the MuleSoft Connected App. This identifies the application requesting authentication.

x

Client Secret

String

Client secret of the MuleSoft Connected App. This is used to authenticate the application with MuleSoft.

x

### Reconnection Configures a reconnection strategy for an operation.
FieldTypeDescriptionDefault ValueRequired

Fails Deployment

Boolean

What to do if, when an app is deployed, a connectivity test does not pass after exhausting the associated reconnection strategy:

  • true

    Allow the deployment to fail.

  • false

    Ignore the results of the connectivity test.

Reconnection Strategy

Reconnection strategy to use.

### Reconnect Configures a standard reconnection strategy, which specifies how often to reconnect and how many reconnection attempts the connector source or operation can make.
FieldTypeDescriptionDefault ValueRequired

Frequency

Number

How often to attempt to reconnect, in milliseconds.

Blocking

Boolean

If false, the reconnection strategy will run in a separate, non-blocking thread.

Count

Number

How many reconnection attempts the Mule app can make.

### Reconnect Forever Configures a forever reconnection strategy by which the connector source or operation attempts to reconnect at a specified frequency for as long as the Mule app runs.
FieldTypeDescriptionDefault ValueRequired

Frequency

Number

How often to attempt to reconnect, in milliseconds.

Blocking

Boolean

If false, the reconnection strategy will run in a separate, non-blocking thread.

### Expiration Policy
FieldTypeDescriptionDefault ValueRequired

Max Idle Time

Number

Configures the maximum amount of time that a dynamic configuration instance can remain idle before Mule considers it eligible for expiration.

Time Unit

Enumeration, one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

Time unit for the Max Idle Time field.

### Repeatable In Memory Stream Configures the in-memory streaming strategy by which the request fails if the data exceeds the MAX buffer size. Always run performance tests to find the optimal buffer size for your specific use case.
FieldTypeDescriptionDefault ValueRequired

Initial Buffer Size

Number

Initial amount of memory to allocate to the data stream. If the streamed data exceeds this value, the buffer expands by Buffer Size Increment, with an upper limit of Max In Memory Size value.

Buffer Size Increment

Number

Amount by which the buffer size expands if it exceeds its initial size. Setting a value of 0 or lower specifies that the buffer can’t expand.

Max Buffer Size

Number

Maximum size of the buffer. If the buffer size exceeds this value, Mule raises a STREAM_MAXIMUM_SIZE_EXCEEDED error. A value of less than or equal to 0 means no limit.

Buffer Unit

Enumeration, one of:

  • BYTE

  • KB

  • MB

  • GB

Unit for the Initial Buffer Size, Buffer Size Increment, and Buffer Unit fields.

### Repeatable File Store Stream Configures the repeatable file-store streaming strategy by which Mule keeps a portion of the stream content in memory. If the stream content is larger than the configured buffer size, Mule backs up the buffer’s content to disk and then clears the memory.
FieldTypeDescriptionDefault ValueRequired

In Memory Size

Number

Maximum amount of memory that the stream can use for data. If the amount of memory exceeds this value, Mule buffers the content to disk. To optimize performance:

  • Configure a larger buffer size to avoid the number of times Mule needs to write the buffer on disk. This increases performance, but it also limits the number of concurrent requests your application can process, because it requires additional memory.

  • Configure a smaller buffer size to decrease memory load at the expense of response time.

Buffer Unit

Enumeration, one of:

  • BYTE

  • KB

  • MB

  • GB

Unit for the In Memory Size field.

### Redelivery Policy Configures the redelivery policy for executing requests that generate errors. You can add a redelivery policy to any source in a flow.
FieldTypeDescriptionDefault ValueRequired

Max Redelivery Count

Number

Maximum number of times that a redelivered request can be processed unsuccessfully before returning a REDELIVERY_EXHAUSTED error.

Message Digest Algorithm

String

Secure hashing algorithm to use if the Use Secure Hash field is true. If the payload of the message is a Java object, Mule ignores this value and returns the value that the payload’s hashCode() returned.

Message Identifier

Defines which strategy is used to identify the messages.

Object Store

ObjectStore

Configures the object store that stores the redelivery counter for each message.

### Redelivery Policy Message Identifier Configures how to identify a redelivered message and how to find out when the message was redelivered.
FieldTypeDescriptionDefault ValueRequired

Use Secure Hash

Boolean

If true, Mule uses a secure hash algorithm to identify a redelivered message.

Id Expression

String

One or more expressions that determine when a message was redelivered. You can set this property only if the Use Secure Hash field is false.

### Snapshot Snapshot resource. You can use snapshots in seek operations, which manage message acknowledgments in bulk. This type enables you to set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot.
FieldTypeDescriptionDefault ValueRequired

Expire Time

DateTime

Time length for which the snapshot is guaranteed to exist. The lifetime for a newly-created snapshot is based on the oldest unacked message in the source subscription’s backlog, however, the snapshot can exist for a maximum of seven days.


Consider a subscription with an oldest unacked message that is three days old. If a snapshot is created from this subscription, the snapshot will expire in four days. The service will refuse to create a snapshot that will expire in less than one hour after creation.


A timestamp is in RFC3339 UTC Zulu format, with nanosecond resolution and up to nine fractional digits, such as 2014-10-02T15:01:23Z and 2014-10-02T15:01:23.045123456Z.

Labels

Any

Object containing a list of key-value pairs, such as { "name": "wrench", "mass": "1.3kg", "count": "3" }.

Name

String

Name of the snapshot.

Topic

String

Name of the topic from which the snapshot retains messages.

### Repeatable In Memory Iterable
FieldTypeDescriptionDefault ValueRequired

Initial Buffer Size

Number

The number of instances to initially keep in memory to consume the stream and provide random access to it. If the stream contains more data than can fit into this buffer, then the buffer expands according to the Buffer Size Increment field, with an upper limit of Max In Memory Size.

100

Buffer Size Increment

Number

This is by how much the buffer size expands if it exceeds its initial size. Setting a value of zero or lower means that the buffer should not expand, meaning that a STREAM_MAXIMUM_SIZE_EXCEEDED error is raised when the buffer gets full.

100

Max Buffer Size

Number

The maximum amount of memory to use. If more than that is used then a STREAM_MAXIMUM_SIZE_EXCEEDED error is raised. A value lower than or equal to zero means no limit.

### Repeatable File Store Iterable
FieldTypeDescriptionDefault ValueRequired

In Memory Objects

Number

The maximum amount of instances to keep in memory. If more than that is required, content on the disk is buffered.

Buffer Unit

Enumeration, one of:

  • BYTE

  • KB

  • MB

  • GB

Unit for the In Memory Objects field.

## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Salesforce Help](https://help.salesforce.com) --- product: Google Pub/Sub Connector version: 1.2 --- # Google Pub/Sub Connector 1.2 XML and Maven Support > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Although you can manually code a Mule app in XML, it is more efficient to use Anypoint Studio: - If you manually code a Mule runtime engine (Mule) app in XML, either from the Anypoint Studio XML editor or from a text editor, you can access the connector from your app by adding reference statements to both your XML Mule flow and the Apache Maven `pom.xml` file. - If you add the connector in Studio, Studio automatically populates the XML code with the connector’s namespace and schema location and it also adds a dependency to the `pom.xml` file. ## Add a Namespace for the Connector Paste the following code inside the `` tag of the header of your configuration XML: ```xml http://www.mulesoft.org/schema/mule/google-pubsub http://www.mulesoft.org/schema/mule/google-pubsub/current/mule-google-pubsub.xsd ``` This example shows how the namespace statements are placed in the XML block: ```xml ``` ## Add a POM File Dependency The Apache Maven `pom.xml` file generated by Anypoint Studio contains dependencies for a Mule app. When you code a Mule app manually, include this XML snippet in your `pom.xml` file to enable access to this connector: ```xml com.mulesoft.connectors mule4-google-pubsub-connector x.x.x mule-plugin ``` Replace `x.x.x` with the version that corresponds to the connector you are using. To obtain the most up-to-date `pom.xml` file information: 1. Go to [Anypoint Exchange](https://www.mulesoft.com/exchange/). 2. In Exchange, click **Login** and supply your Anypoint Platform username and password. 3. In Exchange, search for `google-pubsub`. 4. Select the connector. 5. Click **Dependency Snippets** near the upper right of the screen. ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Salesforce Help](https://help.salesforce.com) --- product: Google Pub/Sub Connector version: 1.3 is-latest-version: true --- # Google Pub/Sub Connector 1.3 > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Anypoint Connector for Google Pub/Sub (Google Pub/Sub Connector) enables you to access the Google Pub/Sub messaging platform. This connector exposes operations provided by the Google Pub/Sub client libraries. For compatibility information and fixed issues, refer to the Google Pub/Sub Connector Release Notes. ## Before You Begin To use this connector, you must be familiar with: - The Google Pub/Sub API - Anypoint Connectors - Mule runtime engine (Mule) - Elements and global elements in a Mule flow - Creating a Mule app using Anypoint Studio or Anypoint Code Builder Before creating an app, you must have: - Credentials to access the target resource - Anypoint Studio or Anypoint Code Builder ## Common Use Cases for the Connector Some common use cases for Google Pub/Sub Connector include: - Publishing messages - Listening to messages - Managing snapshots - Replaying messages ## Authentication Types Google Pub/Sub Connector uses the PubSub Connection authentication method, in which you create a service account and obtain credentials. For more information, refer to [Google Cloud Service Accounts](https://docs.cloud.google.com/iam/docs/service-account-overview). For **Workload Identity Federation with MuleSoft IdP**, you can set **Token Endpoint** so the same app can request tokens from the US or EU1 control plane. If you leave **Token Endpoint** blank, the connector uses the US token endpoint. For field details, see [Wif MuleSoft Idp Config](https://docs.mulesoft.com/google-pubsub-connector/latest/google-pubsub-connector-reference#WifMuleSoftIdpConfig). ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Use Exchange to Discover Connectors, Templates, and Examples](https://docs.mulesoft.com/connectors/introduction/intro-use-exchange) - [Google Pub/Sub Connector Reference](https://docs.mulesoft.com/google-pubsub-connector/latest/google-pubsub-connector-reference) - [Salesforce Help](https://help.salesforce.com) --- product: Google Pub/Sub Connector version: 1.3 is-latest-version: true --- # Google Pub/Sub Connector 1.3 Examples > For the full documentation index, see: https://docs.mulesoft.com/llms.txt These examples show you how to use Google Pub/Sub Connector to perform the following actions: - [Create a snapshot](#create-snapshot) - [Patch a snapshot](#patch-snapshot) - [Get a snapshot](#get-snapshot) - [Delete a snapshot](#delete-snapshot) - [Publish a message](#publish-message) ## Configure a PubSub Connection Because this connector uses PubSub to secure connections, you must specify the PubSub Connection field values. To do this: - [Create a configuration file for a PubSub Connection.](#create-config-file) - [Configure the PubSub Connection global elements.](#configure-pubsub-global) - [Configure a global element for the properties file.](#configure-global) ### Create a Configuration File for a PubSub Connection Create a configuration file that includes properties for a PubSub Connection: 1. Create a file named `mule-app.properties` in the `/src/main/resources/` folder. 2. In the `mule-app.properties` file, create a set of properties for `PubSub Connection`, similar to the ones that follow, replacing the bracketed text (including the brackets) with the correct values for your configuration: config.private\_key\_id= config.private\_key= config.client\_id= config.client\_email= config.default\_project\_id= For more information about creating a properties file, refer to [Configuring Property Placeholders](https://docs.mulesoft.com/mule-runtime/latest/mule-app-properties-to-configure). ### Configure the PubSub Connection Global Elements Configure global elements for the `PubSub Connection` file: 1. Create a new Mule project. 2. In the **Mule Palette** view, click **Search in Exchange** and enter `google pubsub`. 3. Add **Google Pub/Sub Connector** to the **Selected modules** section and click **Finish**. 4. Click the **Global Elements** tab and click **Create**. 5. Select **Connector Configuration > Google PubSub Configuration** and click **OK**. 6. Enter the following values:
FieldValue

Name

Google_Pub_Sub_Configuration

Private key id

${config.private_key_id}

Private key

${config.private_key}

Client id

${config.client_id}

Client email

${config.client_email}

Default Project Id

${config.default_project_id}

Default Subscription Name

orders-subscription

Default Topic Name

orders-topic

7. Click **OK**. ### Configure a Global Element for the Properties File Configure a global element for the `mule-app.properties` file so that Mule knows where to find it: 1. Click the **Global Elements** tab and click **Create**. 2. In the **Choose Global Type** dialog, select **Configuration properties** and click **OK**. 3. In the **File** field, enter `mule.app.properties`. 4. Click **OK**. ## Create a Snapshot This Mule flow creates a snapshot from the requested subscription. This example uses the following operations: - **HTTP Listener** Accepts data from HTTP requests - **Create snapshot** Creates a snapshot - **Logger** Shows the HTTP response from the **Create snapshot** operation - **Transform Message** Outputs the results of the **Create snapshot** operation in JSON format ![Studio Flow for the Create Snapshot Operation](/mulesoft/current/en-us/google-pubsub-connector/latest/_images/create-snapshot-flow.png) ### XML for This Example Paste this code into the Studio XML editor to quickly load the flow for this example into your Mule app: ```xml ``` ### Steps for Running This Example 1. Verify that your connector is configured. 2. Save the project. 3. From a web browser, test the application by entering `[http://localhost:8081/](http://localhost:8081/)`. You should see the **Create Snapshot** form with pre-populated **Snapshot Name** and **Subscription Name** fields. ![Create Snapshot Form](/mulesoft/current/en-us/google-pubsub-connector/latest/_images/create-snapshot.png) 4. Click **Create Snapshot**. You should see an alert that the snapshot was successfully created. ## Patch a Snapshot This Mule flow updates an existing snapshot. This example uses the following operations: - **HTTP Listener** Accepts data from HTTP requests - **Patch snapshot** Updates a snapshot - **Transform Message** Outputs the results of the **Patch snapshot** operation in JSON format - **Logger** Shows the HTTP response from the **Patch snapshot** operation ![Studio Flow for the Patch Snapshot Operation](/mulesoft/current/en-us/google-pubsub-connector/latest/_images/patch-snapshot-flow.png) ### XML for This Example Paste this code into the Studio XML editor to quickly load the flow for this example into your Mule app: ```xml >/snapshots/<>", "topic": "projects/<>/topic/<>" "expireTime": "2099-01-01T00:00:00Z", "labels": { "label1": "test-patch-snapshot" } }]]]> ``` ## Get a Snapshot This Mule flow retrieves an existing snapshot. This example uses the following operations: - **HTTP Listener** Accepts data from HTTP requests - **Get snapshot** Retrieves a snapshot - **Logger** Shows the HTTP response from the **Get snapshot** operation - **Transform Message** Outputs the results of the **Get snapshot** operation in JSON format ![Studio Flow for the Get Snapshot Operation](/mulesoft/current/en-us/google-pubsub-connector/latest/_images/get-snapshot-flow.png) ### XML for This Example Paste this code into the Studio XML editor to quickly load the flow for this example into your Mule app: ```xml ``` ### Steps for Running This Example 1. Verify that your connector is configured. 2. Save the project. 3. From a web browser, test the application by entering `[http://localhost:8081/](http://localhost:8081/)`. You should see the **Get Snapshot** form with a pre-populated **Snapshot Name** field. ![Get Snapshot Form](/mulesoft/current/en-us/google-pubsub-connector/latest/_images/get-snapshot.png) 4. Click **Get Snapshot**. You should see an alert that the snapshot was successfully retrieved. ## Delete a Snapshot This Mule flow deletes an existing snapshot. This example uses the following operations: - **HTTP Listener** Accepts data from HTTP requests - **Delete snapshot** Deletes a snapshot ![Studio Flow for the Delete Snapshot Operation](/mulesoft/current/en-us/google-pubsub-connector/latest/_images/delete-snapshot-flow.png) ### XML for This Example Paste this code into the Studio XML editor to quickly load the flow for this example into your Mule app: ```xml ``` ### Steps for Running This Example 1. Verify that your connector is configured. 2. Save the project. 3. From a web browser, test the application by entering `[http://localhost:8081/](http://localhost:8081/)`. You should see the **Delete Snapshot** form with a pre-populated **Snapshot Name** field. ![Delete Snapshot Form](/mulesoft/current/en-us/google-pubsub-connector/latest/_images/delete-snapshot.png) 4. Click **Delete Snapshot**. You should see an alert that the snapshot was successfully deleted. ## Publish a Message This Mule flow publishes a single message to a selected topic. This example uses the following operations: - **HTTP Listener** Accepts data from HTTP requests - **Publish Message** Publishes a message ![Studio Flow for the Publish Message Operation](/mulesoft/current/en-us/google-pubsub-connector/latest/_images/publish-message-flow.png) ### XML for This Example Paste this code into the Studio XML editor to quickly load the flow for this example into your Mule app: ```xml ``` ### Steps for Running This Example 1. Verify that your connector is configured. 2. Save the project. 3. From a web browser, test the application by entering `[http://localhost:8081/](http://localhost:8081/)`. You should see the **Publish Message** form with pre-populated **Topic Name**, **Ordering Key**, and **Message** fields. ![Publish Message form](/mulesoft/current/en-us/google-pubsub-connector/latest/_images/publish-message.png) 4. Click **Publish Message**. You should see an alert that the snapshot was successfully published. ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Salesforce Help](https://help.salesforce.com) --- product: Google Pub/Sub Connector version: 1.3 is-latest-version: true --- # Google Pub/Sub Connector 1.3 Reference > For the full documentation index, see: https://docs.mulesoft.com/llms.txt ## Configurations --- ### Configuration #### Parameters
NameTypeDescriptionDefault ValueRequired

Name

String

Name for this configuration. Connectors reference the configuration with this name.

x

Connection

Connection types for this configuration.

x

Default Project Id

String

Globally unique identifier for your project. Used in operations. It can be overridden at the config level.

Default Subscription Name

String

Default subscription for your project. Used in operations. It can be overridden at the config level.

Default Topic Name

String

Default topic for your project. Used in operations. It can be overridden at the config level.

Default Snapshot Name

String

Default snapshot for your project. Used in operations. It can be overridden at the operation config level.

Name

String

ID used to reference this configuration.

x

Expiration Policy

Configures the minimum amount of time that a dynamic configuration instance can remain idle before Mule considers it eligible for expiration.

#### Connection Types ##### PubSub Connection ###### Parameters
NameTypeDescriptionDefault ValueRequired

Authentication Method

String

Authentication method to use for Google Cloud authentication. Supports Workload Identity Federation with MuleSoft IdP and Service Account Credentials authentication methods.

MuleSoft IdP Configuration

MuleSoft Identity Provider configuration for WIF authentication. Used when Authentication Method is Workload Identity Federation with MuleSoft IdP. Supports both manual configuration and WIF config file input with enhanced stream-based processing.

Private key id

String

ID of the private key for the service account. It is a part of the service-credentials created in PubSub. Used when Authentication Method is Service Account Credentials.

Client id

String

ID of the client for the service account. It is a part of the service-credentials created in PubSub. Used when Authentication Method is Service Account Credentials.

Client email

String

Client email for the service account. It is a part of the service-credentials created in PubSub. Used when Authentication Method is Service Account Credentials.

Private key

String

Private key for the service account. It is a part of the service-credentials created in PubSub. Used when Authentication Method is Service Account Credentials.

Override Host

String

Override host for the Google Pub/Sub API endpoint. If specified along with port, all API calls are directed to this host instead of the default public endpoint.

Override Port

Number

Override port for the Google Pub/Sub API endpoint. If specified along with host, all API calls are directed to this port instead of the default public endpoint.

Message Count Batch Size

Number

Maximum number of messages in the batch. After the maximum number of messages is reached, the elements are wrapped up in a batch and sent.

10

Request Size Threshold

Number

Maximum memory size of the messages in the batch. After the maximum memory size is reached, the elements are wrapped up in a batch and sent.

1

Request Size Threshold Unit

Enumeration, one of:

  • BYTE

  • KB

  • MB

  • GB

Data unit for the Request Size Threshold field.

KB

Publish Delay Threshold

Number

Maximum delay threshold to use for batching. After the maximum amount of time has elapsed (counting from the first element added), the elements are wrapped up in a batch and sent. This value must not be set too high, especially for the MILLISECONDS time unit. Otherwise, calls might appear to never complete.

10

Publish Delay Threshold Time Unit

Enumeration, one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

Time unit for the Publish Delay Threshold field.

MILLISECONDS

Enable batching

Boolean

Flag for enabling or disabling publish request batching.

false

Limit Exceeded Behavior

Enumeration, one of:

  • THROW_EXCEPTION

  • BLOCK

  • IGNORE

If not set to IGNORE, flow control enables you to control the publishing behavior by specifying limits for Max Outstanding Request Size and Max Outstanding Element Count.

  • THROW_EXCEPTION

    If the memory size or the amount of outstanding elements (messages where no Ack() or Nack() was performed) exceeds the specified limits, the publisher throws a FlowControlException.

  • BLOCK

    If the memory size or the amount of outstanding elements (messages where no Ack() or Nack() was performed) exceeds the specified limits, the publisher does not publish more messages.

  • IGNORE

    The publisher does not account for specified limits and does not control the message publishing rate.

Max Outstanding Request Size

Number

Maximum amount of memory accumulated by the request before enforcing flow control.

100

Max Outstanding Request Size Unit

Enumeration, one of:

  • BYTE

  • KB

  • MB

  • GB

Data unit for the Max Outstanding Request Size field.

MB

Max Outstanding Element Count

Number

Maximum number of outstanding elements to keep in memory before enforcing flow control.

100

Reconnection

Configures a reconnection strategy to use when a connector operation fails to connect to an external server.

## Supported Operations - [Acknowledge Message](#AcknowledgeMessage) - [Create Snapshot](#CreateSnapshot) - [Delete Snapshot](#DeleteSnapshot) - [Get Snapshot](#GetSnapshot) - [Get Snapshot List](#GetSnapshotList) - [NACK Message](#NackMessage) - [Patch Snapshot](#PatchSnapshot) - [Publish Message](#PublishMessage) - [Seek Messages](#SeekMessages) ## Associated Sources - [On message listener](#MessageListener) ## Operations ## Acknowledge Message `` Acknowledges a message using the provided acknowledgment ID. Use this operation in manual acknowledgment mode to explicitly acknowledge messages. ### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

The name of the configuration to use.

x

Acknowledgment ID

String

The unique acknowledgment ID received in the message attributes.

x

Config Ref

ConfigurationProvider

The name of the configuration to use to execute this component.

x

Reconnection Strategy

Retry strategy in case of connectivity errors.

### For Configurations - [Configuration](#Config) ### Throws - PUBSUB:CONNECTIVITY - PUBSUB:RETRY\_EXHAUSTED ## Create Snapshot `` Creates a snapshot from the requested subscription. Use snapshots in seek operations, which manage message acknowledgments in bulk. This operation enables you to set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot. ### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Snapshot Name

String

Project-wide unique identifier for a snapshot.

x

Labels

Object

Key-value pairs that help users to organize Google Cloud resources. Attaching labels to resources filters them based on the labels.

Config Ref

ConfigurationProvider

Name of the configuration used to execute this component.

x

Project ID

String

Globally unique identifier for your project.

Subscription Name

String

Project-wide unique identifier for the subscription.

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The outcome of the expression is stored in the Target Variable field.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

### Output

Type

Snapshot

### For Configurations - [Configuration](#Config) ### Throws - PUBSUB:ALREADY\_EXISTS - PUBSUB:BAD\_GATEWAY - PUBSUB:CANCELLED - PUBSUB:CONNECTIVITY - PUBSUB:DEADLINE\_EXCEEDED - PUBSUB:FAILED\_PRECONDITION - PUBSUB:INTERNAL - PUBSUB:INVALID\_ARGUMENT - PUBSUB:NOT\_FOUND - PUBSUB:PERMISSION\_DENIED - PUBSUB:RETRY\_EXHAUSTED - PUBSUB:UNAVAILABLE ## Delete Snapshot `` Deletes an existing snapshot. ### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Config Ref

ConfigurationProvider

Name of the configuration used to execute this component.

x

Project ID

String

Globally unique identifier for your project.

Snapshot Name

String

Project-wide unique identifier for a snapshot.

x

Reconnection Strategy

Retry strategy in case of connectivity errors.

### For Configurations - [Configuration](#Config) ### Throws - PUBSUB:BAD\_GATEWAY - PUBSUB:CANCELLED - PUBSUB:CONNECTIVITY - PUBSUB:DEADLINE\_EXCEEDED - PUBSUB:FAILED\_PRECONDITION - PUBSUB:INTERNAL - PUBSUB:INVALID\_ARGUMENT - PUBSUB:NOT\_FOUND - PUBSUB:PERMISSION\_DENIED - PUBSUB:RETRY\_EXHAUSTED - PUBSUB:UNAVAILABLE ## Get Snapshot `` Retrieves a snapshot. ### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Config Ref

ConfigurationProvider

Name of the configuration used to execute this component.

x

Project ID

String

Globally unique identifier for your project.

Snapshot Name

String

Project-wide unique identifier for a snapshot.

x

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The outcome of the expression is stored in the Target Variable field.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

### Output

Type

Snapshot

### For Configurations - [Configuration](#Config) ### Throws - PUBSUB:BAD\_GATEWAY - PUBSUB:CANCELLED - PUBSUB:CONNECTIVITY - PUBSUB:DEADLINE\_EXCEEDED - PUBSUB:FAILED\_PRECONDITION - PUBSUB:INTERNAL - PUBSUB:INVALID\_ARGUMENT - PUBSUB:NOT\_FOUND - PUBSUB:PERMISSION\_DENIED - PUBSUB:RETRY\_EXHAUSTED - PUBSUB:UNAVAILABLE ## Get Snapshot List `` Retrieves a list of existing snapshots from a selected project. ### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Project Id

String

Globally unique identifier for your project.

Config Ref

ConfigurationProvider

Name of the configuration used to execute this component.

x

Streaming Strategy

Configures how Mule processes streams. The default is to use repeatable streams.

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The outcome of the expression is stored in the Target Variable field.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

### Output

Type

Array of Snapshot

### For Configurations - [Configuration](#Config) ### Throws - PUBSUB:BAD\_GATEWAY - PUBSUB:CANCELLED - PUBSUB:DEADLINE\_EXCEEDED - PUBSUB:FAILED\_PRECONDITION - PUBSUB:INTERNAL - PUBSUB:INVALID\_ARGUMENT - PUBSUB:NOT\_FOUND - PUBSUB:PERMISSION\_DENIED - PUBSUB:UNAVAILABLE ## NACK Message `` Negatively acknowledges (NACKs) a message using the provided acknowledgment ID. This causes the message to redeliver. ### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

The name of the configuration to use.

x

Acknowledgment ID

String

The unique acknowledgment ID received in the message attributes.

x

Config Ref

ConfigurationProvider

The name of the configuration to use to execute this component.

Reconnection Strategy

Retry strategy in case of connectivity errors.

### For Configurations - [Configuration](#Config) ### Throws - PUBSUB:CONNECTIVITY - PUBSUB:RETRY\_EXHAUSTED ## Patch Snapshot `` Updates an existing snapshot. The name and the topic of the snapshot are not mutable fields and cannot be updated. ### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Snapshot

Snapshot object with updated fields (labels or expireTime).

#[payload]

Update Mask

String

Indicates which fields in the provided snapshot to update. Must be specified and non-empty. This is a comma-separated list of fully qualified names of fields.

x

Config Ref

ConfigurationProvider

Name of the configuration used to execute this component.

x

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The outcome of the expression is stored in the Target Variable field.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

### Output

Type

Snapshot

### For Configurations - [Configuration](#Config) ### Throws - PUBSUB:BAD\_GATEWAY - PUBSUB:CANCELLED - PUBSUB:CONNECTIVITY - PUBSUB:DEADLINE\_EXCEEDED - PUBSUB:FAILED\_PRECONDITION - PUBSUB:INTERNAL - PUBSUB:INVALID\_ARGUMENT - PUBSUB:NOT\_FOUND - PUBSUB:PERMISSION\_DENIED - PUBSUB:RETRY\_EXHAUSTED - PUBSUB:UNAVAILABLE ## Publish Message `` Publishes a single message. This operation is non-blocking. When batching is enabled, the message is stored only locally until any of the batching restrictions are reached. This operation may lead to high throughput. When using the **Ordering Key** field, processing messages in the order they were called is not guaranteed, especially in threaded environments. If you must maintain a strict order, set **Max Concurrency** to `1` in your source flow settings and add a delay in the for-each loops that contain order critical **Publish** calls. This operation returns the `messageId`, which is the unique identifier of the sent message in the topic. ### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Ordering Key

String

If specified, this field identifies related messages in which the publish order must be respected when the subscriber enables message ordering.

Config Ref

ConfigurationProvider

Name of the configuration used to execute this component.

x

Project ID

String

Globally unique identifier for your project.

Topic Name

String

Project-wide unique identifier for the topic.

Message

Binary

Message content published to the topic. If not empty, the message must contain at least one attribute.

Attributes

Object

Attributes for this message. If empty, the message must contain non-empty data. Can be used to filter messages on the subscription.

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The outcome of the expression is stored in the Target Variable field.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

### Output

Type

String

### For Configurations - [Configuration](#Config) ### Throws - PUBSUB:BAD\_GATEWAY - PUBSUB:CANCELLED - PUBSUB:CONNECTIVITY - PUBSUB:DEADLINE\_EXCEEDED - PUBSUB:FAILED\_PRECONDITION - PUBSUB:INTERNAL - PUBSUB:INVALID\_ARGUMENT - PUBSUB:MAX\_OUTSTANDING\_BATCH\_SIZE\_REACHED - PUBSUB:MAX\_OUTSTANDING\_ELEMENT\_COUNT\_REACHED - PUBSUB:NOT\_FOUND - PUBSUB:PERMISSION\_DENIED - PUBSUB:RETRY\_EXHAUSTED - PUBSUB:UNAVAILABLE ## Seek Messages `` Supports the bulk acknowledging or un-acknowledging of messages to a given snapshot or point of time based on the provided seek target. Seeking to a point in time marks every message received by Pub/Sub before the time as acknowledged, and all messages received after the time as unacknowledged. You can replay and reprocess previously acknowledged messages when seeking to a time in the past or purge messages when seeking to a time in the future. Seeking to a snapshot enables you to redeliver only the messages in the snapshot that match the filter of the subscription making the seek request. Once a snapshot is created, it retains all messages that were unacknowledged in the source subscription at the time of the snapshot’s creation and any messages published to the topic thereafter. You can replay these unacknowledged messages by using a snapshot to seek to any of the topic’s subscriptions. If you seek to a snapshot using a subscription with a filter, the Pub/Sub service redelivers only the messages in the snapshot that match the filter of the subscription making the seek request. ### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Config Ref

ConfigurationProvider

Name of the configuration used to execute this component.

x

Project ID

String

Globally unique identifier for your project.

Subscription Name

String

Project-wide unique identifier for the subscription.

Snapshot Name

String

Snapshot to seek to. The snapshot’s topic must be the same as that of the provided subscription.

Timestamp

DateTime

Specific time to seek to. Messages retained in the subscription that were published before this time are marked as acknowledged, and messages retained in the subscription that were published after this time are marked as unacknowledged.


This operation affects only messages retained in the subscription (configured by the combination of Message Retention Duration and Retain Acked Messages). For example, if the time corresponds to a point before the message retention window (or to a point before the system’s notion of the subscription creation time), only retained messages are marked as unacknowledged, and already-expunged messages are not restored.


A timestamp is in RFC3339 UTC Zulu format, with nanosecond resolution and up to nine fractional digits, such as 2014-10-02T15:01:23Z and 2014-10-02T15:01:23.045123456Z.

Reconnection Strategy

Retry strategy in case of connectivity errors.

### For Configurations - [Configuration](#Config) ### Throws - PUBSUB:BAD\_GATEWAY - PUBSUB:CANCELLED - PUBSUB:CONNECTIVITY - PUBSUB:DEADLINE\_EXCEEDED - PUBSUB:FAILED\_PRECONDITION - PUBSUB:INTERNAL - PUBSUB:INVALID\_ARGUMENT - PUBSUB:NOT\_FOUND - PUBSUB:PERMISSION\_DENIED - PUBSUB:RETRY\_EXHAUSTED - PUBSUB:UNAVAILABLE ## Sources ## On message listener `` Asynchronous message listener that consumes messages from one subscriber. ### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Consumer count

Number

Provides a specified amount of executor service for processing messages.

5

Acknowledgment Mode

Enumeration, one of:

  • AUTO

  • MANUAL

Acknowledgment mode for message processing:

  • AUTO

    Messages are automatically acknowledged on success and NACKed on error.

  • MANUAL

    Messages must be explicitly acknowledged using the Acknowledge Message operation.

AUTO

Config Ref

ConfigurationProvider

Name of the configuration used to execute this component.

x

Primary Node Only

Boolean

Determines whether to execute this source on only the primary node when running Mule instances in a cluster.

On Capacity Overload

Enumeration, one of:

  • WAIT

  • DROP

  • FAIL

Strategy that the runtime applies when the flow receives more messages than it has the capacity to handle.

WAIT

Streaming Strategy

Configures how Mule processes streams. The default is to use repeatable streams.

Redelivery Policy

Defines a policy for processing the redelivery of the same message.

Project ID

String

Globally unique identifier for your project.

Subscription Name

String

Project-wide unique identifier for the subscription.

Limit Exceeded Behavior

Enumeration, one of:

  • THROW_EXCEPTION

  • BLOCK

  • IGNORE

If not set to IGNORE, flow control enables you to control the publishing behavior by specifying limits for Max Outstanding Request Size and Max Outstanding Element Count.

  • THROW_EXCEPTION

    If the memory size or the amount of outstanding elements (messages where no Ack() or Nack() was performed) exceeds the specified limits, the receiver throws a FlowControlException.

  • BLOCK

    If the memory size or the amount of outstanding elements (messages where no Ack() or Nack() was performed) exceeds the specified limits, the receiver does not receive more messages.

  • IGNORE

    The receiver does not account for specified limits and does not control the message delivery rate.

Max Outstanding Request Size

Number

Maximum amount of memory accumulated by the request before enforcing flow control.

100

Max Outstanding Request Size Unit

Enumeration, one of:

  • BYTE

  • KB

  • MB

  • GB

Data unit for the Max Outstanding Request Size field.

MB

Max Outstanding Element Count

Number

Maximum number of outstanding elements to keep in the memory before enforcing flow control.

100

Reconnection Strategy

Retry strategy in case of connectivity errors.

### Output

Type

Any

Attributes Type

Object

### For Configurations - [Configuration](#Config) ## Types ### Wif MuleSoft Idp Config Configuration for **Workload Identity Federation with MuleSoft IdP** authentication.
FieldTypeDescriptionDefault ValueRequired

WIF Config File Path

String

Path to the WIF configuration file. If provided, other fields are populated from this file.

x

Token Endpoint

String

Anypoint OAuth2 token endpoint for this deployment. Set it for each environment when the app uses a control plane other than the US control plane. If you leave this field blank, the connector uses https://anypoint.mulesoft.com/accounts/api/v2/oauth2/token. For EU1, set https://eu1.anypoint.mulesoft.com/accounts/api/v2/oauth2/token. In XML, set tokenEndpoint on pubsub:mule-soft-idp-config. If the value is not an HTTPS URL with a host, token exchange fails with Token Endpoint must be an https URL.

Client ID

String

Client ID of the MuleSoft Connected App. This identifies the application requesting authentication.

x

Client Secret

String

Client secret of the MuleSoft Connected App. This is used to authenticate the application with MuleSoft.

x

### Reconnection Configures a reconnection strategy for an operation.
FieldTypeDescriptionDefault ValueRequired

Fails Deployment

Boolean

What to do if, when an app is deployed, a connectivity test does not pass after exhausting the associated reconnection strategy:

  • true

    Allow the deployment to fail.

  • false

    Ignore the results of the connectivity test.

Reconnection Strategy

Reconnection strategy to use.

### Reconnect Configures a standard reconnection strategy, which specifies how often to reconnect and how many reconnection attempts the connector source or operation can make.
FieldTypeDescriptionDefault ValueRequired

Frequency

Number

How often to attempt to reconnect, in milliseconds.

Blocking

Boolean

If false, the reconnection strategy will run in a separate, non-blocking thread.

Count

Number

How many reconnection attempts the Mule app can make.

### Reconnect Forever Configures a forever reconnection strategy by which the connector source or operation attempts to reconnect at a specified frequency for as long as the Mule app runs.
FieldTypeDescriptionDefault ValueRequired

Frequency

Number

How often to attempt to reconnect, in milliseconds.

Blocking

Boolean

If false, the reconnection strategy will run in a separate, non-blocking thread.

### Expiration Policy
FieldTypeDescriptionDefault ValueRequired

Max Idle Time

Number

Configures the maximum amount of time that a dynamic configuration instance can remain idle before Mule considers it eligible for expiration.

Time Unit

Enumeration, one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

Time unit for the Max Idle Time field.

### Repeatable In Memory Stream Configures the in-memory streaming strategy by which the request fails if the data exceeds the MAX buffer size. Always run performance tests to find the optimal buffer size for your specific use case.
FieldTypeDescriptionDefault ValueRequired

Initial Buffer Size

Number

Initial amount of memory to allocate to the data stream. If the streamed data exceeds this value, the buffer expands by Buffer Size Increment, with an upper limit of Max In Memory Size value.

Buffer Size Increment

Number

Amount by which the buffer size expands if it exceeds its initial size. Setting a value of 0 or lower specifies that the buffer can’t expand.

Max Buffer Size

Number

Maximum size of the buffer. If the buffer size exceeds this value, Mule raises a STREAM_MAXIMUM_SIZE_EXCEEDED error. A value of less than or equal to 0 means no limit.

Buffer Unit

Enumeration, one of:

  • BYTE

  • KB

  • MB

  • GB

Unit for the Initial Buffer Size, Buffer Size Increment, and Buffer Unit fields.

### Repeatable File Store Stream Configures the repeatable file-store streaming strategy by which Mule keeps a portion of the stream content in memory. If the stream content is larger than the configured buffer size, Mule backs up the buffer’s content to disk and then clears the memory.
FieldTypeDescriptionDefault ValueRequired

In Memory Size

Number

Maximum amount of memory that the stream can use for data. If the amount of memory exceeds this value, Mule buffers the content to disk. To optimize performance:

  • Configure a larger buffer size to avoid the number of times Mule needs to write the buffer on disk. This increases performance, but it also limits the number of concurrent requests your application can process, because it requires additional memory.

  • Configure a smaller buffer size to decrease memory load at the expense of response time.

Buffer Unit

Enumeration, one of:

  • BYTE

  • KB

  • MB

  • GB

Unit for the In Memory Size field.

### Redelivery Policy Configures the redelivery policy for executing requests that generate errors. You can add a redelivery policy to any source in a flow.
FieldTypeDescriptionDefault ValueRequired

Max Redelivery Count

Number

Maximum number of times that a redelivered request can be processed unsuccessfully before returning a REDELIVERY_EXHAUSTED error.

Message Digest Algorithm

String

Secure hashing algorithm to use if the Use Secure Hash field is true. If the payload of the message is a Java object, Mule ignores this value and returns the value that the payload’s hashCode() returned.

Message Identifier

Defines which strategy is used to identify the messages.

Object Store

ObjectStore

Configures the object store that stores the redelivery counter for each message.

### Redelivery Policy Message Identifier Configures how to identify a redelivered message and how to find out when the message was redelivered.
FieldTypeDescriptionDefault ValueRequired

Use Secure Hash

Boolean

If true, Mule uses a secure hash algorithm to identify a redelivered message.

Id Expression

String

One or more expressions that determine when a message was redelivered. You can set this property only if the Use Secure Hash field is false.

### Snapshot Snapshot resource. You can use snapshots in seek operations, which manage message acknowledgments in bulk. This type enables you to set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot.
FieldTypeDescriptionDefault ValueRequired

Expire Time

DateTime

Time length for which the snapshot is guaranteed to exist. The lifetime for a newly-created snapshot is based on the oldest unacked message in the source subscription’s backlog, however, the snapshot can exist for a maximum of seven days.


Consider a subscription with an oldest unacked message that is three days old. If a snapshot is created from this subscription, the snapshot will expire in four days. The service will refuse to create a snapshot that will expire in less than one hour after creation.


A timestamp is in RFC3339 UTC Zulu format, with nanosecond resolution and up to nine fractional digits, such as 2014-10-02T15:01:23Z and 2014-10-02T15:01:23.045123456Z.

Labels

Any

Object containing a list of key-value pairs, such as { "name": "wrench", "mass": "1.3kg", "count": "3" }.

Name

String

Name of the snapshot.

Topic

String

Name of the topic from which the snapshot retains messages.

### Repeatable In Memory Iterable
FieldTypeDescriptionDefault ValueRequired

Initial Buffer Size

Number

The number of instances to initially keep in memory to consume the stream and provide random access to it. If the stream contains more data than can fit into this buffer, then the buffer expands according to the Buffer Size Increment field, with an upper limit of Max In Memory Size.

100

Buffer Size Increment

Number

This is by how much the buffer size expands if it exceeds its initial size. Setting a value of zero or lower means that the buffer should not expand, meaning that a STREAM_MAXIMUM_SIZE_EXCEEDED error is raised when the buffer gets full.

100

Max Buffer Size

Number

The maximum amount of memory to use. If more than that is used then a STREAM_MAXIMUM_SIZE_EXCEEDED error is raised. A value lower than or equal to zero means no limit.

### Repeatable File Store Iterable
FieldTypeDescriptionDefault ValueRequired

In Memory Objects

Number

The maximum amount of instances to keep in memory. If more than that is required, content on the disk is buffered.

Buffer Unit

Enumeration, one of:

  • BYTE

  • KB

  • MB

  • GB

Unit for the In Memory Objects field.

## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Salesforce Help](https://help.salesforce.com) --- product: Google Pub/Sub Connector version: 1.3 is-latest-version: true --- # Google Pub/Sub Connector 1.3 XML and Maven Support > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Although you can manually code a Mule app in XML, it is more efficient to use Anypoint Studio: - If you manually code a Mule runtime engine (Mule) app in XML, either from the Anypoint Studio XML editor or from a text editor, you can access the connector from your app by adding reference statements to both your XML Mule flow and the Apache Maven `pom.xml` file. - If you add the connector in Studio, Studio automatically populates the XML code with the connector’s namespace and schema location and it also adds a dependency to the `pom.xml` file. ## Add a Namespace for the Connector Paste the following code inside the `` tag of the header of your configuration XML: ```xml http://www.mulesoft.org/schema/mule/google-pubsub http://www.mulesoft.org/schema/mule/google-pubsub/current/mule-google-pubsub.xsd ``` This example shows how the namespace statements are placed in the XML block: ```xml ``` ## Add a POM File Dependency The Apache Maven `pom.xml` file generated by Anypoint Studio contains dependencies for a Mule app. When you code a Mule app manually, include this XML snippet in your `pom.xml` file to enable access to this connector: ```xml com.mulesoft.connectors mule4-google-pubsub-connector x.x.x mule-plugin ``` Replace `x.x.x` with the version that corresponds to the connector you are using. To obtain the most up-to-date `pom.xml` file information: 1. Go to [Anypoint Exchange](https://www.mulesoft.com/exchange/). 2. In Exchange, click **Login** and supply your Anypoint Platform username and password. 3. In Exchange, search for `google-pubsub`. 4. Select the connector. 5. Click **Dependency Snippets** near the upper right of the screen. ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Salesforce Help](https://help.salesforce.com) --- product: Google Pub/Sub Connector version: 1.0 --- # Using Anypoint Studio to Configure Google Pub/Sub Connector 1.0 > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Anypoint Studio (Studio) editors help you design and update your Mule applications, properties, and configuration files. To add and configure a connector in Studio: 1. [Create a Mule project](#create-mule-project). 2. [Add the connector to your Mule project](#add-connector-to-project). 3. [Configure a source for the connector’s flow](#configure-input-source). 4. [Add a connector operation to the flow](#add-connector-operation). 5. [Configure a global element for the connector](#configure-global-element). 6. [Configure the other connector fields](#configure-other-fields). When you run the connector, you can view the app log to check for problems in real time, as described in [View the App Log](#view-app-log). If you are new to configuring connectors in Studio, see [Using Anypoint Studio to Configure a Connector](https://docs.mulesoft.com/connectors/introduction/intro-config-use-studio). If, after reading this topic, you need additional information about the connector fields, refer to the [Google Pub/Sub Connector Reference](https://docs.mulesoft.com/google-pubsub-connector/1.0/google-pubsub-connector-reference). ## Create a Mule Project In Studio, create a new Mule project in which to add and configure the connector: 1. In Studio, select **File > New > Mule Project**. 2. Enter a name for your Mule project and click **Finish**. ## Add the Connector to Your Mule Project Add Anypoint Connector for Google Pub/Sub (Google Pub/Sub Connector) to your Mule project to automatically populate the XML code with the connector’s namespace and schema location and add the required dependencies to the project’s `pom.xml` file: 1. In the **Mule Palette** view, click **(X) Search in Exchange**. 2. In the **Add Dependencies to Project** window, type `google pubsub` in the search field. 3. Click **Google Pub/Sub Connector** in **Available modules**. 4. Click **Add**. 5. Click **Finish**. Adding a connector to a Mule project in Studio does not make that connector available to other projects in your Studio workspace. ## Configure a Source A source initiates a flow when a specified condition is met. You can configure one of these sources to use with Google Pub/Sub Connector: - HTTP Listener Initiates a flow each time it receives a request on the configured host and port - Scheduler Initiates a flow when a time-based condition is met For example, to configure an HTTP Listener source, follow these steps: 1. In the **Mule Palette** view, select **HTTP > Listener**. 2. Drag **Listener** to the Studio canvas. 3. On the **Listener** configuration screen, optionally change the value of the **Display Name** field. 4. Specify a value for the **Path** field. 5. Click the plus sign (**+**) next to the **Connector configuration** field to configure a global element that can be used by all instances of the HTTP Listener source in the app. 6. On the **General** tab, specify the connection information for the connector. 7. On the **TLS** tab, optionally specify the TLS information for the connector. 8. On the **Advanced** tab, optionally specify reconnection information, including a reconnection strategy. 9. Click **Test Connection** to confirm that Mule can connect with the specified server. 10. Click **OK**. ## Add a Connector Operation to the Flow When you add a connector operation to your flow, you are specifying an action for that connector to perform. To add an operation for Google Pub/Sub Connector, follow these steps: 1. In the **Mule Palette** view, select **Google Pub/Sub** and then select the desired operation. 2. Drag the operation onto the Studio canvas to the right of the source. ## Configure a Global Element for the Connector When you configure a connector, configure a global element that all instances of that connector in the app can use. Configuring a global element requires you to provide the authentication credentials that the connector requires to access the target Google Pub/Sub system. Google Pub/Sub Connector supports the PubSub Connection authentication method. To configure the global element for Google Pub/Sub Connector, follow these steps: 1. Select the operation in the Studio canvas. 2. In the configuration screen for the operation, click the plus sign (**+**) next to the **Connector configuration** field to access the global element configuration fields. 3. On the **General** tab, in **Connection**, select the [PubSub Connection](#pubsub) authentication method to configure. You can reference a configuration file that contains ANT-style property placeholders (recommended), or you can enter your authorization credentials in the global configuration properties. For information about the benefits of using property placeholders and how to configure them, refer to [Anypoint Connector Configuration](https://docs.mulesoft.com/connectors/introduction/intro-connector-configuration-overview). 4. On the **Advanced** tab, optionally specify reconnection information, including a reconnection strategy. 5. Click **Test Connection** to confirm that Mule can connect with the specified server. 6. Click **OK**. ### PubSub Connection Enter the following information on the **General** tab of the **Global Element Properties** screen to configure a PubSub Connection. The field values in this tab are part of the service credentials created in PubSub.
FieldUser Action

Name

Enter the configuration name.

Private key ID

ID of the private key for the service account.

Client ID

ID of the client for the service account.

Client email

Client email for the service account.

Private key

Private key for the service account.

## Configure Additional Connector Fields After you configure a global element for Google Pub/Sub Connector, configure the other required fields for the connector. The required fields vary depending on which connector operation you use. ## View the App Log To check for problems, you can view the app log as follows: - If you’re running the app from Anypoint Platform, the app log output is visible in the Anypoint Studio console window. - If you’re running the app using Mule from the command line, the app log output is visible in your OS console. Unless the log file path is customized in the app’s log file (`log4j2.xml`), you can also view the app log in the default location `MULE_HOME/logs/.log`. ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Using Anypoint Studio to Configure a Connector](https://docs.mulesoft.com/connectors/introduction/intro-config-use-studio) - [Google Pub/Sub Connector Reference](https://docs.mulesoft.com/google-pubsub-connector/1.0/google-pubsub-connector-reference) - [Salesforce Help](https://help.salesforce.com) --- product: Google Pub/Sub Connector version: 1.1 --- # Using Anypoint Studio to Configure Google Pub/Sub Connector 1.1 > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Anypoint Studio (Studio) editors help you design and update your Mule applications, properties, and configuration files. To add and configure a connector in Studio: 1. [Create a Mule project](#create-mule-project). 2. [Add the connector to your Mule project](#add-connector-to-project). 3. [Configure a source for the connector’s flow](#configure-input-source). 4. [Add a connector operation to the flow](#add-connector-operation). 5. [Configure a global element for the connector](#configure-global-element). 6. [Configure the other connector fields](#configure-other-fields). When you run the connector, you can view the app log to check for problems in real time, as described in [View the App Log](#view-app-log). If you are new to configuring connectors in Studio, see [Using Anypoint Studio to Configure a Connector](https://docs.mulesoft.com/connectors/introduction/intro-config-use-studio). If, after reading this topic, you need additional information about the connector fields, refer to the [Google Pub/Sub Connector Reference](https://docs.mulesoft.com/google-pubsub-connector/1.1/google-pubsub-connector-reference). ## Create a Mule Project In Studio, create a new Mule project in which to add and configure the connector: 1. In Studio, select **File > New > Mule Project**. 2. Enter a name for your Mule project and click **Finish**. ## Add the Connector to Your Mule Project Add Anypoint Connector for Google Pub/Sub (Google Pub/Sub Connector) to your Mule project to automatically populate the XML code with the connector’s namespace and schema location and add the required dependencies to the project’s `pom.xml` file: 1. In the **Mule Palette** view, click **(X) Search in Exchange**. 2. In the **Add Dependencies to Project** window, type `google pubsub` in the search field. 3. Click **Google Pub/Sub Connector** in **Available modules**. 4. Click **Add**. 5. Click **Finish**. Adding a connector to a Mule project in Studio does not make that connector available to other projects in your Studio workspace. ## Configure a Source A source initiates a flow when a specified condition is met. You can configure one of these sources to use with Google Pub/Sub Connector: - HTTP Listener Initiates a flow each time it receives a request on the configured host and port - Scheduler Initiates a flow when a time-based condition is met For example, to configure an HTTP Listener source, follow these steps: 1. In the **Mule Palette** view, select **HTTP > Listener**. 2. Drag **Listener** to the Studio canvas. 3. On the **Listener** configuration screen, optionally change the value of the **Display Name** field. 4. Specify a value for the **Path** field. 5. Click the plus sign (**+**) next to the **Connector configuration** field to configure a global element that can be used by all instances of the HTTP Listener source in the app. 6. On the **General** tab, specify the connection information for the connector. 7. On the **TLS** tab, optionally specify the TLS information for the connector. 8. On the **Advanced** tab, optionally specify reconnection information, including a reconnection strategy. 9. Click **Test Connection** to confirm that Mule can connect with the specified server. 10. Click **OK**. ## Add a Connector Operation to the Flow When you add a connector operation to your flow, you are specifying an action for that connector to perform. To add an operation for Google Pub/Sub Connector, follow these steps: 1. In the **Mule Palette** view, select **Google Pub/Sub** and then select the desired operation. 2. Drag the operation onto the Studio canvas to the right of the source. ## Configure a Global Element for the Connector When you configure a connector, configure a global element that all instances of that connector in the app can use. Configuring a global element requires you to provide the authentication credentials that the connector requires to access the target Google Pub/Sub system. Google Pub/Sub Connector supports the PubSub Connection authentication method. To configure the global element for Google Pub/Sub Connector, follow these steps: 1. Select the operation in the Studio canvas. 2. In the configuration screen for the operation, click the plus sign (**+**) next to the **Connector configuration** field to access the global element configuration fields. 3. On the **General** tab, in **Connection**, select the [PubSub Connection](#pubsub) authentication method to configure. You can reference a configuration file that contains ANT-style property placeholders (recommended), or you can enter your authorization credentials in the global configuration properties. For information about the benefits of using property placeholders and how to configure them, refer to [Anypoint Connector Configuration](https://docs.mulesoft.com/connectors/introduction/intro-connector-configuration-overview). 4. On the **Advanced** tab, optionally specify reconnection information, including a reconnection strategy. 5. Click **Test Connection** to confirm that Mule can connect with the specified server. 6. Click **OK**. ### PubSub Connection Enter the following information on the **General** tab of the **Global Element Properties** screen to configure a PubSub Connection. The field values in this tab are part of the service credentials created in PubSub.
FieldUser Action

Name

Enter the configuration name.

Private key ID

ID of the private key for the service account.

Client ID

ID of the client for the service account.

Client email

Client email for the service account.

Private key

Private key for the service account.

## Configure Additional Connector Fields After you configure a global element for Google Pub/Sub Connector, configure the other required fields for the connector. The required fields vary depending on which connector operation you use. ## View the App Log To check for problems, you can view the app log as follows: - If you’re running the app from Anypoint Platform, the app log output is visible in the Anypoint Studio console window. - If you’re running the app using Mule from the command line, the app log output is visible in your OS console. Unless the log file path is customized in the app’s log file (`log4j2.xml`), you can also view the app log in the default location `MULE_HOME/logs/.log`. ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Using Anypoint Studio to Configure a Connector](https://docs.mulesoft.com/connectors/introduction/intro-config-use-studio) - [Google Pub/Sub Connector Reference](https://docs.mulesoft.com/google-pubsub-connector/1.1/google-pubsub-connector-reference) - [Salesforce Help](https://help.salesforce.com) --- product: Google Pub/Sub Connector version: 1.2 --- # Using Anypoint Studio to Configure Google Pub/Sub Connector 1.2 > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Anypoint Studio (Studio) editors help you design and update your Mule applications, properties, and configuration files. To add and configure a connector in Studio: 1. [Create a Mule project](#create-mule-project). 2. [Add the connector to your Mule project](#add-connector-to-project). 3. [Configure a source for the connector’s flow](#configure-input-source). 4. [Add a connector operation to the flow](#add-connector-operation). 5. [Configure a global element for the connector](#configure-global-element). 6. [Configure the other connector fields](#configure-other-fields). When you run the connector, you can view the app log to check for problems in real time, as described in [View the App Log](#view-app-log). If you are new to configuring connectors in Studio, see [Using Anypoint Studio to Configure a Connector](https://docs.mulesoft.com/connectors/introduction/intro-config-use-studio). If, after reading this topic, you need additional information about the connector fields, refer to the [Google Pub/Sub Connector Reference](https://docs.mulesoft.com/google-pubsub-connector/1.2/google-pubsub-connector-reference). ## Create a Mule Project In Studio, create a new Mule project in which to add and configure the connector: 1. In Studio, select **File > New > Mule Project**. 2. Enter a name for your Mule project and click **Finish**. ## Add the Connector to Your Mule Project Add Anypoint Connector for Google Pub/Sub (Google Pub/Sub Connector) to your Mule project to automatically populate the XML code with the connector’s namespace and schema location and add the required dependencies to the project’s `pom.xml` file: 1. In the **Mule Palette** view, click **(X) Search in Exchange**. 2. In the **Add Dependencies to Project** window, type `google pubsub` in the search field. 3. Click **Google Pub/Sub Connector** in **Available modules**. 4. Click **Add**. 5. Click **Finish**. Adding a connector to a Mule project in Studio does not make that connector available to other projects in your Studio workspace. ## Configure a Source A source initiates a flow when a specified condition is met. You can configure one of these sources to use with Google Pub/Sub Connector: - HTTP Listener Initiates a flow each time it receives a request on the configured host and port - Scheduler Initiates a flow when a time-based condition is met For example, to configure an HTTP Listener source, follow these steps: 1. In the **Mule Palette** view, select **HTTP > Listener**. 2. Drag **Listener** to the Studio canvas. 3. On the **Listener** configuration screen, optionally change the value of the **Display Name** field. 4. Specify a value for the **Path** field. 5. Click the plus sign (**+**) next to the **Connector configuration** field to configure a global element that can be used by all instances of the HTTP Listener source in the app. 6. On the **General** tab, specify the connection information for the connector. 7. On the **TLS** tab, optionally specify the TLS information for the connector. 8. On the **Advanced** tab, optionally specify reconnection information, including a reconnection strategy. 9. Click **Test Connection** to confirm that Mule can connect with the specified server. 10. Click **OK**. ## Add a Connector Operation to the Flow When you add a connector operation to your flow, you are specifying an action for that connector to perform. To add an operation for Google Pub/Sub Connector, follow these steps: 1. In the **Mule Palette** view, select **Google Pub/Sub** and then select the desired operation. 2. Drag the operation onto the Studio canvas to the right of the source. ## Configure a Global Element for the Connector When you configure a connector, configure a global element that all instances of that connector in the app can use. Configuring a global element requires you to provide the authentication credentials that the connector requires to access the target Google Pub/Sub system. Google Pub/Sub Connector supports the PubSub Connection authentication method. To configure the global element for Google Pub/Sub Connector, follow these steps: 1. Select the operation in the Studio canvas. 2. In the configuration screen for the operation, click the plus sign (**+**) next to the **Connector configuration** field to access the global element configuration fields. 3. On the **General** tab, in **Connection**, select the [PubSub Connection](#pubsub) authentication method to configure. You can reference a configuration file that contains ANT-style property placeholders (recommended), or you can enter your authorization credentials in the global configuration properties. For information about the benefits of using property placeholders and how to configure them, refer to [Anypoint Connector Configuration](https://docs.mulesoft.com/connectors/introduction/intro-connector-configuration-overview). 4. On the **Advanced** tab, optionally specify reconnection information, including a reconnection strategy. 5. Click **Test Connection** to confirm that Mule can connect with the specified server. 6. Click **OK**. ### PubSub Connection Enter the following information on the **General** tab of the **Global Element Properties** screen to configure a PubSub Connection. The field values in this tab are part of the service credentials created in PubSub.
FieldUser Action

Name

Enter the configuration name.

Private key ID

ID of the private key for the service account.

Client ID

ID of the client for the service account.

Client email

Client email for the service account.

Private key

Private key for the service account.

## Configure Additional Connector Fields After you configure a global element for Google Pub/Sub Connector, configure the other required fields for the connector. The required fields vary depending on which connector operation you use. ## View the App Log To check for problems, you can view the app log as follows: - If you’re running the app from Anypoint Platform, the app log output is visible in the Anypoint Studio console window. - If you’re running the app using Mule from the command line, the app log output is visible in your OS console. Unless the log file path is customized in the app’s log file (`log4j2.xml`), you can also view the app log in the default location `MULE_HOME/logs/.log`. ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Using Anypoint Studio to Configure a Connector](https://docs.mulesoft.com/connectors/introduction/intro-config-use-studio) - [Google Pub/Sub Connector Reference](https://docs.mulesoft.com/google-pubsub-connector/1.2/google-pubsub-connector-reference) - [Salesforce Help](https://help.salesforce.com) --- product: Google Pub/Sub Connector version: 1.3 is-latest-version: true --- # Using Anypoint Studio to Configure Google Pub/Sub Connector 1.3 > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Anypoint Studio (Studio) editors help you design and update your Mule applications, properties, and configuration files. To add and configure a connector in Studio: 1. [Create a Mule project](#create-mule-project). 2. [Add the connector to your Mule project](#add-connector-to-project). 3. [Configure a source for the connector’s flow](#configure-input-source). 4. [Add a connector operation to the flow](#add-connector-operation). 5. [Configure a global element for the connector](#configure-global-element). 6. [Configure the other connector fields](#configure-other-fields). When you run the connector, you can view the app log to check for problems in real time, as described in [View the App Log](#view-app-log). If you are new to configuring connectors in Studio, see [Using Anypoint Studio to Configure a Connector](https://docs.mulesoft.com/connectors/introduction/intro-config-use-studio). If, after reading this topic, you need additional information about the connector fields, refer to the [Google Pub/Sub Connector Reference](https://docs.mulesoft.com/google-pubsub-connector/latest/google-pubsub-connector-reference). ## Create a Mule Project In Studio, create a new Mule project in which to add and configure the connector: 1. In Studio, select **File > New > Mule Project**. 2. Enter a name for your Mule project and click **Finish**. ## Add the Connector to Your Mule Project Add Anypoint Connector for Google Pub/Sub (Google Pub/Sub Connector) to your Mule project to automatically populate the XML code with the connector’s namespace and schema location and add the required dependencies to the project’s `pom.xml` file: 1. In the **Mule Palette** view, click **(X) Search in Exchange**. 2. In the **Add Dependencies to Project** window, type `google pubsub` in the search field. 3. Click **Google Pub/Sub Connector** in **Available modules**. 4. Click **Add**. 5. Click **Finish**. Adding a connector to a Mule project in Studio does not make that connector available to other projects in your Studio workspace. ## Configure a Source A source initiates a flow when a specified condition is met. You can configure one of these sources to use with Google Pub/Sub Connector: - HTTP Listener Initiates a flow each time it receives a request on the configured host and port - Scheduler Initiates a flow when a time-based condition is met For example, to configure an HTTP Listener source, follow these steps: 1. In the **Mule Palette** view, select **HTTP > Listener**. 2. Drag **Listener** to the Studio canvas. 3. On the **Listener** configuration screen, optionally change the value of the **Display Name** field. 4. Specify a value for the **Path** field. 5. Click the plus sign (**+**) next to the **Connector configuration** field to configure a global element that can be used by all instances of the HTTP Listener source in the app. 6. On the **General** tab, specify the connection information for the connector. 7. On the **TLS** tab, optionally specify the TLS information for the connector. 8. On the **Advanced** tab, optionally specify reconnection information, including a reconnection strategy. 9. Click **Test Connection** to confirm that Mule can connect with the specified server. 10. Click **OK**. ## Add a Connector Operation to the Flow When you add a connector operation to your flow, you are specifying an action for that connector to perform. To add an operation for Google Pub/Sub Connector, follow these steps: 1. In the **Mule Palette** view, select **Google Pub/Sub** and then select the desired operation. 2. Drag the operation onto the Studio canvas to the right of the source. ## Configure a Global Element for the Connector When you configure a connector, configure a global element that all instances of that connector in the app can use. Configuring a global element requires you to provide the authentication credentials that the connector requires to access the target Google Pub/Sub system. Google Pub/Sub Connector supports the PubSub Connection authentication method. To configure the global element for Google Pub/Sub Connector, follow these steps: 1. Select the operation in the Studio canvas. 2. In the configuration screen for the operation, click the plus sign (**+**) next to the **Connector configuration** field to access the global element configuration fields. 3. On the **General** tab, in **Connection**, select the [PubSub Connection](#pubsub) authentication method to configure. You can reference a configuration file that contains ANT-style property placeholders (recommended), or you can enter your authorization credentials in the global configuration properties. For information about the benefits of using property placeholders and how to configure them, refer to [Anypoint Connector Configuration](https://docs.mulesoft.com/connectors/introduction/intro-connector-configuration-overview). 4. On the **Advanced** tab, optionally specify reconnection information, including a reconnection strategy. 5. Click **Test Connection** to confirm that Mule can connect with the specified server. 6. Click **OK**. ### PubSub Connection Enter the following information on the **General** tab of the **Global Element Properties** screen to configure a PubSub Connection. The field values in this tab are part of the service credentials created in PubSub.
FieldUser Action

Name

Enter the configuration name.

Private key id

ID of the private key for the service account.

Client id

ID of the client for the service account.

Client email

Client email for the service account.

Private key

Private key for the service account.

If **Authentication Method** is **Workload Identity Federation with MuleSoft IdP**, you can set **Token Endpoint** on **MuleSoft IdP Configuration**. If you leave **Token Endpoint** blank, the connector uses `https://anypoint.mulesoft.com/accounts/api/v2/oauth2/token`. For EU1, set `https://eu1.anypoint.mulesoft.com/accounts/api/v2/oauth2/token`. For field details, see [Wif MuleSoft Idp Config](https://docs.mulesoft.com/google-pubsub-connector/latest/google-pubsub-connector-reference#WifMuleSoftIdpConfig). ## Configure Additional Connector Fields After you configure a global element for Google Pub/Sub Connector, configure the other required fields for the connector. The required fields vary depending on which connector operation you use. ## View the App Log To check for problems, you can view the app log as follows: - If you’re running the app from Anypoint Platform, the app log output is visible in the Anypoint Studio console window. - If you’re running the app using Mule from the command line, the app log output is visible in your OS console. Unless the log file path is customized in the app’s log file (`log4j2.xml`), you can also view the app log in the default location `MULE_HOME/logs/.log`. ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Using Anypoint Studio to Configure a Connector](https://docs.mulesoft.com/connectors/introduction/intro-config-use-studio) - [Google Pub/Sub Connector Reference](https://docs.mulesoft.com/google-pubsub-connector/latest/google-pubsub-connector-reference) - [Salesforce Help](https://help.salesforce.com)