您的位置:首页 > 其它

学习ServiceMix笔记(四) 学习ServiceMix的基本命令之停止启动服务

2014-04-17 00:00 531 查看
摘要: 继续命令介绍,建立一个简单的camel文件管理服务,并进行管理

  继续命令介绍,建立一个简单的camel文件管理服务,并进行管理

  先把文档里quickstart关于Routing with Camel的例子抄过来

<?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>


保存成一个本地文件,文件名?随便想写什么写什么,发布目录下只认格式,不认文件名。我存储为transfile.xml,最后复制一份放到deploy目录下。

运行list(osgi:list)命令,

karaf@root> list
START LEVEL 100 , List Threshold: 50
ID   State         Blueprint      Spring    Level  Name
[  75] [Active     ] [            ] [       ] [   50] geronimo-annotation_1.0_sp
ec (1.1.1)
[  76] [Active     ] [            ] [       ] [   50] geronimo-jms_1.1_spec (1.1
.1)
[  77] [Active     ] [            ] [       ] [   50] geronimo-j2ee-management_1
.1_spec (1.0.1)
[  78] [Active     ] [            ] [       ] [   50] JAXB2 Basics - Runtime (0.
6.4)
[  79] [Active     ] [            ] [       ] [   50] Apache ServiceMix :: Bundl
es :: jaxb-impl (2.2.1.1_2)
[  80] [Active     ] [            ] [       ] [   50] Commons Pool (1.6.0)
[  81] [Active     ] [            ] [       ] [   50] Commons Net (3.3.0)
[  82] [Active     ] [            ] [       ] [   50] ZooKeeper Bundle (3.4.5)
[  83] [Active     ] [            ] [       ] [   50] Apache XBean :: Spring (3.
14.0)
[  84] [Active     ] [Created     ] [       ] [   50] activemq-osgi (5.9.0)
[  85] [Active     ] [Created     ] [       ] [   50] activemq-karaf (5.9.0)
[  86] [Active     ] [            ] [       ] [   50] Commons Collections (3.2.1
)
[  87] [Active     ] [            ] [       ] [   50] Commons Lang (2.6)
[  88] [Active     ] [            ] [       ] [   50] Commons Codec (1.4)
[  89] [Active     ] [            ] [       ] [   50] Apache ServiceMix :: Bundl
es :: velocity (1.7.0.5)
[  90] [Active     ] [            ] [       ] [   50] Apache ServiceMix :: Bundl
es :: jasypt (1.9.0.1)
[  91] [Active     ] [            ] [       ] [   50] Apache ServiceMix :: Specs
:: Stax API 1.0 (1.9.0)
[  92] [Active     ] [            ] [       ] [   50] Apache ServiceMix :: Bundl
es :: xpp3 (1.1.0.4c_5)
[  93] [Active     ] [            ] [       ] [   50] Joda-Time (1.6.2)
[  94] [Active     ] [            ] [       ] [   50] Apache ServiceMix Bundles:
xstream-1.3 (1.3.0.3)
[  95] [Active     ] [            ] [       ] [   50] Apache Aries Transaction M
anager (1.0.0)
[  96] [Active     ] [            ] [       ] [   50] geronimo-j2ee-connector_1.
5_spec (2.0.0)
[  97] [Active     ] [            ] [       ] [   50] Apache Aries Util (1.0.0)
[  98] [Active     ] [            ] [       ] [   50] activeio-core (3.1.4)
[  99] [Active     ] [            ] [       ] [   50] jettison (1.3.4)
[ 100] [Active     ] [            ] [       ] [   50] Jackson JSON processor (1.
9.12)
[ 101] [Active     ] [            ] [       ] [   50] Data mapper for Jackson JS
ON processor (1.9.12)
[ 102] [Active     ] [            ] [       ] [   50] Apache ServiceMix :: Bundl
es :: scala-library (2.9.1.3)
[ 103] [Active     ] [Created     ] [       ] [   50] Apache ServiceMix :: Activ
eMQ :: Service (5.0.0)
[ 110] [Active     ] [            ] [       ] [   50] camel-core (2.12.3)
[ 111] [Active     ] [Created     ] [       ] [   50] camel-karaf-commands (2.12
.3)
[ 118] [Active     ] [            ] [       ] [   50] camel-spring (2.12.3)
[ 119] [Active     ] [Created     ] [       ] [   50] camel-blueprint (2.12.3)
[ 180] [Active     ] [            ] [       ] [   50] Apache CXF Compatibility B
undle Jar (2.7.10)
[ 181] [Active     ] [Created     ] [       ] [   50] camel-cxf-transport (2.12.
3)
[ 182] [Active     ] [Created     ] [       ] [   50] camel-cxf (2.12.3)
[ 189] [Resolved   ] [            ] [       ] [   80] Apache Felix Metatype Serv
ice (1.0.10)
[ 190] [Resolved   ] [            ] [       ] [   80] Apache Karaf :: Web Consol
e :: Branding (2.3.4)
Hosts: 196
[ 193] [Active     ] [            ] [       ] [   50] camel-jms (2.12.3)
[ 194] [Active     ] [Created     ] [       ] [   80] transfile.xml (0.0.0)
[ 195] [Active     ] [Created     ] [       ] [   80] aqlog.xml (0.0.0)
[ 201] [Active     ] [            ] [       ] [   50] Apache ServiceMix :: Bundl
es :: jsch (0.1.50.1)
[ 202] [Installed  ] [            ] [       ] [   50] camel-ftp (2.12.3)
karaf@root>


……,太多了看不清在那里!

karaf@root> list | grep xml
[ 194] [Active     ] [Created     ] [       ] [   80] transfile.xml (0.0.0)
[ 195] [Active     ] [Created     ] [       ] [   80] aqlog.xml (0.0.0)
karaf@root>:


还是用grep命令吧 "transfile.xml"的服务句柄是194,关闭它(stop/osgi:stop)

karaf@root> stop 194
karaf@root>


然后再list显示一下服务状态看看。变成"Resolved"了吧,再打开(start/osgi:start)服务,list显示一下状态。

至于这个服务是干什么的?quickstart关于Routing with Camel有具体讲解

在学习这些东西的时候可以参考一下 http://blog.csdn.net/majian_1987/article/category/1390899有关camel用java代码实现的文件转移例子。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: