我有两个插件,我想在事务控制下.如果其中一个失败,另一个也不会被执行/插入.这样在MySQL中正确执行时工作正常
START TRANSACTION;
INSERT INTO table (field) VALUES (value);
INSERT INTO table2 (field) VALUES (value);
COMMIT;
Run Code Online (Sandbox Code Playgroud)
现在使用骆驼我已经尝试过了
<to uri="sql:START TRANSACTION; INSERT INTO table (field) VALUES (value);INSERT INTO table2 (field) VALUES (value);COMMIT;"/>
Run Code Online (Sandbox Code Playgroud)
这会产生sql语法错误.我尝试的第二件事是
<to uri="sql:START TRANSACTION"/>
<to uri="sql:INSERT INTO table (field) VALUES (value)"/>
<to uri="sql:INSERT INTO table2 (field) VALUES (value)"/>
<to uri="sql:COMMIT"/>
Run Code Online (Sandbox Code Playgroud)
哪个工作但如果一个插入失败,另一个插入仍在执行和插入.
我也找到了这个 http://camel.apache.org/transactional-client.html,但我使用的是蓝图,这些例子似乎只适用于春天.因此,如果有人用骆驼蓝图做了一个很好的例子,这将是很好的.
任何人都可以帮我在骆驼做这个吗?
当我向我的网络服务发送请求(使用 apache camel 构建并在 apache karaf 上运行)时,我总是得到
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<soap:Fault>
<faultcode>soap:Client</faultcode>
<faultstring>Message part {http://localhost:8181/cxf/webservices/inputoutput}input was not recognized. (Does it exist in service WSDL?)</faultstring>
</soap:Fault>
</soap:Body>
</soap:Envelope>
Run Code Online (Sandbox Code Playgroud)
我的 wsdl 看起来像这样
<?xml version="1.0" encoding="ISO-8859-1"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://localhost:8181/cxf/webservices/inputoutput"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
targetNamespace="http://localhost:8181/cxf/webservices/inputoutput">
<!-- Type definitions for input- and output parameters for webservice -->
<wsdl:types>
<xs:schema targetNamespace="http://localhost:8181/cxf/webservices/inputoutput">
<xs:element name="input">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="surname"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="output">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="forename"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
</wsdl:types>
<!-- Message definitions for …Run Code Online (Sandbox Code Playgroud) 我是 Apache camel 的新手,只是尝试使用 RouteBuilder 构建一条 Route,但是一旦我得到一个扩展 RouterBuilder 的类,当我尝试在 Apache karaf 中安装该包时,就会收到此错误:
2015-09-08 14:54:49,227 | WARN | raf-3.0.4/deploy | fileinstall
| 7 - org.apache.felix.fileinstall - 3.5.0 | Error while starting bundle:
file:/C:/apache-karaf-3.0.4/deploy/osgi-1.0-SNAPSHOT.jar
org.osgi.framework.BundleException: Unresolved constraint in bundle osgi [91]: U
nable to resolve 91.0: missing requirement [91.0] osgi.wiring.package; (&(osgi.w
iring.package=org.apache.camel.builder)(version>=2.14.0)(!(version>=3.0.0)))
at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:397
4)[org.apache.felix.framework-4.2.1.jar:]
at org.apache.felix.framework.Felix.startBundle(Felix.java:2037)[org.apa
che.felix.framework-4.2.1.jar:]
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:955)[org.
apache.felix.framework-4.2.1.jar:]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(Di
rectoryWatcher.java:1245)[7:org.apache.felix.fileinstall:3.5.0]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(D
irectoryWatcher.java:1217)[7:org.apache.felix.fileinstall:3.5.0]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(Dire
ctoryWatcher.java:509)[7:org.apache.felix.fileinstall:3.5.0]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(Direct
oryWatcher.java:358)[7:org.apache.felix.fileinstall:3.5.0]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryW
atcher.java:310)[7:org.apache.felix.fileinstall:3.5.0]
Run Code Online (Sandbox Code Playgroud)
现在我只有那两个类
package osgi;
import org.osgi.framework.BundleActivator;
import …Run Code Online (Sandbox Code Playgroud) apache-camel ×3
java ×2
apache ×1
apache-karaf ×1
maven ×1
mysql ×1
soap ×1
transactions ×1
web-services ×1
wsdl ×1
xml ×1