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

feat: add support for dead letter policies #2504

Merged
merged 5 commits into from
Jan 31, 2020
Merged

feat: add support for dead letter policies #2504

merged 5 commits into from
Jan 31, 2020

Conversation

jdpedrie
Copy link
Contributor

@jdpedrie jdpedrie commented Dec 5, 2019

I refactored the Grpc.php unit test file, the provider is too difficult to manage.

Closes #2571.

@jdpedrie jdpedrie added the api: pubsub Issues related to the Pub/Sub API. label Dec 5, 2019
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Dec 5, 2019
@jdpedrie
Copy link
Contributor Author

cc @pradn

@@ -70,6 +75,10 @@ class Message
*
* @type string $ackId The message ackId. This is only set when messages
* are pulled from the PubSub service.
* @type string $deliveryAttempt Delivery attempt counter is 1 + (the
* sum of number of NACKs and number of ack_deadline exceeds) for
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: extra space.

{
if ($client instanceof PubSubClientRest) {
$this->markTestSkipped(
'deadLetterPolicy not available in REST transport during experimental period.'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is when DLQ is alpha?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm unsure when the new feature will be published to the REST definition. We've had the same issue with ordering keys.

This comment was marked as resolved.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has this been actually resolved?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The latest version of the discovery document does not include dead letter queues: https://pubsub.googleapis.com/$discovery/rest?version=v1

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we notate this in the client?

@pradn
Copy link
Contributor

pradn commented Dec 12, 2019

Okay, did an initial review. Just small things. Looks good, overall.

@hongalex
Copy link
Member

@dwsupplee Can you help review this? Thanks!

@@ -70,6 +75,10 @@ class Message
*
* @type string $ackId The message ackId. This is only set when messages
* are pulled from the PubSub service.
* @type string $deliveryAttempt Delivery attempt counter is 1 + (the

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

int?

if (isset($subscription['deadLetterPolicy'])) {
if ($subscription['deadLetterPolicy']['deadLetterTopic'] instanceof Topic) {
$topic = $subscription['deadLetterPolicy']['deadLetterTopic'];
$subscription['deadLetterPolicy']['deadLetterTopic'] = $topic->name();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about maximum delivery attempts field?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No transformation is required to make the max delivery attempts field compatible with the API.

{
if ($client instanceof PubSubClientRest) {
$this->markTestSkipped(
'deadLetterPolicy not available in REST transport during experimental period.'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has this been actually resolved?

* will fail if the topic does not exist. Users should ensure that
* there is a subscription attached to this topic since messages
* published to a topic with no subscriptions are lost.
* @type int $deadLetterPolicy.maxDeliveryAttempts The maximum number of

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see maxDeliveryAttempts field being used in any tests. We should write some tests with custom maxDeliveryAttempts and some with default maxDeliveryAttempts (5).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added system test coverage.

PubSub/src/Message.php Outdated Show resolved Hide resolved
PubSub/src/Message.php Outdated Show resolved Hide resolved
PubSub/src/Message.php Outdated Show resolved Hide resolved
PubSub/src/Message.php Outdated Show resolved Hide resolved
@@ -87,6 +88,11 @@ public function testAckId()
$this->assertEquals(1234, $this->message->ackId());
}

public function testDeliveryAttempt()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add a unit test for null delivery attempt?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure thing! done.

{
if ($client instanceof PubSubClientRest) {
$this->markTestSkipped(
'deadLetterPolicy not available in REST transport during experimental period.'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we notate this in the client?

@jdpedrie jdpedrie merged commit 0f8bd09 into googleapis:master Jan 31, 2020
@jdpedrie jdpedrie deleted the pubsub-dlq branch January 31, 2020 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: pubsub Issues related to the Pub/Sub API. cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pubsub: add support for dead letter topics
6 participants