Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latest container missing dead letter topic feature #12

Open
teije01 opened this issue Mar 23, 2021 · 2 comments
Open

Latest container missing dead letter topic feature #12

teije01 opened this issue Mar 23, 2021 · 2 comments

Comments

@teije01
Copy link

teije01 commented Mar 23, 2021

I have thankfully used the latest container to run our tests on. However, there was one feature that I was not able to use which was the support for dead letter topic.

Support for dead-letter-topics

Basically when following the example from google, one should be able to configure the subscriptions in a way that messages will be forwarded to a dead letter topic whenever a certain maximum number of attempts is reached.

from google.cloud import pubsub_v1

subscriber = pubsub_v1.SubscriberClient()
subscription_path = subscriber.subscription_path(project_id, subscription_id)

def callback(message):
    print(f"Received {message}.")
    print(f"With delivery attempts: {message.delivery_attempt}.")    # Delivery attempt should be an integer when a dead letter topic is set
    message.ack()

streaming_pull_future = subscriber.subscribe(subscription_path, callback=callback)
print(f"Listening for messages on {subscription_path}..\n")

with subscriber:
    streaming_pull_future.result(timeout=timeout)

Delivery attempt is None, but never an integer

You should be able to receive a message with the delivery_attempt property set to an integer number (works only in case the dead-letter-topic is set). With the current container, the delivery_attempt property was always None, regardless of the settings I used.

Re-building the container fixed this issue

I decided to re-build the container with an up-to-date google SDK for testing, and indeed that solved the problem. I am not exactly sure which part(s) are not working for the dead-letter-topic feature in the current container, but it would be great if an updated (and tagged) container could be uploaded to docker hub. In the meantime I'll be using my own build for testing.

Thanks in advance

@sephirothmk
Copy link

Could you give me short instructions on how to rebuild the container with an up-to-date google SDK?

@teije01
Copy link
Author

teije01 commented Nov 3, 2021

You can follow the instructions from the readme:

building the container locally can be done using

docker build -t gcloud-pubsub-emulator:latest .

on a checked out version of the repository

I created one just now since we were due for an update:
https://hub.docker.com/r/tvanderhorst/gcloud-pubsub-emulator/tags

You can pull the most recent one using

docker pull tvanderhorst/gcloud-pubsub-emulator:sdk-363.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants