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

[SQS] add messageId to the sqsMessage #992

Merged
merged 7 commits into from
Jan 18, 2020

Conversation

BenoitLeveque
Copy link
Contributor

Hi,

I saw that we are not allowing user to access the messageId of a sqs message.

following the issue #837 i have added the messageId in the convertMessage method.

@@ -185,6 +185,10 @@ protected function convertMessage(array $sqsMessage): SqsMessage
{
$message = $this->context->createMessage();

if (isset($sqsMessage['MessageId'])) {
Copy link
Member

Choose a reason for hiding this comment

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

No need for if. As far as I can see the field is there all the time.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@makasim ok, i've update my code to remove the isset check and have also move the setMessage call to the end of the function, because the setHeader is overriding the message_id header value

Copy link
Member

Choose a reason for hiding this comment

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

The if is still there, isn't it? Should be removed as the MessageId is always there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oups, my bad i was sure to have pushed the deletion on this if

@BenoitLeveque BenoitLeveque force-pushed the improve-sqs-message-content branch 2 times, most recently from 7d7b76b to d6eb41a Compare December 4, 2019 13:42
@BenoitLeveque BenoitLeveque requested a review from makasim December 9, 2019 08:36
@BenoitLeveque
Copy link
Contributor Author

@makasim any news about this pull request ?

@BenoitLeveque BenoitLeveque force-pushed the improve-sqs-message-content branch from d6559f6 to f8a458d Compare January 7, 2020 10:31
@@ -337,7 +338,7 @@ public function testShouldReceiveMessage()

$this->assertInstanceOf(SqsMessage::class, $result);
$this->assertEquals('The Body', $result->getBody());
$this->assertEquals(['hkey' => 'hvalue'], $result->getHeaders());
$this->assertEquals(['hkey' => 'hvalue', 'message_id' => 'theMessageId'], $result->getHeaders());
Copy link
Member

Choose a reason for hiding this comment

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

message_id should not be a part of headers. That was wrong to put it there. Could you please create and use a dedicated property for it in Message class.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If I change this, we will need to change this in all the other message type as we are reusing the test between services

@makasim makasim merged commit 31fc8ea into php-enqueue:master Jan 18, 2020
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

Successfully merging this pull request may close these issues.

2 participants