如何在使用 apache camel 的验证器组件时使用动态端点?

How to use a dynamic endpoint while using the validator component of apache camel?

我想使用 apache camel 进行 xml 验证休息服务,但是我希望文件的路径是动态的,但我无法做到这一点:

package com.example.XMLValidator;

import org.apache.camel.builder.RouteBuilder;
import org.springframework.stereotype.Component;


import core.ErrorProcessor;

@Component
public class XMLValidatorRestService extends RouteBuilder{
    
        @Override
        public void configure() throws Exception {
            
            onException(Exception.class).handled(true)
            .process(new ErrorProcessor());
            
            

            rest("/xmlValidator/{xsdLocation}")
            .post()
            
            .to("direct:xmlValidator");
            
 
            from("direct:xmlValidator")
            .choice()
                .when(header("ebmName").isEqualTo("pers.marriage.ebm.marrInfo_1.0")).to("validator:${header.xsdLocation}")
      .log("${body}");
        }   
}

但是这段代码给我以下错误:

Cannot find resource: ${header.ebmName} for URI: ${header.ebmName}

这是正确的路线:.to("validator:file:C:/ISF/trunk/ISFApplications/ServiceBusApplications/Applications/MarriageServiceBusApplication/MarriageSBProject/apps/pers.marriage/ebm/pers.marriage.ebm.marrInfo_1.0.xsd") 那么知道如何使这条路径动态化吗?谢谢

使用 toD 而不是 totoD 用于向动态端点发送消息。

请参考:Camel docs