Estefania gil Vaquero
Estefania gil Vaquero

Reputation: 51

Spring boot + JMS + IBM MQ

I'm trying to send a message to a IBM MQ queue from my spring boot service. Configuration is as follows:

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

@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

queue queue

channel channel

listener 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.

Thanks in advance.

Upvotes: 3

Views: 18662

Answers (2)

JoshMc
JoshMc

Reputation: 10652

It appears (as Mark mentioned) you are using the wrong channel type. I quick google tells me that Spanish Receptor translates in English to Receiver. A Receiver type channel is a Message channel and is used for queue manager to queue manager communication.

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.


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:

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. To send messages in both directions, you must define a channel for each direction.

MQI channel
An MQI channel is bidirectional and connects an application (MQI client) to a queue manager on a server machine. IBM MQ uses MQI channels to transfer MQI calls and responses between MQI clients and queue managers.

IBM documents each type further down the page:

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 channels can be one of the following types:

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. The server connection channel is the server end of the channel.

Upvotes: 1

Mark Taylor
Mark Taylor

Reputation: 1017

Client programs connect to SVRCONN channels, not RECEIVERs.

Upvotes: 2

Related Questions