-
Notifications
You must be signed in to change notification settings - Fork 160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[restful-ws] Allow configuring default writer encoding for CloudEventsProvider #533
Comments
BinaryEncoding
annotation have a purposeBinaryEncoding
annotation
BinaryEncoding
annotationBinaryEncoding
annotation, by a way to set the default encoding
With @JemDay we were discussing configurations like this in the context of XML format writer but there is no concrete design or proposal yet. |
BinaryEncoding
annotation, by a way to set the default encoding
How about we provide settings like interface, which people could define using Java's ServiceLoader. It may be something like: interface Settings {
default Encoding defaultEncoding() {
return Encoding.BINARY;
}
} |
I created a Quarkus issue about this: quarkusio/quarkus#31587 |
* Events endpoint PoC * Workaround for quarkusio/quarkus#31587 and cloudevents/sdk-java#533 * Better workaround, thx @pierDipi for quarkusio/quarkus#31587 and cloudevents/sdk-java#533 * Development data * Proper streaming of events SSE * Frontend in React PoC * Event stream using u-cloudevents * Quarkus backend uses the React frontend * Express app uses the React frontend * Tests for Express's event receiver * GH Actions Testing * Container build fix * Remove pre-build Containerfiles * Self-review fixes * Tests for Quarkus event receiver * README format and npm install instructions
As evidenced in cardil/openshift-knative-showcase#2 the fixing of quarkusio/quarkus#31587 (PR quarkusio/quarkus#32815) didn't help completely. |
The
CloudEventsProvider
defaults to binary encoding. Only when there is anStructuredEncoding
annotation present, this mode will be set. See the logic:sdk-java/http/restful-ws/src/main/java/io/cloudevents/http/restful/ws/CloudEventsProvider.java
Lines 95 to 112 in 3614a4f
This makes the
BinaryEncoding
useless, confirmed by no usages in the code.The default to the binary mode is unfortunate. Some implementations like Quarkus RESTEasy Reactive Server Sent Events (SSE) don't provide the annotations. This is problematic, as the binary mode doesn't make sense in SSE - the headers set by
CloudEventsProvider
are being dropped.See the code:
https://github.com/quarkusio/quarkus/blob/247736226a8c8a55fa88a662eda05963803905eb/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/SseUtil.java#L141-L142
See repro: cardil/openshift-knative-showcase@15e0042
Related issue: quarkusio/quarkus#31559
The fact the Quarkus doesn't pass the method annotations, is probably a bug in Quarkus. But, I feel the CloudEvents SDK should allow setting the default mode. Then, the
BinaryEncoding
could have a meaning, of changing that default encoding per-method./kind bug
The text was updated successfully, but these errors were encountered: