【问题标题】:SpelEvaluationException: EL1004E:(pos 8): Method call: Method transform(byte[]) cannot be foundSpelEvaluationException: EL1004E:(pos 8): Method call: Method transform(byte[]) can be found
【发布时间】:2017-01-05 17:20:42
【问题描述】:

我正在尝试创建一个简单的 spring-integration 应用程序来摄取 http 数据并将它们转发到两个队列。 在其中一个队列中(暂时忽略另一个)我想丰富数据,然后将它们转发到 AMQP 端点。

我的问题是以下异常:

MessagingTemplate$TemporaryReplyChannel : 收到回复消息但 接收线程在发送时由于异常而退出 请求消息:错误消息 [有效负载=org.springframework.messaging.MessageHandlingException: 嵌套异常是 org.springframework.expression.spel.SpelEvaluationException: EL1004E:(pos 8): 方法调用:方法 transform(byte[]) 不能 在 com.EnrichmentService 类型上找到,

我很确定摄取的数据以某种方式序列化 我的浓缩服务,即用于 DTO(在我的示例中为数据),无法理解。 我尝试在我的 DTO 上实现 Serializable。

我的问题是,我将如何调试流经我的渠道的类型?

我的代码是这样的:

@Bean
public StandardIntegrationFlow ingestRaw() {

    return IntegrationFlows.from(httpIngest())
            .headerFilter("accept-charset", "http_requestMethod")
            .publishSubscribeChannel(Executors.newCachedThreadPool(),
                    input -> input
                            .subscribe(enrichmentFlow()))
                            .subscribe(anotherFlow()))
            .get();
}

@Bean
public IntegrationFlow enrichmentFlow(){

    return flow -> flow.enrich(e -> e
            .requestChannel(enrichmentRequestChannel())
            .replyChannel(enrichmentReplyChannel())
            .requestPayload(Message::getPayload))
            .transform(Transformers.fromJson(Data.class))
            .handle(Data.class, (payload, headers) -> enrichmentService.transform(payload))
            .handle(amqpOutboundFlow());
}


@Bean
public HttpRequestHandlingMessagingGateway httpIngest() {
    return Http.inboundGateway(SINK_ENDPOINT_PATH).get();
}


@Bean("enrichmentRequestChannel")
public DirectChannel enrichmentRequestChannel(){
    return MessageChannels.direct().get();
}

@Bean("enrichmentReplyChannel")
public DirectChannel enrichmentReplyChannel(){
    return MessageChannels.direct().get();
}


@Bean
public AmqpOutboundEndpoint amqpOutboundFlow() {
    return Amqp.outboundAdapter(this.amqpTemplate).routingKeyExpression("enrichOut.enrichedGroup").get();
}

【问题讨论】:

  • 请显示该错误的更多堆栈跟踪
  • M-m-m。谁订阅了enrichmentRequestChannel?请展示一下这个流程
  • 我所有的代码都在那里。由于我是弹簧集成的新手,我想我错过了一些东西......
  • 好的,那么,更多的堆栈跟踪在哪里?也许你可以准备一些 Spring Boot 应用程序在我这边本地玩?

标签: spring-integration


【解决方案1】:

我犯了一个错误,忘记取消注释我之前使用的绑定,因此 TransformationService 以两种方式绑定(至少看起来如此)。

 @ServiceActivator(inputChannel = "enrichmentRequestChannel", outputChannel = "enrichmentReplyChannel")
 public EnrichedData transform(Data data) {

【讨论】:

    猜你喜欢
    • 2023-03-27
    • 1970-01-01
    • 1970-01-01
    • 2022-12-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-12-01
    • 2022-12-26
    相关资源
    最近更新 更多