如何处理骆驼快速修复无法发送异常? [英] How to handle camel-quickfix CannotSendException?

查看:26
本文介绍了如何处理骆驼快速修复无法发送异常?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 camel-quickfix 组件.有时,我收到 CannotSendException 并且不清楚异常原因是什么.我看了代码,但似乎在无法发送消息时抛出此异常 - 无论原因如何.

I am using QuickFix/J 1.6.4 in a camel-quickfix component. Sometimes, I get the CannotSendException and it is not clear, what the exception cause is. I looked at the code, but there it seems that this exception is thrown, when the message could not be send - regardless of the reason.

那么我该如何处理这个异常呢?我是否必须实现重试机制,或者引擎是否会为我处理?如果引擎这样做,我如何验证消息是否在之后发送?

So how do I have to handle this exception? Do I have to implement a retry mechanism, or does the engine handle this for me? If the engine does, how can I verify, that the message is sent afterwards?

异常堆栈跟踪(我用 *** 替换了 FIX 消息,因为我无法发布它):

Exception Stacktrace (I replaced the FIX message with *** because I cannot publish it):

org.apache.camel.component.quickfixj.CannotSendException: Cannot send FIX message: ***
at org.apache.camel.component.quickfixj.QuickfixjProducer.sendMessage(QuickfixjProducer.java:75)
at org.apache.camel.component.quickfixj.QuickfixjProducer.process(QuickfixjProducer.java:47)
at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:145)
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:468)
at org.apache.camel.spring.spi.TransactionErrorHandler.processByErrorHandler(TransactionErrorHandler.java:220)
at org.apache.camel.spring.spi.TransactionErrorHandler.process(TransactionErrorHandler.java:101)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:171)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:121)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:83)
at org.apache.camel.processor.ChoiceProcessor.process(ChoiceProcessor.java:117)
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:468)
at org.apache.camel.spring.spi.TransactionErrorHandler.processByErrorHandler(TransactionErrorHandler.java:220)
at org.apache.camel.spring.spi.TransactionErrorHandler$1.doInTransactionWithoutResult(TransactionErrorHandler.java:183)
at org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:33)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:131)
at org.apache.camel.spring.spi.TransactionErrorHandler.doInTransactionTemplate(TransactionErrorHandler.java:176)
at org.apache.camel.spring.spi.TransactionErrorHandler.processInTransaction(TransactionErrorHandler.java:136)
at org.apache.camel.spring.spi.TransactionErrorHandler.process(TransactionErrorHandler.java:105)
at org.apache.camel.spring.spi.TransactionErrorHandler.process(TransactionErrorHandler.java:114)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:196)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:121)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:83)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:196)
at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:109)
at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:91)
at org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:112)
at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:555)
at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:515)
at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:485)
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:325)
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:243)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1103)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1095)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:992)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1164)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:634)
at java.lang.Thread.run(Thread.java:809)

推荐答案

我找到了 讨论这个话题camel-quickfix 版本可能无法确保发送 FIX 消息.这已通过 CAMEL-5247 补丁和 CannotSendException 更改 已添加.因此,现在可以将 FIX 消息的发送配置为同步写入 使用 SocketSynchronousWrites,即使出于性能原因不推荐这样做.

I have found the nabble on this topic and in camel-quickfix versions before Camel 2.10.0 it was probably not possible to ensure that a FIX message was sent. This has been changed with the CAMEL-5247 patch and the CannotSendException has been added. So it is now possible to configure the sending of FIX messages as a synchronous write with SocketSynchronousWrites, even if it is not recommended for performance reasons.

同步写入消息.通常不建议这样做,因为它可能会导致性能下降.MINA 通信层在设计上是异步的,但如果需要,此选项将覆盖该行为.

Write messages synchronously. This is not generally recommended as it may result in performance degradation. The MINA communication layer is asynchronous by design, but this option will override that behavior if needed.

所以现在您还可以获得有关 FIX 消息发送失败的信息,即使您不使用 SocketSynchronousWrites.然后必须在应用程序中实现错误处理.

So now you can also get info about failed sending of FIX messages, even if you do not use SocketSynchronousWrites. The error handling must then be implemented in the application.

这篇关于如何处理骆驼快速修复无法发送异常?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆