最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Apache Camel route, process method refactor - Stack Overflow

programmeradmin0浏览0评论

It looks like a new version of the Apache camel route; process methods are removed. We are in the upgrade process from camel 3.24 to 4.4 Could anyone help me refactor the older camel route code below into a new camel version? Thank you!

    rest()
            .tag("Test")
            .post("/Vendor/receive")
            .route()
            .process(new RetrieveAccessToken(_logger))
            .toD("rest endpoint url" + "?bridgeEndpoint=true&connectionClose=true&httpMethod=POST")
            .process(exchange -> {
                _logger.info("rest service completed for MessageType<" + getMessageType(exchange) + ">", getLogEvent(exchange));
            });

could not find any online help

It looks like a new version of the Apache camel route; process methods are removed. We are in the upgrade process from camel 3.24 to 4.4 Could anyone help me refactor the older camel route code below into a new camel version? Thank you!

    rest()
            .tag("Test")
            .post("/Vendor/receive")
            .route()
            .process(new RetrieveAccessToken(_logger))
            .toD("rest endpoint url" + "?bridgeEndpoint=true&connectionClose=true&httpMethod=POST")
            .process(exchange -> {
                _logger.info("rest service completed for MessageType<" + getMessageType(exchange) + ">", getLogEvent(exchange));
            });

could not find any online help

Share Improve this question edited Mar 12 at 22:31 Hilory 2,1577 gold badges14 silver badges30 bronze badges asked Mar 12 at 15:18 anba rajendrananba rajendran 1 1
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – Community Bot Commented Mar 13 at 6:39
Add a comment  | 

1 Answer 1

Reset to default 0

Please refer this, Camel route() and endRest() methods have been Removed from RestDefition class, so you may need to break the above code to use to("direct:endpointName")instead.

If you break down your existing code to something like below, it should work.

    rest()
        .tag("Test")
        .post("/Vendor/receive")
        .to("direct:a");

        from("direct:a")
        .process(new RetrieveAccessToken(_logger))
                .to("direct:b");

        from("direct:b")
        .toD("rest endpoint url" + "?bridgeEndpoint=true&connectionClose=true&httpMethod=POST")
        .process(exchange -> {
            _logger.info("rest service completed for MessageType<" + getMessageType(exchange) + ">", getLogEvent(exchange));
        });

发布评论

评论列表(0)

  1. 暂无评论