如何处理骆驼快速修正CannotSendException? [英] How to handle camel-quickfix CannotSendException?

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

问题描述

我正在 QuickFix/J 1.6.4. github.com/apache/camel/tree/master/components/camel-quickfix"rel =" nofollow noreferrer> 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?

异常Stacktrace(我将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.

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

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.

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

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