3

I'm running two instances of Spring Cloud Stream application with Kafka binder. One instance uses scs 3.1.3 version and produces messages using StreamBridge.

streamBridge.send("produceMessage-out-0", MessageBuilder
        .withPayload(message)
        .setHeader(PARTITION_KEY, partition)
        .setHeader("type", "MyMessage")
        .build());

The other one, instead, use scs 2.1.3 version and tries to consume messages produced by the first instance.

However, the consumer application log this error

{"stack_trace":"com.fasterxml.jackson.core.JsonParseException: Unexpected character ('f' (code 102)): Expected space separating root-level values\n at [Source: (byte[])\"0e67331703f9fecf-ce84870011cef91b-0\"; line: 1, column: 12]\r\

and other log of this type

Could not decode json type: application/json for key: contentType

or

Could not decode json type: MyMessage for key: type

I saw that errors concern headers. I tried to set headerMode to raw, none and embeddedHeader into consumer's application.yaml. But with no result.

I also read this thread, seems to be similar to my problem. Could not decode json type for key: file_name in a Spring Cloud Data Flow stream

But BinderHeaderMapper is deprecated into 2.1.3 and I cannot understand how to replace it.

Can you help me please? Thanks

Vin
  • 701
  • 1
  • 9
  • 30

0 Answers0