【问题标题】:Spring-Integration Partition for SQSSQS 的 Spring-Integration 分区
【发布时间】:2018-06-22 11:20:30
【问题描述】:

我正在尝试设置 spring-integration 分区。

我正在使用堆栈 spring-batch & integration & AWS SQS

  1. Master - 网格大小的完整分区。

  2. Master - 将对象(StepExecutionRequest)传输到 JSON (@Transformer ObjectToJsonTransformer)

  3. Master - 发送 SQS。

  4. Slave - 接收 SQS

  5. Slave - 将 JSON 传输到 Object(StepExecutionRequest) (@Transformer JsonToObjectTransformer)

那么,发生的异常:

2018-06-22 17:40:55.578 ERROR 33730 --- [ask-scheduler-1] o.s.integration.handler.LoggingHandler   : org.springframework.integration.transformer.MessageTransformationException: failed to transform message; nested exception is com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `org.springframework.batch.integration.partition.StepExecutionRequest` (no Creators, like default construct, exist): cannot deserialize from Object value (no delegate- or property-based Creator)

StepExecutionRequest 无法反序列化,因为StepExecutionReuqest 不是setter。

我该如何解决这个问题?

【问题讨论】:

    标签: spring-integration spring-batch amazon-sqs


    【解决方案1】:

    StepExecutionRequest 不适合使用开箱即用的 JSON 进行序列化;如错误所示,它没有默认构造函数。改用 Java 序列化,或编写自定义 jackson JsonDeserializer

    【讨论】:

    猜你喜欢
    • 2021-06-07
    • 1970-01-01
    • 2019-08-25
    • 2020-07-21
    • 1970-01-01
    • 2020-07-25
    • 1970-01-01
    • 2017-07-03
    • 2017-09-29
    相关资源
    最近更新 更多