`ToCloudEventTransformer`: binary mode sets `contentType` to `application/cloudevents`
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 86/100
調査の方向性
347行目付近の ToCloudEventTransformer.java と、167行目および225行目付近の ToCloudEventTransformerTests にあるバイナリモードのアサーションを読みます。トランスフォーマーがペイロードを保持して ce-* ヘッダーを書き込むときに、contentType をどのように設定するか確認します。入力の application/json コンテントタイプが保持されるようにバイナリモードの期待値を更新し、テストで期待される CloudEvent データのコンテントタイプとペイロードがカバーされていることを確認します。
索引モデルが issue の本文から書いたものです。
説明
Spring Integration 7.1.2, cloudevents-spring 5.1.0.
In binary mode, ToCloudEventTransformer keeps the event data as the payload and writes the attributes as ce-* headers, but it also replaces contentType with application/cloudevents (MessageBuilderMessageWriter#create(…), line 347). The CloudEvents bindings use that media type to mark structured mode; in binary mode the content type is the datacontenttype (HTTP binding §3 and §3.1.1, AMQP binding §3 and §3.1.1). So the CloudEvents SDK can't read the output:
Message<byte[]> input = MessageBuilder.withPayload("{\"order\":42}".getBytes(StandardCharsets.UTF_8))
.setHeader(MessageHeaders.CONTENT_TYPE, "application/json")
.build();
Message<?> output = (Message<?>) toCloudEventTransformer.transform(input);
new CloudEventMessageConverter().fromMessage(output, CloudEvent.class);
- Expected: a
CloudEventwithdatacontenttypeapplication/jsonand the payload as its data. - Actual:
CloudEventRWException: Could not parse. Unknown encoding. Invalid content type or spec version.
With contentType set back to application/json, the same message reads correctly.
Suggested fix: in binary mode, keep the input's contentType, since the payload doesn't change. ToCloudEventTransformerTests asserts the current value at lines 167 and 225.
- 主要言語
- Java
- スター
- 1.6k
- フォーク
- 1.2k
- 平均マージ
- 20時間 16分
- マージ済み PR(30日)
- 79
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
spring-projects/spring-integration のほかの issue
-
status: waiting-for-triage type: bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
spring-projects/spring-integration#11654 ·
メンテナーはふだん 1 日以内に返信
-
MQTT v5 outbound adapter drops the trace context that the integration observation puts into the message対応中かも @Hyunsdb が 9 日前に担当しました。 オープンin: mqtt type: enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
spring-projects/spring-integration#11562 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Add Java DSL for `spring-integration-mqtt-client` module対応中かも @yeomin4242 が 13 日前に担当しました。 オープンideal-for-user-contribution in: dsl in: mqtt type: enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 30/100
spring-projects/spring-integration#11537 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
status: waiting-for-reporter type: enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
spring-projects/spring-integration#10672 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
in: sftp type: enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
spring-projects/spring-integration#9971 ·
メンテナーはふだん 1 日以内に返信
spring-projects/spring-integration の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
wildfly/wildfly-channel#446 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
5.0.x backport enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 63/100
spring-cloud/spring-cloud-function#1507 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
open-learning-exchange/myplanet#18484 ·
メンテナーはふだん 1 日以内に返信
-
ELProcessor.defineFunction() fails for valid method signatures対応中かも @RaphaelFakhri が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
jakartaee/expression-language#492 ·