Skip to content

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.

{
$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
$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