grafana / xk6-amqp

A k6 extension for publishing and consuming messages from queues and exchanges using AMQP 0.9.1.
Apache License 2.0
25 stars 28 forks source link

Sending protobuf messages as binary data #38

Open gusev-klara opened 7 months ago

gusev-klara commented 7 months ago

Is there a way to send protobuf messages to RabbitMQ using this module?

Let's say I have a proto file that looks like this:

syntax = "proto3";
import "google/protobuf/timestamp.proto";
package performance.prototest;

message Simple {
  google.protobuf.Timestamp synced_at = 1;
}

and json data:

{
  "synced_at": "2023-02-03T12:23:11Z"
}

after encoding json into protobuf I'm getting javascript array: [10,6,8,175,249,243,158,6], but on xk6-amqp side it's transformed into [10 6 8 194 175 195 185 195 179 194 158 6] byte array.

One way I found is to use base64 encoding (with patching module to decode base64 before sending), but would be good to be able to send binary data.