Receiving a JSON pubsub event
Hi
My use case is that I'm trying to pipe proto cloud events from one pubsub topic, convert them to json using redpanda's to_json processor and then push them to a second pubsub topic. This works fine. When I try to set the ce-datacontenttype to application/json however, I find that it sometimes reverts back to application/protobuf
Reading through the code, it seems that I might need to set "Content-Type" to "application/cloudevents+json". However, when I do this, it fails at this line, which seems to indicate that if the ce-specversion attribute is present then the pubsub message can't be read/received as structured. When I remove the ce-specversion attribute, I then get an error at this line.
What's going on here? Just want to convert a pubsub cloud event to a json cloud event.
Any help or guidance that can be provided would be greatly appreciated. Thanks!
When I try to set the ce-datacontenttype to application/json however, I find that it sometimes reverts back to application/protobuf
Sorry for my late reply here. Just to fully understand, is this about the content-type of the actual data, not about any binary transport headers to indicate (de)serialization over specific transports, such as application/cloudevents+json?
Can you provide an end-to-end example, incl. the datacontenttype values, of how the CloudEvents gets converted along the chain so I can reproduce in a test case?
Hey mate
I figured out that I had to set the attributes ce-datacontenttype and Content-Type to "application/json"
Still confused about how some events were interpreted by CE as json and some as proto!