簡體   English   中英

使用Camel將ServiceMix 3.0升級到ServiceMix 6.0

[英]Upgrade ServiceMix 3.0 to ServiceMix 6.0 with Camel

我已經使用ServiceMix 3.0和JBI消息創建了一個基於Java的小型應用程序

應用程序的工作方式是,我們使用filepoller(每5分鍾)讀取一個文件位置,然后將文件轉換為另一種格式,即。 xml到pdf。

我們使用servixmix filewriter組件將輸出文件寫在其他文件位置。

現在,我們需要使用Apache ServiceMix 6.0和Camel 2.15.2進行升級。

我是Apache Camel的新手。 我已經在servicemix 6.0和camel 2.15.2上做了一些POC工作,但沒有獲得完整的想法,以實現我們的應用場景?

POC的工作類似於使用文件,計時器,計划程序駱駝組件。

    CamelContext context = new DefaultCamelContext();

    context.addRoutes(new RouteBuilder() {
        public void configure() throws Exception {
            from("timer://foo?period=1000").process(new Processor() {
                @Override
                public void process(Exchange exchange) throws Exception {
                    System.out.println("Hello world  :"
                            + new java.util.Date().toString());
                }
            });
        }

    });
    context.start();
    Thread.sleep(10000);
    context.stop();

任何人都可以幫助實現上述方案。

請所有人提出其他解決方案。

提前致謝。

對於讀取的文件,可以使用filehttp://camel.apache.org/file2.html )組件。 對於寫文件,您也可以使用file組件。 我對您的文件格式一無所知,因此無法對它們的處理提供任何建議。

為了進行處理,您可以使用以下組件:

xslt (轉換XML http://camel.apache.org/xslt.html ),

fop (轉換為PDF http://camel.apache.org/fop.html ),

velocity (通過模板http://camel.apache.org/velocity.html轉換為XML)等。

或者您可以使用某些數據格式: http : //camel.apache.org/data-format.html,例如BeanIOhttp://camel.apache.org/beanio.html )。

例:

    from("file://inbox?sortBy=file:name&include=(.*[.](xml|XML)$)&delete=true&preMove=inprogress&delay=300000"). 
     //5 min. delay between poll, consuming only xml file
      routeId("testRoute")
    .to("xslt:xsl/transform.xsl") //refers to the file xsl/transform.xsl on the classpath
     //....... some other transformation here .......
    .to("file://outbox");

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM