You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey there. While using this package, I noticed my payload that running through google pub/sub is encoded twice.
The problem is in the PubSubQueue class in pushRaw function
$publish = ['data' => base64_encode($payload)];
On this line we are encoding our payload, and then in
$topic->publish($publish);
We are actually executing code from Google/cloud-pubsub library, which is doing exactly the same, so the payload is encoded twice at the stage of sending it to the pub/sub.
The same if for pulling messages from subscriptions, Google package doing the base64_decode by itself.
Just wondering what was the initial purpose of encoding payload inside this package ?
The text was updated successfully, but these errors were encountered:
I actually don't use this package and I don't remember why I made that choice at the time. But initially, the topic auto-creation was not part of this package and I probably did assume that the "encoding" option was set to false. With the topic auto-creation, I believe all the messages are now automatically encoded to base64, so I agree with you it can be kind of inefficient now and it might be a good idea to disable this behavior.
This actually has nothing to do with topic auto-creation.
The message encoding during publishing to the topic was introduced with the initial release starting 0.1.0 tag.
For the REST connection, the package will set encode flag to true
if ($connectionType === 'grpc') { $this->connection = new Grpc($this->configureAuthentication($config)); $this->encode = false; } else { $this->connection = new Rest($this->configureAuthentication($config)); $this->encode = true; }
Hey there. While using this package, I noticed my payload that running through google pub/sub is encoded twice.
The problem is in the
PubSubQueue
class inpushRaw
function$publish = ['data' => base64_encode($payload)];
On this line we are encoding our payload, and then in
$topic->publish($publish);
We are actually executing code from Google/cloud-pubsub library, which is doing exactly the same, so the payload is encoded twice at the stage of sending it to the pub/sub.
The same if for pulling messages from subscriptions, Google package doing the base64_decode by itself.
Just wondering what was the initial purpose of encoding payload inside this package ?
The text was updated successfully, but these errors were encountered: