blob: 6528ca7f6dd2e73566a74af922d512664a5c9012 [file] [log] [blame]
# Camel Google Pubsub example
### Introduction
An example which shows how to integrate Camel with Google Pubsub.
### Preparing Google Pubsub
This example requires a Google Cloud Account with a Pubsub subscription.
To create a Goolge Cloud account please visit
To setup Pubsub subscription see
A topic and subscription need to be created and the topic and subscription name
set in the
The topic and subscription (with names as configured in can be created within the
Google Cloud Console or by running:
mvn compile exec:java -Ppubsub-create-topic-subscription
In the you need to specify the
For authenticating against Google Cloud one of the following options can be used:
Using your default credentials::
Comment out `credentials.fileLocation`, `credentials.account` and `credentials.key`
Using a json service account credentials file::
Set `credentials.fileLocation` to the location of the json credentials file.
Comment out `credentials.account` and `credentials.key`
Using an account and key::
Set `credentials.account` to the service account email and `credentials.key` to the service account key.
### Run
Run the consumer and producer in separate shells:
mvn compile exec:java -Ppubsub-producer
mvn compile exec:java -Ppubsub-consumer
Initially, some messages are sent programmatically.
On the command prompt for the producer, type the messages. Each line is sent as one message to Google Pubsub.
Press `Ctrl-C` to exit.
As the pubsub channel is persistent the consumer and producer do not need to run at the same time.
Messages can be send from the Google Pubsub console which will be picked up by the consumer.
### Configuration
You can configure the details in the file:
You can enable verbose logging by adjusting the `src/main/resources/`
file as documented in the file.
### Forum, Help, etc
If you hit an problems please let us know on the Camel Forums
Please help us make Apache Camel better - we appreciate any feedback you may
have. Enjoy!
The Camel riders!