Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 8de13b9

Browse files
committed
Don't send attributes if it's empty
1 parent 46929e0 commit 8de13b9

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

‎pkg/gps/GpsProducer.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,14 @@ public function send(Destination $destination, Message $message): void
3737

3838
/** @var Topic $topic */
3939
$topic = $this->context->getClient()->topic($destination->getTopicName());
40-
$topic->publish([
41-
'data' => json_encode($message),
42-
'attributes' => $message->getAttributes(),
43-
]);
40+
41+
$params = ['data' => json_encode($message)];
42+
43+
if (count($message->getAttributes()) > 0) {
44+
$params['attributes'] = $message->getAttributes();
45+
}
46+
47+
$topic->publish($params);
4448
}
4549

4650
public function setDeliveryDelay(?int $deliveryDelay = null): Producer

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /