我从 ServiceMix 4.4.0 中获取了简单的 activemq-camel-blueprint 示例,并添加到 Mina TCP 套接字中以从 ASCII 行中读取。
<camelContext xmlns="http://camel.apache.org/schema/blueprint">
<route>
<from uri="mina:tcp://localhost:4001?textline=true&sync=false" />
<bean ref="NMEAString" method="ingest" />
<to uri="activemq:queue:LOG.ME"/>
</route>
<route>
<from uri="activemq:queue:LOG.ME" />
<to uri="log:ExampleActiveMQRouterBlueprint" />
</route>
</camelContext>
我在 Karaf 中运行示例。NMEAString 所做的只是将对象打印到 STDOUT。
我运行一个小程序将 ASCII 文件推送到套接字连接。它在几毫秒内推入整个文件(〜40)行。
我在 Karaf 中看到一个 STDOUT 打印输出,行间间隔大约 30 秒。我的 servicemix.log 文件中出现以下异常:
有谁知道这个异常是什么意思以及为什么用这样一个简单的例子抛出它?
org.apache.camel.CamelException:org.apache.camel.CamelExchangeException:无法写入正文。Exchange[消息:[Body is null]] 在 org.apache.camel.component.mina.MinaConsumer$ReceiveHandler.exceptionCaught(MinaConsumer.java:91)[186:org.apache.camel.camel-mina:2.8.3]在 org.apache.mina.common.support.AbstractIoFilterChain$TailFilter.exceptionCaught(AbstractIoFilterChain.java:564)[187:org.apache.servicemix.bundles.mina:1.1.7.5] 在 org.apache.mina.common.support .AbstractIoFilterChain.callNextExceptionCaught(AbstractIoFilterChain.java:345)[187:org.apache.servicemix.bundles.mina:1.1.7.5] 在 org.apache.mina.common.support.AbstractIoFilterChain.access$1000(AbstractIoFilterChain.java:53) [187:org.apache.servicemix.bundles.mina:1.1.7.5] 在 org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1。exceptionCaught(AbstractIoFilterChain.java:643)[187:org.apache.servicemix.bundles.mina:1.1.7.5] 在 org.apache.mina.filter.executor.ExecutorFilter.processEvent(ExecutorFilter.java:224)[187:org .apache.servicemix.bundles.mina:1.1.7.5] 在 org.apache.mina.filter.executor.ExecutorFilter$ProcessEventsRunnable.run(ExecutorFilter.java:264)[187:org.apache.servicemix.bundles.mina:1.1 .7.5] 在 java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)[:1.6.0_29] 在 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)[:1.6 .0_29] at java.lang.Thread.run(Thread.java:662)[:1.6.0_29] 原因:org.apache.camel.CamelExchangeException:无法写入正文。在 org.apache.camel.component.mina.MinaHelper.writeBody(MinaHelper.java:55)[186:org.apache.