简体   繁体   English

Spring boot + JMS + IBM MQ

[英]Spring boot + JMS + IBM MQ

I'm trying to send a message to a IBM MQ queue from my spring boot service. 我正在尝试从Spring启动服务向IBM MQ队列发送消息。 Configuration is as follows: 配置如下:

Application.properties Application.properties

ibm.mq.queueManager=QM1
ibm.mq.queue=DEV.QUEUE.1
ibm.mq.channel=DEV.APP.RECEIVER
ibm.mq.host=localhost
ibm.mq.port=1414

ConectionFactory Bean ConectionFactory Bean

@Bean
        public MQQueueConnectionFactory mqQueueConnectionFactory() {
            MQQueueConnectionFactory mqQueueConnectionFactory = new MQQueueConnectionFactory();
            mqQueueConnectionFactory.setHostName(host);
            try {
                mqQueueConnectionFactory.setTransportType(WMQConstants.ADMIN_QUEUE_DOMAIN);
                mqQueueConnectionFactory.setCCSID(1208);
                mqQueueConnectionFactory.setChannel(channel);
                mqQueueConnectionFactory.setPort(port);
                mqQueueConnectionFactory.setQueueManager(queueManager);
            } catch (Exception e) {
                e.printStackTrace();
            }
            return mqQueueConnectionFactory;
        }

IBM MQ Explorer pictures IBM MQ Explorer图片

queue 队列 队列

channel 渠道 渠道

listener 倾听者 倾听者

When i try to send a message i get the error: 当我尝试发送消息时,我收到错误:

'2' ('MQCC_FAILED') razón '2539' ('MQRC_CHANNEL_CONFIG_ERROR').

What i'm missing? 我错过了什么? The error sugest than my chammel type is not adecuate to my request, but i don't know waht does it means. 比我的chammel类型错误更难以满足我的要求,但我不知道是否意味着它。

Thanks in advance. 提前致谢。

客户端程序连接到SVRCONN通道,而不是RECEIVER。

It appears (as Mark mentioned) you are using the wrong channel type. 看来(正如Mark所说)你使用的是错误的频道类型。 I quick google tells me that Spanish Receptor translates in English to Receiver . 我快速谷歌告诉我,西班牙语Receptor将英语翻译成Receiver A Receiver type channel is a Message channel and is used for queue manager to queue manager communication. Receiver类型通道是Message通道,用于队列管理器到队列管理器通信。

For MQ Client (ex: spring boot) to queue manager communication you need to connect to a MQI channel, on the queue manager this will have the type server connection. 对于MQ Client(例如:spring boot)到队列管理器通信,您需要连接到MQI通道,在队列管理器上,这将具有类型服务器连接。


The IBM MQ v8 Knowledge Center page " IBM MQ Explorer>Configuring IBM MQ using MQ Explorer>Creating and configuring queue managers and objects>Objects in MQ Explorer>Channels " documents this: IBM MQ v8知识中心页面“ IBM MQ Explorer>使用MQ Explorer配置IBM MQ>创建和配置队列管理器和对象> MQ Explorer中的对象>通道 ”文档:

Message channel 消息频道
A message channel is a unidirectional communications link between two queue managers. 消息通道是两个队列管理器之间的单向通信链接。 IBM MQ uses message channels to transfer messages between the queue managers . IBM MQ使用消息通道在队列管理器之间传输消息 To send messages in both directions, you must define a channel for each direction. 要在两个方向上发送消息,您必须为每个方向定义一个通道。

MQI channel MQI频道
An MQI channel is bidirectional and connects an application (MQI client) to a queue manager on a server machine. MQI通道是双向的, 并将应用程序(MQI客户端)连接到服务器计算机上的队列管理器 IBM MQ uses MQI channels to transfer MQI calls and responses between MQI clients and queue managers. IBM MQ使用MQI通道在MQI客户端和队列管理器之间传输MQI调用和响应。

IBM documents each type further down the page: IBM在页面下方记录每种类型:

Message channels 消息频道

Message channel definitions can be one of the following types: 消息通道定义可以是以下类型之一:

Receiver 接收器
A receiver channel is a message channel that the queue manager uses to receive messages from other queue managers . 接收方通道是队列管理器用于从其他队列管理器接收消息的消息通道。 To receive messages using a receiver channel, you must also create, on the other queue manager, a sender or a server channel with the same name as this receiver channel. 要使用接收方通道接收消息,还必须在另一个队列管理器上创建与此接收方通道同名的发送方或服务器通道。

MQI channels MQI渠道

MQI channels can be one of the following types: MQI通道可以是以下类型之一:

Server connection 服务器连接
A server connection channel is a bidirectional MQI channel that is used to connect an IBM MQ client to an IBM MQ server . 服务器连接通道是双向MQI通道,用于将IBM MQ客户机连接到IBM MQ服务器 The server connection channel is the server end of the channel. 服务器连接通道是通道的服务器端。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM