[restful-ws] Allow configuring default writer encoding for CloudEventsProvider

Đang mở
#533 4 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
java
Lĩnh vực
api

Hướng nghiên cứu

Bắt đầu trong http/restful-ws/src/main/java/io/cloudevents/http/restful/ws/CloudEventsProvider.java, đặc biệt là logic xung quanh các dòng 95–112, và xem xét hành vi Quarkus SSE được liên kết. Xác định cách một encoding mặc định có thể cấu hình nên tương tác với các annotation StructuredEncoding và BinaryEncoding. Được xem là hoàn tất khi bên gọi có thể chọn chế độ mặc định trong khi hành vi encoding theo từng method vẫn giữ được ý nghĩa.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

enhancement

The CloudEventsProvider defaults to binary encoding. Only when there is an StructuredEncoding annotation present, this mode will be set. See the logic:

https://github.com/cloudevents/sdk-java/blob/3614a4f5f4982e6ed38332c2cc73b1a558326274/http/restful-ws/src/main/java/io/cloudevents/http/restful/ws/CloudEventsProvider.java#L95-L112

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: https://github.com/cardil/openshift-knative-showcase/commit/15e00429c459abf655fb483a27f467d598ae173e
Related issue: https://github.com/quarkusio/quarkus/issues/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

Ngôn ngữ chính
Java
Star
446
Fork
172
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của cloudevents/sdk-java

Tất cả issue của cloudevents/sdk-java

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.