<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    linugb118--java space

    Java

    開始serviceMix

    1.     serviceMix 特點:

    支持的協(xié)議有:

    FileFTPHttp/sjmssmtpsoaptcpxmpp

    與其他引擎的支持:

    Apache Camelapache cxfapache odedroolsos workflowpojosquartzscriptingsaxon Xquery and xsltws-notification

    支持的安全:

    JAAS,WS-Security

    web 容器的集成

    JBoss,Geronimo,jetty,tomcat,weblogic,websphere

     

    2.     eclipse IDE tooling for serviceMix

    http://eclipse.org/stp

    http://spagic.com

    http://sopera.de/en/products/sopera-servicemixtools

     

    3.     安裝:

    1. 官方下載http://servicemix.apache.org/downloads.html.并解壓
    2. 進入bin目錄執(zhí)行servicemix.bat或者shell script
    3. Sericemixosgi結(jié)構(gòu)的,

    通過osgi:list 命令可以查看所有有效的osgi bundles

    通過osgi:list | grep camel 命令 查看camel相關(guān)的bundles

    通過log:display命令 來顯示日志

    通過log:display-exception  顯示最近的異常日志

    通過log:set DEBUG  設置日志的級別

    通過log:display | grep DEBUG 顯示只是debug級別的日志

              通過features:list 來查看所有的特性,并從而可以分析當前特性是否安裝

              若沒有安裝 可以通過 features:install來安裝,比如:features:install webconsole

    4.     Camel 集成

    先查看是否存在camel相關(guān)features,沒有則按照相應的bundles

    接下來我們做一個例子:分別設置兩個目錄inputoutput,在input放入文件后則被傳送到output中。而這個過程就是通過serviceMix調(diào)用camel router來完成

    1. Blueprint xml file

    下面是一個配置的router文件描述,你可以通過自己寫文件,當然最好還是用可視化工具,后面我們再花時間聊聊這東東,這個時候就繞不開Enterprise Integration pattern 又是標準,老外厲害。

     我們這里直接先貼上文件:

    <?xml version="1.0" encoding="UTF-8"?>

    <blueprint

        xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"

        xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"

        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

        xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">

     

        <camelContext xmlns="http://camel.apache.org/schema/blueprint">

            <route>

                <from uri="file:bgao/input" />

                <log message="happy day!!!" />

                <to uri="file:bgao/output" />

            </route>

        </camelContext>

    </blueprint>

    并命名為firstCamelRouter.xml

     

    1. 配置到serviceMix

    將文件放入到serviceMixdeploy中,這個時候后再serviceMix目錄下發(fā)現(xiàn)bgao的目錄并下面有個input文件夾,這時候如果在input文件夾放入一個文件,這bgao目錄下會出現(xiàn)output目錄并且將input目錄的文件移到output上。通過log:display  可以查看到當前這個動作的日志。

     

    通過karaf@root> osgi:list | grep xml

    [  43] [Active     ] [GracePeriod ] [       ] [   60] activemq-broker.xml (0.0.0

    )

    [ 129] [Active     ] [            ] [       ] [   60] Apache ServiceMix :: Bundl

    es :: xmlsec (1.4.5.1)

    [ 138] [Active     ] [            ] [       ] [   60] Apache ServiceMix :: Bundl

    es :: xmlbeans (2.4.0.4)

    [ 142] [Active     ] [            ] [       ] [   60] Apache ServiceMix :: Bundl

    es :: xmlresolver (1.2.0.3)

    [ 163] [Active     ] [Created     ] [       ] [   60] firstCamelRouter.xml (0.0.

    0)

    得到當前ID163;通過osgi:stop 163或者  osgi:start 163 來啟動或者關(guān)閉當前bundle

     

    5.     ActiveMQ集成

    先查看是否存在camel相關(guān)features, 沒有則按照相應的bundles

    我們做一個例子:

    對兩個文件進行文件移動,同時對MQ隊列產(chǎn)生一個event 消息并捕獲消息打出到日志。

    第一個文件:firstMq.xml

    <?xml version="1.0" encoding="UTF-8"?>

    <blueprint

        xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"

        xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"

        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

        xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">

     

        <camelContext xmlns="http://camel.apache.org/schema/blueprint">

            <route>

                <from uri="file:bgao/mq/input" />

                <to uri="file:bgao/mq/output" />         

                    <setBody>

                    <simple>

                    File Move Event (${file:name},${date:now:hh:MM:ss.SSS})

                    </simple>

                    </setBody>

                    <to uri="activemq://event" />

            </route>         

        </camelContext>

    </blueprint>

    這時候,文件已經(jīng)移到output,現(xiàn)在是event message都在隊列里面,但還沒有人去處理他,現(xiàn)在通過secondeMq里處理她。

    設置第二個文件 secondMq.xml 放入deloy文件夾中

    <?xml version="1.0" encoding="UTF-8"?>

    <blueprint

        xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"

        xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"

        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

        xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">

     

        <camelContext xmlns="http://camel.apache.org/schema/blueprint">

            <route>

            <from uri="activemq://event" />

                <from uri="file:bgao/mq/input" />

                <to uri="log:events" />         

            </route>         

        </camelContext>

    </blueprint>

    啟動當前這個bundle 然后打日志就發(fā)現(xiàn)有

    2012-06-11 16:01:43,751 | INFO  | sConsumer[event] | events

          | ?                                   ? | 91 - org.apache.camel.camel-core

     - 2.8.4 | Exchange[ExchangePattern:InOnly, BodyType:String, Body:

                            File Move Event (address list20120130.xls,04:06:08.272)

                            ]

    2012-06-11 16:01:43,751 | INFO  | sConsumer[event] | events

          | ?                                   ? | 91 - org.apache.camel.camel-core

     - 2.8.4 | Exchange[ExchangePattern:InOnly, BodyType:String, Body:

                            File Move Event (jms-1_1-fr-spec.pdf,04:06:08.469)

                            ]

    2012-06-11 16:01:43,752 | INFO  | sConsumer[event] | events

          | ?                                   ? | 91 - org.apache.camel.camel-core

     - 2.8.4 | Exchange[ExchangePattern:InOnly, BodyType:String, Body:

                            File Move Event (新建文本文檔 (3).txt,04:06:08.765)

     

    6.     Webconsole

    通過安裝features:install webconsole后,可以通過訪問http://localhost:8181/system/console

    用戶名:smx

    密碼:smx

    當前webconsole karaf框架提供的一個web頁面系統(tǒng)。

    posted on 2012-06-11 17:10 linugb118 閱讀(1773) 評論(0)  編輯  收藏


    只有注冊用戶登錄后才能發(fā)表評論。


    網(wǎng)站導航:
     

    My Links

    Blog Stats

    常用鏈接

    留言簿(1)

    隨筆檔案

    搜索

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 免费夜色污私人影院网站| 手机看片国产免费永久| 亚洲AV无码一区二区三区国产| 三年片在线观看免费观看大全中国| 久久精品国产精品亚洲艾| 成人免费午间影院在线观看| 日韩大片免费观看视频播放| 777亚洲精品乱码久久久久久| 午夜寂寞在线一级观看免费| 中国人免费观看高清在线观看二区| 91久久亚洲国产成人精品性色| 特级淫片国产免费高清视频| 国产啪精品视频网站免费尤物 | 四虎免费在线观看| 免费无码一区二区三区蜜桃| 亚洲人成7777| 亚洲午夜无码久久久久| 免费无码黄网站在线观看| 麻豆精品不卡国产免费看| 国产精品国产亚洲区艳妇糸列短篇| 亚洲精品狼友在线播放| 成人免费无码大片a毛片| 国产高清不卡免费视频| 最新亚洲人成网站在线观看| 亚洲白嫩在线观看| 亚洲女初尝黑人巨高清| 国产a不卡片精品免费观看 | 又粗又黄又猛又爽大片免费| 精品无码无人网站免费视频| 国产VA免费精品高清在线| 亚洲精品久久久久无码AV片软件| 久久久久亚洲av无码专区导航| 亚洲午夜无码片在线观看影院猛| 毛片a级毛片免费播放下载| 亚洲视频免费在线观看| 国产成人精品免费大全| 亚洲人成色4444在线观看| 亚洲人成7777影视在线观看| 久久精品国产精品亚洲蜜月| 亚洲无人区午夜福利码高清完整版| 日韩在线天堂免费观看|