Linux安全网 - Linux操作系统_Linux 命令_Linux教程_Linux黑客

会员投稿 投稿指南 本期推荐:
搜索:
您的位置: Linux安全网 > Linux集群 > Architecture > » 正文

mule & seda 学习二

来源: 未知 分享至:
mule的jdbc,配置seda以及vm的初步认识

java类

package com.zxgllhh.jdbc;
import java.util.Map;
public class NumberServiceComponent {
public NumberServiceComponent(){

}
public Object process(Object vm) throws Exception{
Thread.sleep(5000l);
System.out.println();
Map map = (Map)vm;
System.out.println(\"NumberServiceComponent, jdbc message is \"+map.get(\"red_one\"));
System.out.println(\"NumberServiceComponent, this hashcode is \"+this.hashCode());
return \" ..... return NumberServiceComponent is : \"+vm +\" .....\";
}
}

配置文件

<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<mule xmlns=\"http://www.mulesource.org/schema/mule/core/2.2\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
xmlns:spring=\"http://www.springframework.org/schema/beans\"
xmlns:soap=\"http://www.mulesource.org/schema/mule/soap/2.2\"
xmlns:cxf=\"http://www.mulesource.org/schema/mule/cxf/2.2\"
xmlns:stdio=\"http://www.mulesource.org/schema/mule/stdio/2.2\"
xmlns:vm=\"http://www.mulesource.org/schema/mule/vm/2.2\"
xmlns:context=\"http://www.springframework.org/schema/context\"
xmlns:jdbc=\"http://www.mulesource.org/schema/mule/jdbc/2.2\"
xsi:schemaLocation=\"
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.mulesource.org/schema/mule/core/2.2 http://www.mulesource.org/schema/mule/core/2.2/mule.xsd
http://www.mulesource.org/schema/mule/soap/2.2 http://www.mulesource.org/schema/mule/soap/2.2/mule-soap.xsd
http://www.mulesource.org/schema/mule/cxf/2.2 http://www.mulesource.org/schema/mule/cxf/2.2/mule-cxf.xsd
http://www.mulesource.org/schema/mule/stdio/2.2 http://www.mulesource.org/schema/mule/stdio/2.2/mule-stdio.xsd
http://www.mulesource.org/schema/mule/vm/2.2 http://www.mulesource.org/schema/mule/vm/2.2/mule-vm.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.mulesource.org/schema/mule/jdbc/2.2 http://www.mulesource.org/schema/mule/jdbc/2.2/mule-jdbc.xsd\">

<description>
this is a description, to be expert or not to be is not a question.

To invoke the EchoUMO hit the following URL -
http://localhost:65082/services/EchoServiceUMO/echo/requestResultByzxg/zxg

To view the WSDL for the EchoUMO service go to -
http://localhost:65082/services/EchoServiceUMO?wsdl
</description>

<spring:beans>
<spring:import resource=\"classpath:conf/applicationContext.xml\" />
</spring:beans>

<configuration>
<default-threading-profile maxThreadsActive=\"10\" maxBufferSize=\"10\" poolExhaustedAction=\"WAIT\"/>
<default-service-threading-profile maxThreadsActive=\"2\" maxBufferSize=\"2\" poolExhaustedAction=\"WAIT\"/>
</configuration>

<jdbc:connector name=\"jdbcConnectorActive\" pollingFrequency=\"10\" dataSource-ref=\"dataSource\">
<jdbc:query key=\"selectNumber\"
value=\"select t.red_one from win_number t where rownum between 0 and 10 \" />
</jdbc:connector>

<context:property-placeholder location=\"email.properties,system.properties\" />

<!-- CXF下的mule配置 -->

<vm:connector name=\"vmConnector\" queueEvents=\"true\" />

<model name=\"echoSample\">

<service name=\"jdbcService\">
<inbound>
<jdbc:inbound-endpoint queryKey=\"selectNumber\" />
</inbound>
<!--
<component class=\"com.zxgllhh.jdbc.NumberServiceComponent\" />
-->
<!-- 使用对象池技术,在系统启动时就会先创建一批对象(本配置为10个)放在对象池里,等发起调用时,系统不会创建新的对象,because the component will reused -->
<pooled-component class=\"com.zxgllhh.jdbc.NumberServiceComponent\">
<pooling-profile exhaustedAction=\"WHEN_EXHAUSTED_FAIL\" initialisationPolicy=\"INITIALISE_ALL\"
maxActive=\"5\" maxIdle=\"5\" maxWait=\"5\" />
</pooled-component>
<outbound>
<pass-through-router>
<stdio:outbound-endpoint system=\"OUT\"/>
</pass-through-router>
</outbound>
</service>

<service name=\"EchoService\">
<inbound>
<cxf:inbound-endpoint address=\"http://localhost:65082/services/EchoServiceUMO\"
serviceClass=\"com.zxgllhh.testMule.EchoService\"/>
</inbound>
<!-- 每次调用mule都会创建一个新的对象 -->
<component class=\"com.zxgllhh.testMule.impl.EchoComponent\" />

<!-- 配置一个vm Transport -->
<outbound>
<pass-through-router>
<vm:outbound-endpoint address=\"vm://orders\" />
</pass-through-router>
</outbound>
</service>

<!-- 接收vm传来的消息并做处理 -->
<service name=\"serviceName\">
<inbound>
<vm:inbound-endpoint address=\"vm://orders\" />
</inbound>
<!--
<component class=\"${vm-component}\" />
-->
<!-- 使用对象池技术,在系统启动时就会先创建一批对象(本配置为3个)放在对象池里,等发起调用时,系统不会创建新的对象,because the component will reused -->
<pooled-component class=\"${vm-component}\">
<pooling-profile exhaustedAction=\"WHEN_EXHAUSTED_FAIL\" initialisationPolicy=\"INITIALISE_ALL\"
maxActive=\"1\" maxIdle=\"2\" maxWait=\"3\" />
</pooled-component>

<outbound>
<pass-through-router>
<stdio:outbound-endpoint system=\"OUT\"/>
</pass-through-router>
</outbound>
</service>
</model>
<!--
<description>
this is a description, to be expert or not to be is not a question.
</description>

<model name=\"firstMuleModel\">
<service name=\"firstModelService\">
<inbound>
<stdio:inbound-endpoint system=\"IN\"/>
</inbound>
<component class=\"com.zxgllhh.testMule.impl.EchoComponent\"></component>
<outbound>
<pass-through-router>
<stdio:outbound-endpoint system=\"OUT\"/>
</pass-through-router>
</outbound>
</service>
</model>
-->
</mule>
spring配置文件

<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to you under the Apache License, Version
2.0 (the \"License\"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0 Unless required by
applicable law or agreed to in writing, software distributed under the
License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for
the specific language governing permissions and limitations under the
License.
-->
<!-- START SNIPPET: beans -->
<beans xmlns=\"http://www.springframework.org/schema/beans\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:jaxws=\"http://cxf.apache.org/jaxws\"
xsi:schemaLocation=\"
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd\"
>
<!--
<import
resource=\"classpath:conf/framework/spring.framework.ibatis.xml\"></import>

<import
resource=\"classpath:conf/framework/__global/spring.framework.transaction.xml\"></import>
-->

<bean id=\"dataSource\" class=\"com.mchange.v2.c3p0.ComboPooledDataSource\" destroy-method=\"shutdown\">
<property name=\"driverClass\" value=\"oracle.jdbc.driver.OracleDriver\" />
<property name=\"jdbcUrl\" value=\"jdbc:oracle:thin:@127.0.0.1:1521:orcl\" />
<property name=\"acquireIncrement\" value=\"5\" />
<property name=\"initialPoolSize\" value=\"10\" />
<property name=\"maxPoolSize\" value=\"50\" />
<property name=\"minPoolSize\" value=\"10\" />
<property name=\"properties\">
<props>
<prop key=\"user\">ssq</prop>
<prop key=\"password\">ssq</prop>
</props>
</property>
</bean>

<!--
<bean id=\"transactionManager\"
class=\"org.springframework.jdbc.datasource.DataSourceTransactionManager\">
<property name=\"dataSource\">
<ref local=\"dataSource\" />
</property>
</bean>

<bean id=\"sqlMapClient\" class=\"org.springframework.orm.ibatis.SqlMapClientFactoryBean\">
<property name=\"configLocation\" value=\"classpath:conf/sqlmap.config.xml\" />
<property name=\"dataSource\" ref=\"dataSource\" />
</bean>

<bean id=\"sqlMapClientTemplate\" class=\"org.springframework.orm.ibatis.SqlMapClientTemplate\">
<property name=\"sqlMapClient\">
<ref bean=\"sqlMapClient\" />
</property>
</bean>

<bean id=\"SpringContextUtils\" class=\"com.tydic.framework.utils.spring.SpringContextUtils\" />
-->
</beans>
运行类

package com.zxgllhh.run;

import org.mule.api.MuleContext;
import org.mule.api.context.MuleContextFactory;
import org.mule.config.spring.SpringXmlConfigurationBuilder;
import org.mule.context.DefaultMuleContextFactory;

public class EagleMuleMain {
public static void main(String[] args) throws Exception{
try {
String configFile = \"com/zxgllhh/run/mule-config.xml\";
String[] configFileArr = new String[] { configFile };
MuleContextFactory muleContextFactory = new DefaultMuleContextFactory();

Tags:
分享至:
最新图文资讯
1 2 3 4 5 6
验证码:点击我更换图片 理智评论文明上网,拒绝恶意谩骂 用户名:
关于我们 - 联系我们 - 广告服务 - 友情链接 - 网站地图 - 版权声明 - 发展历史