Note
GCP PubSub now supports async subscription. I recommend using that instead of this.
longsub is a small wrapper package for lengthy subscriptions for both AWS SQS and GCP Pub/Sub. It will setup the subscription and attempts to extend the processing window at message level until the processing is done, or failed, or requeued. Useful if you want to keep the queue timeout relatively short (for quick message redelivery) but have the option for subscribers to go beyond the timeout (without redelivery) to process each of the messages.
Important
v2 changed the GCP callback arguments from []byte in v1 to CallbackArgs to include the Attributes map.
Check out the examples provided for reference on how to use the package.
For AWS, the following environment variables will be used.
# Required
AWS_REGION
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
# Optional. If non-empty, longsub will attempt to
# assume this role using the key/secret above.
ROLE_ARNFor GCP, either the following environment variable:
GOOGLE_APPLICATION_CREDENTIALS=/path/to/svcacct.jsonor Pub/Sub access from the runtime environment (for ex., GCE, Workload Identity Federation, etc.) is required.
This library is licensed under the MIT License.