Value not wanting to be serialised into protobuf

Hi all…

Need someone that has worked with protobuf, schema registry and Kafka using the confluent library stack.

For the following git repo, cmd/producer.go

I serialise the payload as per a couple of examples (Line 974), but getting the following message on the serialise step.

Failed to serialize record: serialization target must be a protobuf message. Got

please help

G

Try passing &pb_Basket (the message should be a pointer, see here).

1 Like

Well some how it missed that &, tried one everywhere else…
dev made a difference… changed the error :wink:

2024/06/17 18:35:43 Basket: Failed to serialize record: Post "localhost:///subjects/pb_salesbaskets-value/versions?normalize=false": unsupported protocol scheme "localhost"
exit status 1

I pass schema registry as localhost:8081 via the variable vKafka.SchemaRegistryURL

client, err = schemaregistry.NewClient(schemaregistry.NewConfig(vKafka.SchemaRegistryURL))

interesting… changed my schema registry url to include http:// as http://localhost:8081

changed error to

2024/06/17 18:41:31 INFO: Post to Confluent Kafka topics
2024/06/17 18:41:31 Payment: Failed to serialize record: schema registry request failed error code: 409: Schema being registered is incompatible with an earlier schema for subject "pb_salespayments-value", details: [{errorType:"MESSAGE_REMOVED", description:"The new schema is missing a MESSAGE type at path '#/pb_Payment' in the old schema"}, {oldSchemaVersion: 1}, {oldSchema: 'syntax = "proto3";
package types;

message pb_Payment {
  string InvoiceNumber = 1;
  string PayDateTime = 2;
  string PayTimestamp = 3;
  double Paid = 4;
  string FinTransactionID = 5;
}
'}, {validateFields: 'false', compatibility: 'BACKWARD'}]
exit status 1
g-mbp.local:/Users/george/Desktop/MongoCreater/goProd 0.4 -not working >

guess this is cheating. deleted the previous schema registry entries and reran…
well i got a payloads on my topics, even if they look very json like…
:slight_smile:
G

Now to see if i can get my streams processing (create stream) rebuild, with the topics now based on protobuf…
G

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.