Hi @ all.
I've following following setup of Servicemix:
TCP Client -----> TCP BC-->drools BC ------> TCP BC ---> TCP
Server
|____>HTTP BC -->
HTTP Server
If I connect (target Service) my own written TCP BC to the HTTP
BC or the
TCP BC it works fine (sync, async, Pattern: Inout, InOnly).
I get a problem if the drools engine get into the message
chain. Then I only
can send 23 Messages (always 23!!) until my tcp client reports
me a
connection timeout and the connectors get stuck. I can only
press STRG+C in
the Servicemix Console Window to restart Servicemix and send 23
Messages.
This sending of this 23 Messages work fine. They take the way I
defined in
my .drl where it depends on the message content if it is send
to the tcp or
the http server. I also get the response back to the client.
This is the output when I press STRG+C. This whole stacktrace
is printed out
23 times.
INFO - ServiceAssemblyLifeCycle - Shutting down service
assembly:
droolsrouter-sa
INFO - ServiceUnitLifeCycle - Shutting down service
unit:
droolsrouter-su
INFO - ServiceUnitLifeCycle - Shutting down service
unit:
httpprovider-su
INFO - ServiceUnitLifeCycle - Shutting down service
unit:
tcpconsumer-su
INFO - ServiceUnitLifeCycle - Shutting down service
unit:
tcpprovider-su
INFO - JBIContainer - ServiceMix JBI Container
(ServiceMix) stopped
[Fatal Error] :1:89: Content is not allowed in trailing section.
ERROR - DroolsComponent - Error processing
exchange InOut[
id: ID:10.22.20.113-11b93600c6f-4:0
status: Active
role: provider
service: {http://knapp.com/tcphttp}myRouter
endpoint: myRouter
in: <?xml version="1.0" encoding="UTF-8"?><message
type="http"><text>hallo</text></message>
out: Unable to display: org.xml.sax.SAXParseException:
Content is not
allowed in trailing section.
]
org.drools.spi.ConsequenceException:
javax.jbi.messaging.MessagingException:
java.lang.InterruptedException
at
org.drools.base.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:13
)
at
org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:558)
at
org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:518)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:475)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:439)
at
org.apache.servicemix.drools.DroolsEndpoint.drools(DroolsEndpoint.java:183)
at
org.apache.servicemix.drools.DroolsEndpoint.process(DroolsEndpoint.java:177)
at
org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:597)
at
org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:548)
at
org.apache.servicemix.common.AsyncBaseLifeCycle.onMessageExchange(AsyncBaseLifeCycle.java:502)
at
org.apache.servicemix.common.SyncLifeCycleWrapper.onMessageExchange(SyncLifeCycleWrapper.java:60)
at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:610)
at
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:172)
at
org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:168)
at
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)
Caused by: javax.jbi.messaging.MessagingException:
java.lang.InterruptedException
at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.sendSync(DeliveryChannelImpl.java:498)
at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.sendSync(DeliveryChannelImpl.java:442)
at
org.apache.servicemix.common.EndpointDeliveryChannel.sendSync(EndpointDeliveryChannel.java:102)
at
org.apache.servicemix.drools.model.JbiHelper.routeTo(JbiHelper.java:151)
at
org.apache.servicemix.drools.model.JbiHelper.route(JbiHelper.java:109)
at
org.apache.servicemix.drools.Rule_tcphttp_http_0.consequence(Rule_tcphttp_http_0.java:14)
at
org.apache.servicemix.drools.Rule_tcphttp_http_0ConsequenceInvoker.evaluate(Rule_tcphttp_http_0ConsequenceInv
oker.java:20)
at
org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:554)
... 16 more
Caused by: java.lang.InterruptedException
at java.lang.Object.wait(Native Method)
at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.waitForExchange(DeliveryChannelImpl.java:699)
at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.sendSync(DeliveryChannelImpl.java:472)
... 23 more
ERROR - DroolsComponent - Error setting exchange
status to
ERROR
java.lang.IllegalStateException: component is not owner when
trying to set
error: org.drools.spi.ConsequenceException: j
avax.jbi.messaging.MessagingException:
java.lang.InterruptedException
at
org.apache.servicemix.jbi.messaging.MessageExchangeImpl.setError(MessageExchangeImpl.java:264)
at
org.apache.servicemix.common.AsyncBaseLifeCycle.onMessageExchange(AsyncBaseLifeCycle.java:516)
at
org.apache.servicemix.common.SyncLifeCycleWrapper.onMessageExchange(SyncLifeCycleWrapper.java:60)
at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:610)
at
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:172)
at
org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:168)
at
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)
Caused by: org.drools.spi.ConsequenceException:
javax.jbi.messaging.MessagingException:
java.lang.InterruptedException
at
org.drools.base.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:13
)
at
org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:558)
at
org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:518)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:475)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:439)
at
org.apache.servicemix.drools.DroolsEndpoint.drools(DroolsEndpoint.java:183)
at
org.apache.servicemix.drools.DroolsEndpoint.process(DroolsEndpoint.java:177)
at
org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:597)
at
org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:548)
at
org.apache.servicemix.common.AsyncBaseLifeCycle.onMessageExchange(AsyncBaseLifeCycle.java:502)
... 8 more
Caused by: javax.jbi.messaging.MessagingException:
java.lang.InterruptedException
at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.sendSync(DeliveryChannelImpl.java:498)
at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.sendSync(DeliveryChannelImpl.java:442)
at
org.apache.servicemix.common.EndpointDeliveryChannel.sendSync(EndpointDeliveryChannel.java:102)
at
org.apache.servicemix.drools.model.JbiHelper.routeTo(JbiHelper.java:151)
at
org.apache.servicemix.drools.model.JbiHelper.route(JbiHelper.java:109)
at
org.apache.servicemix.drools.Rule_tcphttp_http_0.consequence(Rule_tcphttp_http_0.java:14)
at
org.apache.servicemix.drools.Rule_tcphttp_http_0ConsequenceInvoker.evaluate(Rule_tcphttp_http_0ConsequenceInv
oker.java:20)
at
org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:554)
... 16 more
Caused by: java.lang.InterruptedException
at java.lang.Object.wait(Native Method)
at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.waitForExchange(DeliveryChannelImpl.java:699)
at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.sendSync(DeliveryChannelImpl.java:472)
... 23 more
So my rule.drl looks like:
package org.apache.servicemix.drools
import org.apache.servicemix.drools.model.Exchange;
global org.apache.servicemix.drools.model.JbiHelper jbi;
rule "tcphttp:http"
when
me : Exchange( status == Exchange.ACTIVE, inmsg : in !=
null );
eval( inmsg.xpath("/message/@type = \"http\""))
then
System.out.println("!!!!!!!!!!!!!!!!!!!!!http!!!!!!!!!!!!!!!!!!!!!!!
");
jbi.route(
"service:http://knapp.com/tcphttp/dhttp_provider" );
end
rule "tcphttp:tcp"
when
me : Exchange( status == Exchange.ACTIVE, inmsg : in !=
null );
eval( inmsg.xpath("/message/@type = \"tcp\""));
then
System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!tcp!!!!!!!!!!!!!!!!!!
");
jbi.route(
"service:http://knapp.com/tcphttp/dtcp_provider" );
end
My xbean.xml for the drools su:
<beans xmlns:drools="http://servicemix.apache.org/drools/1.0"
xmlns:tcphttp="http://knapp.com/tcphttp"
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://servicemix.apache.org/drools/1.0
http://servicemix.apache.org/schema/servicemix-drools-3.2.2.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<drools:endpoint service="tcphttp:myRouter"
endpoint="myRouter"
ruleBaseResource="classpath:rule.drl"
namespaceContext="#nsContext" />
<drools:namespace-context id="nsContext">
<drools:namespaces>
<drools:namespace
prefix="tcphttp">http://knapp.com/tcphttp</drools:namespace>
</drools:namespaces>
</drools:namespace-context>
</beans>