0
我能夠成功地集成ActiveMQ(在綁定消息驅動的通道)和Kafka(作爲出站通道)。它工作正常。春季集成:MQSeries消息驅動的適配器不工作
現在,既然ActiveMQ和MQ系列都符合JMS,我認爲轉換會更容易。但是,它的下面錯誤投擲:
Setup of JMS Message listener invoker failed for destination 'queue://abcd' - trying to recover - Cause: JMSQ1112: The operation for a domain specific object was not valid. The operation 'createConsumer' is not valid for type 'com.ibm.mq.jms.MQQueue'
我的Spring集成的配置看起來像如下:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jms="http://www.springframework.org/schema/integration/jms"
xmlns:integration="http://www.springframework.org/schema/integration"
xmlns:int-kafka="http://www.springframework.org/schema/integration/kafka"
xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/integration/jms
http://www.springframework.org/schema/integration/jms/spring-integration-jms.xsd
http://www.springframework.org/schema/integration/kafka
http://www.springframework.org/schema/integration/kafka/spring-integration-kafka.xsd">
<jms:message-driven-channel-adapter id="requestChannelAdapter" channel="requestChannel"
container="requestListenerContainer" error-channel=""/>
<int-kafka:outbound-channel-adapter
id="kafkaOutboundChannelAdapter" kafka-template="kafkaTemplate"
auto-startup="true" sync="true" channel="inputToKafka" topic="test">
</int-kafka:outbound-channel-adapter>
</beans>
和我各自的代碼看起來象下面這樣:
public MQQueueConnectionFactory jmsConnectionfactory() {
MQQueueConnectionFactory jmsFactory = new MQQueueConnectionFactory();
jmsFactory.setHostName(hostname);
jmsFactory.setPort(1444);
jmsFactory.setQueueManager(//valid queue manager);
jmsFactory.setChannel(//valid channel name);
jmsFactory.setTransportType(1);
jmsFactory.setSSLCipherSuite(// valid suite);
return jmsFactory;
}
@Bean
public DefaultMessageListenerContainer requestListenerContainer() {
DefaultMessageListenerContainer container = new DefaultMessageListenerContainer();
container.setConnectionFactory(jmsConnectionfactory());
container.setSessionTransacted(true);
container.setDestination(helloJMSQueue());
return container;
}
@Bean
public Queue helloJMSQueue() {
return new MQQueue(HELLO_QUEUE);
}
爲什麼我得到這個錯誤?我看到一些帖子,這是由於publocal值在jmsTemplate w.r.t MQQueue中不可用,但是這可以追溯到2005年,我注意到更改已經發布。