apache-camel - Apache Camel sjms 批处理失败
问题描述
我正在尝试使用 sjms Camel 组件与 IBM MQ 集成。使用 transacted=false 配置 jms 组件就可以了。只要我尝试使用批处理功能,它就会开始失败。
提前致谢...
端点 DSL:
sjmsComponent://queue:XXX?acknowledgementMode=AUTO_ACKNOWLEDGE&consumerCount=10&transacted=true&transactionBatchCount=10&transactionBatchTimeout=10000
配置:
@Scope(scopeName = "prototype")
@Bean
public JmsConnectionFactory connectionFactory() throws JMSException
{
MQQueueConnectionFactory mqQueueConnectionFactory = new MQQueueConnectionFactory();
mqQueueConnectionFactory.setTransportType(this.mqTransportType);
mqQueueConnectionFactory.setHostName(this.mqHostName);
mqQueueConnectionFactory.setPort(this.mqPort);
mqQueueConnectionFactory.setQueueManager(this.mqQueueManager);
mqQueueConnectionFactory.setChannel(this.mqChannel);
return mqQueueConnectionFactory;
}
@Scope(scopeName = "prototype")
@Bean
public SjmsComponent sjmsComponent(ConnectionFactory connectionFactory) throws JMSException
{
SjmsComponent sjmsComponent = new SjmsComponent();
sjmsComponent.setConnectionFactory(connectionFactory);
return sjmsComponent;
}
由于以下日志中的警告消息未提交并最终保留在 MQ 中。
Warning in logs :
Failed to commit the session during timeout: JMSCC0033: A synchronous method call is not permitted when a session is being used asynchronously: 'commit'.. This exception will be ignored.
com.ibm.msg.client.jms.DetailedIllegalStateException: JMSCC0033: A synchronous method call is not permitted when a session is being used asynchronously: 'commit'.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.ibm.msg.client.commonservices.j2se.NLSServices.createException(NLSServices.java:319)
at com.ibm.msg.client.commonservices.nls.NLSServices.createException(NLSServices.java:226)
at com.ibm.msg.client.jms.internal.JmsErrorUtils.createException(JmsErrorUtils.java:126)
at com.ibm.msg.client.jms.internal.JmsSessionImpl.checkSynchronousUsage(JmsSessionImpl.java:2959)
at com.ibm.msg.client.jms.internal.JmsSessionImpl.commit(JmsSessionImpl.java:753)
at com.ibm.mq.jms.MQSession.commit(MQSession.java:294)
at org.apache.camel.component.sjms.tx.SessionBatchTransactionSynchronization$TimeoutTask.run(SessionBatchTransactionSynchronization.java:135)
at java.util.TimerThread.mainLoop(Timer.java:555)
解决方案
推荐阅读
- mysql - 在 WHERE 子句中无法识别具有替换的子查询
- reactjs - 浏览器后退按钮上未调用 useEffect 清理
- ssh - FIWARE 规则设置远程连接
- python - 我不明白为什么我收到错误“IndexError:字符串索引超出范围”
- python - 如何从列中获取属性高度、宽度、x 和 y?
- java - 如何用匹配子字符串长度的一个字符替换字符串模式?
- html - 不使用 CSS 浮动复制 html 定位
- javascript - 如何制作密码认证程序
- omnet++ - 在 OMNeT++ 中使用 INET 进行仿真时出错
- java - 如何让我的 While 语句正确循环和中断,同时在 java 中输入另一个选项?