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

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

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

    吳密的博客

    每天進步一點點
    posts - 12, comments - 1, trackbacks - 0, articles - 1

    置頂隨筆

         摘要: 使用threadLoca做一個簡單的本地緩存l  閱讀全文

    posted @ 2010-09-10 13:44 xiaolang 閱讀(5643) | 評論 (0)編輯 收藏

    2015年4月10日

    在本章我們介紹在serviceMIx 中圖和使用 ActiveMQ、features命令,入門的3篇文章來自
    http://servicemix.apache.org/docs/5.0.x/quickstart/index.html,有興趣的可以再去看看英文的。

    ActiveMQ
        每個
    Apache ServiceMix的實例是一個嵌入式activemq jms代理,這樣可以很方便的在同一臺機器上使用持久消息來通信,
    但是它也支持集群和負載均衡。
       在這個實例中,我們依然像上個例子一樣,在2個目錄中移動文件,把記錄日志的部分改為發送一條jms消息到消息隊列,
    然后再創建一個新的route來接受事件并記錄日志:
    ?xml version="1.0" encoding="UTF-8"?>
    <blueprint
        xmlns="http://www.osgi.org/xmlns/blueprint/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:activemq/input"/>
            <to uri="file:activemq/output"/>

            <setBody>
              <simple>
                FileMovedEvent(file: ${file:name}, timestamp: ${date:now:hh:MM:ss.SSS})
              </simple>
            </setBody>
            <to uri="activemq://events" />
          </route>
        </camelContext>
    </blueprint>

       保存這個文件,并且放到serviceMix的deploy目錄,會看到復制到 activemq/input 目錄中的文件被復制到 activemq/output 

       接受消息
       在第一個文件中,除了復制文件,你看不到任何的log記錄。它發送了jms消息,但是沒有接受者,我們可以創建一個route來接受消息:

    <?xml version="1.0" encoding="UTF-8"?>
    <blueprint
        xmlns="http://www.osgi.org/xmlns/blueprint/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://events"/>
            <to uri="log:events"/>
          </route>
        </camelContext>
    </blueprint>

      你可以通過log:display來查看日志消息。你可以通過osgi:start 和 osgi:stop來啟動和關閉這個bundle.當你重啟完第一個bundle后,你收到所有文件移動后發出
    的消息事件。

        features命令

    karaf@root> features:list | grep camel
    [uninstalled] [5.4.0           ] examples-activiti-camel                 servicemix-examples-5.4.0
    [uninstalled] [5.4.0           ] examples-akka-camel                     servicemix-examples-5.4.0


    karaf@root> features:install webconsole

    karaf@root> features:list | grep webconsole
    [installed  ] [2.4.1           ] webconsole                              karaf-2
    .4.1               Karaf WebConsole for administration and monitoring

        通過features:install webconsole可以安裝  webconsole bundle,成功后你可以通過  http://localhost:8181/system/console  用戶名密碼:smx/smx來
    登錄
    ,可以通過瀏覽器來上傳、啟動,停止bundle。

    posted @ 2015-04-10 15:37 xiaolang 閱讀(5169) | 評論 (0)編輯 收藏

    2015年4月9日

    本章我們通過一個簡單的實例來介紹如何使用camel。
    這個實例中,我們會把文件從目錄
    camel/input 移動到camel/output.為了方便我們跟蹤哪些文件被移動,我們會記錄日志。

    1、創建一個xml
     ServiceMix中定義一個新的 route,最簡單的方式之一就是定義一個Blueprint XML file,就像下邊一樣:

    <?xml version="1.0" encoding="UTF-8"?>
    <blueprint
        xmlns="http://www.osgi.org/xmlns/blueprint/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:camel/input"/>
            <log message="Moving ${file:name} to the output directory"/>
            <to uri="file:camel/output"/>
          </route>
        </camelContext>
    </blueprint>
                                               

    2.部署
       我們只需要將第一步創建的xml復制到serviceMix下的 deploy 目錄,就會被serviceMix 識別并部署。你會看到被放到目錄camel/input下的文件被
    移動到camel/output,如果你使用log:display命令,會看到文件移動的日志:

    2015-04-09 17:10:19,515 | INFO  | le://camel/input | route1
          | ?                                   ? | 116 - org.apache.camel.camel-cor
    e - 2.14.1 | Moving test.xml.bak to the output directory

    3. 使用命令行管理  route
    使用osgi:list,你會看到剛才我們部署的bundle
    [ 221] [Active     ] [Created     ] [       ] [   80] test.xml (0.0.0)
    你會看到我們剛才部署的bundle ID是221,我們可以通過這個bundle ID來啟動或者關閉bundle

    karaf@root> osgi:stop 221
    karaf@root> osgi:start 221

    posted @ 2015-04-09 17:19 xiaolang 閱讀(4482) | 評論 (0)編輯 收藏

    本章我們主要介紹下如何安裝serviceMiX,使用命令來查看osgi bundles、日志。

    1、下載
    serviceMiX5.4.0
    http://servicemix.apache.org/downloads.html
    到下載頁面選取:
    tar,gz  for Linux/Unix/MacOS X
    zip for windows

    如果僅僅是運行
    serviceMiX,你需要jre1.6.x 或者 jre1.7.x  serviceMiX5.4.0大概需要100M的空間
    如果你要開發自己的一些集成應用和osgi bundles,你還需要安裝  jdk1.6.x 或者 jdk1.7.x  apache maven3.0.4 或者更高的版本


    2.解壓,指定<SERVICEMIX_HOME>.
    解壓,在環境變量中配置 <SERVICEMIX_HOME>.例如:C:\apache-servicemix

    3.啟動serviceMiX(windows)

    C:\Users\Administrator>cd c:\apache-servicemix\bin

    c:\apache-servicemix\bin>servicemix
    Please wait while Apache ServiceMix is starting...
     27% [===================>                                                    ]


    4.啟動成功

    Please wait while Apache ServiceMix is starting...
    100% [========================================================================]
     ____                  _          __  __ _
    / ___|  ___ _ ____   _(_) ___ ___|  \/  (_)_  __
    \___ \ / _ \ '__\ \ / / |/ __/ _ \ |\/| | \ \/ /
     ___) |  __/ |   \ V /| | (_|  __/ |  | | |>  <
    |____/ \___|_|    \_/ |_|\___\___|_|  |_|_/_/\_\
      Apache ServiceMix (5.4.0)
    Hit '<tab>' for a list of available commands
    and '[cmd] --help' for help on a specific command.
    Hit '<ctrl-d>' or 'osgi:shutdown' to shutdown ServiceMix.

    5. 
    使用命令 osgi:list  osgi:list|grep camel 查看bundles 

    karaf@root> osgi:list
    START LEVEL 100 , List Threshold: 50
       ID   State         Blueprint      Spring    Level  Name
    [  81] [Active     ] [            ] [       ] [   50] geronimo-annotation_1.0_spec (1.1.1)
    [  82] [Active     ] [            ] [       ] [   50] geronimo-jms_1.1_spec (1.1.1)
    [  83] [Active     ] [            ] [       ] [   50] geronimo-j2ee-management_1.1_spec (1.0.1)
    [  84] [Active     ] [            ] [       ] [   50] JAXB2 Basics - Runtime (0.6.4)
    [  85] [Active     ] [            ] [       ] [   50] Apache ServiceMix :: Bundles :: jaxb-impl (2.2.1.1_2)

    karaf@root> osgi:list|grep camel
    [ 116] [Active     ] [            ] [       ] [   50] camel-core (2.14.1)
    [ 117] [Active     ] [Created     ] [       ] [   50] camel-karaf-commands (2.14.1)
    [ 118] [Active     ] [            ] [       ] [   50] camel-jms (2.14.1)
    [ 124] [Active     ] [            ] [       ] [   50] camel-spring (2.14.1)
    [ 125] [Active     ] [Created     ] [       ] [   50] camel-blueprint (2.14.1)

    6.
    使用log:display查看日志,其他 log:display-exception

    karaf@root> log:display
    2015-04-09 16:09:07,433 | INFO  | 0 - timer://wumi | timerToLog  | ?                                   ? | 116 - org.apache.camel.camel-cor
    e - 2.14.1 | The message contains Hi from Camel at 2015-04-09 16:09:07

    posted @ 2015-04-09 16:25 xiaolang 閱讀(6353) | 評論 (1)編輯 收藏

    2015年4月1日

    今天下午發現mysql客戶端連接服務端緩慢,windows 環境下,到目錄 MYSQL_HOME/my.ini 中加入:skip-name-resolve,然后保存并重啟mysql服務

    問題解決。

    查閱mysql官方網站得知,這屬于官方一個系統上的特殊設定,就把他當成mysql的一個bug算了,不管鏈接的的方式是經過 hosts 或是 IP 的模式,他都會對 DNS
    做反查。mysqld 會嘗試去反查 IP -> dns ,由于反查解析過慢,就會無法應付過量的查詢。





    posted @ 2015-04-01 17:24 xiaolang 閱讀(333) | 評論 (0)編輯 收藏

    2011年1月18日

    布局介紹:
    http://penguin7.blog.51cto.com/966026/222075


    簽名介紹:

    posted @ 2011-01-18 09:50 xiaolang 閱讀(253) | 評論 (0)編輯 收藏

    2011年1月7日

         摘要: 1、訪問we.alipay.com ,使用支付寶賬戶登錄,輸入團體收款“邀請碼”(我們定向派發了第一批邀請碼300個)開通團長功能。

    2、體驗一下“團體收款”的各種功能,不管是不爽,還是滿意,都請您提交“用戶反饋”:
    ? 可以試試創建一個團體,拉你的好友成為團員;
    ? 可以在成功創建團體后,試著發起各類活動收款;
    ? 您會經常在哪些活動中遇到和使用一對多的團體收款?
    ? 您身邊使用支付寶的好友多嗎?
    ? 我們這個新生產品可以幫助您把團體活動收款變簡單嗎?
    QQ: 908820222  閱讀全文

    posted @ 2011-01-07 17:37 xiaolang 閱讀(308) | 評論 (0)編輯 收藏

    2011年1月6日

         摘要:   閱讀全文

    posted @ 2011-01-06 18:38 xiaolang 閱讀(2559) | 評論 (0)編輯 收藏

    2010年12月6日

         摘要: 寫代碼是一個富有創意但又可能讓人思想麻痹的任務,不管你是否喜歡你的工作,你總會找一些捷徑,但遺憾的是,大部分捷徑都違反了最佳編碼實踐原則,這些捷徑要么會產生BUG,要么會導致數據出錯,我的建議是:在編寫VBA代碼時,不要走捷徑。下面是一些常見的錯誤觀念,導致人們選擇了錯誤的捷徑,雖然其中一部分只適用于VBA或某種IDE,但大多數都是通用的  閱讀全文

    posted @ 2010-12-06 09:34 xiaolang 閱讀(230) | 評論 (0)編輯 收藏

    2010年9月29日

         摘要: 使用Jmock時,如果給的類型不是一個接口的時候,會拋出一個異常xxx is not an interface。其實根據Jmock的文檔,只要稍作修改,就可以解決這個問題。
      閱讀全文

    posted @ 2010-09-29 13:27 xiaolang 閱讀(385) | 評論 (0)編輯 收藏

    2010年9月10日

         摘要: 使用threadLoca做一個簡單的本地緩存l  閱讀全文

    posted @ 2010-09-10 13:44 xiaolang 閱讀(5643) | 評論 (0)編輯 收藏

    主站蜘蛛池模板: 香蕉免费在线视频| 91精品成人免费国产| 无码日韩人妻av一区免费| 亚洲最新永久在线观看| 免费无码中文字幕A级毛片| 亚洲国产女人aaa毛片在线| 美丽姑娘免费观看在线观看中文版| 亚洲高清国产AV拍精品青青草原 | 久久夜色精品国产亚洲| 国产一级一毛免费黄片| 亚洲区小说区图片区QVOD| 久久青草精品38国产免费| 亚洲天堂在线播放| 一二三四影视在线看片免费| 中文字幕亚洲综合久久综合| 国产精品无码一二区免费| WWW国产成人免费观看视频| 亚洲成av人片在线观看无码不卡| 暖暖免费在线中文日本| 91午夜精品亚洲一区二区三区| 免费国产黄线在线观看 | fc2成年免费共享视频18| 国产亚洲综合成人91精品| 曰批全过程免费视频网址| 亚洲人6666成人观看| 吃奶摸下高潮60分钟免费视频 | 在线看亚洲十八禁网站| 国产亚洲精午夜久久久久久| 人妻无码久久一区二区三区免费| 亚洲五月丁香综合视频| 亚洲国产成人久久综合一区77| 国产精品美女久久久免费| 亚洲男女一区二区三区| 国产成人在线免费观看| 18禁在线无遮挡免费观看网站| 亚洲一级黄色大片| 国产亚洲av片在线观看18女人| 91免费在线播放| 日韩在线观看免费完整版视频| 亚洲精品国产肉丝袜久久| 亚洲第一成人影院|