Hey everyone!
I’m successfully receiving events from Salesforce’s PubSub API via gRPC, but I’m struggling to decode the actual payload.
Since Salesforce allows schema customization, they don’t provide predefined Protobuf definitions for the event data. Instead, events are wrapped in a generic message, containing:
- A schema_id (e.g., “23456789asdf”)
- A binary payload, which needs decoding
I can fetch the corresponding JSON Schema using:
Eventbus.V1.PubSub.Stub.get_schema(
channel,
%Eventbus.V1.SchemaRequest{schema_id: "23456789asdf"}
)
I would love to have a flow like the following:
Store known schemas (no problem)
Check if a schema is known on receiving an event (no problem)
Fetch missing schemas (no problem)
Compile missing schemas
Decode the payload using the schema
I’m stuck on how to go from a JSON Schema to something usable for decoding the Protobuf payload . Any guidance would be greatly appreciated!