Spring Cloud Dataflow Type conversion not working in processor component?

前端 未结 1 1679
渐次进展
渐次进展 2021-01-22 10:57

I have a processor which transforms byte[] payloads into MyClass payloads:

@Slf4j
@EnableBinding(Processor.class)
public class MyDecode         


        
相关标签:
1条回答
  • 2021-01-22 11:46

    You are seeing 3 attempts because that's the default retry configuration for the input channel in the binder.

    There's a bug in the binder in that if the converter can't convert the message, it tries to create a message with a null payload.

    The reason it can't convert the payload is because it sees the inbound content-type (presumably application/octet-stream) and it can't convert from that to JSON.

    The work around is to add a file to the classpath:

    META-INF/spring.integration.properties
    

    and add

    spring.integration.readOnly.headers=contentType
    

    to it.

    That prevents the propagation of the inbound content type header to the outbound message.

    This requires spring integration 4.3.2 or higher.

    In a future release of SCSt, this will be set by default.

    0 讨论(0)
提交回复
热议问题