Spring Boot中使用Apache Camel如何将一个动态值从rest路由传递到from文件路由中

我有一个 apache camel rest route,我想从postman调用这个 rest post route,我想给它发送一个包含文件路径的JSON,然后我想读取这个文件路径,在一个from file route中使用它

@Component
    class RestApi extends RouteBuilder {
        @Override
        public void configure() {
            CamelContext context = new DefaultCamelContext();

            restConfiguration()
                    .contextPath(contextPath)
                    .port(serverPort)
                    .enableCORS(true)
                    .apiContextPath("/api-doc")
                    .apiProperty("api.title", "Test REST API")
                    .apiProperty("api.version", "v1")
                    .apiContextRouteId("doc-api")
                    .component("servlet")
                    .bindingMode(RestBindingMode.json);
            rest("/api/")
                    .id("api-route")
                    .consumes("application/json")
                    .post("/bean")
                    .bindingMode(RestBindingMode.json_xml)
                    .type(MyBean.class)
                    .to("direct:remoteService");
            from("direct:remoteService")
                    .routeId("direct-route")
                    .tracing()
                    .log(">>> ${body.id}")
                    .log(">>> ${body.name}")

                    //I TREID CALLING IT WITH toD but is not working

                    .toD("file://${body.name}?fileName=sources.zip&noop=true&delay=5000&moveFailed=error");
            from("file://${body.name}?fileName=sources.zip&noop=true&delay=5000&moveFailed=error")
                    .tracing()
                    .log(">>> ${body.id}")
                    .log(">>> ${body.name}")
                    .log("Loading zip file ${file:name}")
                    .split(new ZipSplitter())
                    .streaming()
                    .to("direct:another-route");
        }
    }

我试着用 “toD”,但我得到以下错误。

java.lang.IllegalArgumentException: Invalid directory: ${body.name}. Dynamic expressions with ${ } placeholders is not allowed. Use the fileName option to set the dynamic expression.

我想要的是获得与postman body.name 一起发送的路径,我可以获得该值,因为它显示在日志中,然后使用该路径来启动从文件路径route

from("file://${body.name}?fileName=sources.zip&noop=true&delay=5000&moveFailed=error")
                    .tracing()
                    .log(">>> ${body.id}")
                    .log(">>> ${body.name}")
                    .log("Loading zip file ${file:name}")
                    .split(new ZipSplitter())
                    .streaming()
                    .to("direct:another-route");

StackOverflow:Apache Camel Spring Boot Java - how can I pass a dynamic value from a rest route to a from file route? - Stack Overflow