Skip to content

Commit a3d9fa2

Browse files
author
palPalani
committed
Fix getting mmultiple message
1 parent 8e18d2b commit a3d9fa2

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/Sqs/Queue.php

+11-4
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public function pop($queue = null)
8080
: $this->container['config']->get('sqs-queue-reader.default-handler');
8181

8282
$response = $this->modifyPayload($response['Messages'], $class);
83-
Log::debug('New $response==', [$response]);
83+
Log::debug('New $responseV2==', [$response]);
8484
if (preg_match('/(5\.[4-8]\..*)|(6\.[0-9]*\..*)|(7\.[0-9]*\..*)|(8\.[0-9]*\..*)/', $this->container->version())) {
8585
return new SqsJob($this->container, $this->sqs, $response, $this->connectionName, $queue);
8686
}
@@ -112,21 +112,28 @@ private function modifyPayload($payload, $class)
112112
*/
113113

114114
$body = [];
115+
$attributes = [];
115116
foreach ($payload as $item) {
116117
//Log::debug('Each Messages==', [$item]);
117118
$body[] = json_decode($item['Body'], true);
118119
$attributes = $item['Attributes'];
120+
$messageId = $item['MessageId'];
121+
$receiptHandle = $item['ReceiptHandle'];
119122
}
120123

121124
$body = [
122125
'job' => $class . '@handle',
123126
'data' => $body,
124127
];
125128

126-
$newPayload['Body'] = json_encode($body);
127-
$newPayload['Attributes'] = $attributes;
129+
return [
130+
'MessageId' => $messageId,
131+
'ReceiptHandle' => $receiptHandle,
132+
'Body' => json_encode($body),
133+
'Attributes' => $attributes
134+
];
128135

129-
return $newPayload;
136+
//return $newPayload;
130137
}
131138

132139
/**

0 commit comments

Comments
 (0)