BroadwayCloudPubSub v0.1.3 BroadwayCloudPubSub.Producer View Source
A GenStage producer that continuously receives messages from a Google Cloud Pub/Sub queue and acknowledges them after being successfully processed.
Options using GoogleApiClient (Default)
:subscription
- Required. The name of the subscription. Example: "projects/my-project/subscriptions/my-subscription":max_number_of_messages
- Optional. The maximum number of messages to be fetched per request. Default is10
.:return_immediately
- Optional. If this field set to true, the system will respond immediately even if it there are no messages available to return in the Pull response. Otherwise, the system may wait (for a bounded amount of time) until at least one message is available, rather than returning no messages. Default isnil
.
Additional options
:rest_client
- Optional. A module that implements theBroadwayCloudPubSub.RestClient
behaviour. This module is responsible for fetching and acknowledging the messages. Pay attention that all options passed to the producer will be forwarded to the client. It's up to the client to normalize the options it needs. Default isGoogleApiClient
.:receive_interval
- Optional. The duration (in milliseconds) for which the producer waits before making a request for more messages. Default is 5000.
:token_module
- Optional. A module that implements theBroadwayCloudPubSub.Token
behaviour. This module is responsible for fetching an access token for Google Cloud Pub/Sub. Default isGothToken
.:scope
- Optional. A string representing the scope or scopes to use when fetching an access token. Default is"https://www.googleapis.com/auth/pubsub"
Example
Broadway.start_link(MyBroadway,
name: MyBroadway,
producers: [
default: [
module: {BroadwayCloudPubSub.Producer,
subscription: "projects/my-project/subscriptions/my_subscription"
}
]
]
)
The above configuration will set up a producer that continuously receives messages
from "projects/my-project/subscriptions/my_subscription"
and sends them downstream.
Link to this section Summary
Link to this section Functions
Link to this function