From d08492f19e049a3e2152e85c64e6df83c30d5fe3 Mon Sep 17 00:00:00 2001 From: sacOO7 Date: Wed, 20 Mar 2024 18:14:25 +0530 Subject: [PATCH] Fixed basemessage encoding issue especially for idempotent publishing --- src/Models/BaseMessage.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Models/BaseMessage.php b/src/Models/BaseMessage.php index 784d6d5..626013a 100644 --- a/src/Models/BaseMessage.php +++ b/src/Models/BaseMessage.php @@ -151,13 +151,6 @@ function( $obj ) use ($cipherParams) { return static::fromEncoded($obj, $cipherP protected function encode() { $msg = new \stdClass(); - if ($this->encoding) { - $msg->encoding = $this->encoding; - $msg->data = $this->data; - - return $msg; - } - if ($this->id) { $msg->id = $this->id; } @@ -170,6 +163,13 @@ protected function encode() { $msg->extras = $this->extras; } + if ($this->encoding) { + $msg->encoding = $this->encoding; + $msg->data = $this->data; + + return $msg; + } + $isBinary = false; $encodings = [];