0

Following instructions provided in https://developer.ibm.com/tutorials/mq-jms-application-development-with-spring-boot/, I developed a sample Spring boot web application in order to be able to send and receive messages over IBM MQ using JMS template.

In case of a MQ server not on local host, I updated the application.properties file with:

ibm.mq.conn-name=<my-server-host-name>(<my-server-port>)

Unfortunately this is not the appropriate property as the application is searching for a queue manager on localhost. I did not find in the documentation anything about the property to use for that. And yes, I gave a try to ibm.mq.host and ibm.mq.port.

JoshMc
  • 10,239
  • 2
  • 19
  • 38
fredege
  • 17
  • 1
  • 3
  • What error do you receive? Please edit and add it to the question. – JoshMc Aug 26 '22 at 11:32
  • Not sure that the error message will help. Actually, what happens is that the host remains set to the default "localhost" value and the port to the default 1414 port value. The values given in property "ibm.mq.conn-nam" are not used to set the host and the port. – fredege Aug 26 '22 at 13:31

2 Answers2

0

For IBM config you need to provide the following properties:

Yml extension:

  ibm:
    mq:
      queueManager: {queueManagerName}
      channel: {channelName}
      connName: localhost(1415)
      user: {UserName}

property extension:

ibm.mq.queueManager={queueManagerName}
ibm.mq.channel={channelName}
ibm.mq.connName=localhost(1415)
ibm.mq.user={userName}

connName you can find in the Listener directory: In my case IP address is equal: localhost Port is equal: 1415

channelName you can find in Channels directory.

Andrian Soluk
  • 474
  • 6
  • 12
  • I tried also with connName instead of conn-name but I still have the issue. For more information, I user version 2.7.2 of the mq-jms-spring-boot-starter – fredege Aug 26 '22 at 13:49
  • Reverting from version 2.7.2 of mq-jms-spring-boot-starter to version 2.4.5, the problem disappeared. This confirms that the name of the property has changed. But the new proposed name does not seem to work. – fredege Aug 26 '22 at 15:25
  • Which java and spring-boot versions do you use? – Andrian Soluk Aug 29 '22 at 05:57
  • JDK 11 and Spring Boot 2.7.2 – fredege Aug 29 '22 at 07:22
  • If you want, you can debug source code. `MQConfigurationProperties` class contains method: `getConnName` you can review in debug mode which value is present. https://github.com/ibm-messaging/mq-jms-spring/blob/master/mq-jms-spring-boot-starter/src/main/java/com/ibm/mq/spring/boot/MQConfigurationProperties.java#L224 I checked everything works with java 11 and spring-boot 2.7.2 I used yml extension that I provided in this answer and I can see `this.connName = localhost(1415)` – Andrian Soluk Aug 29 '22 at 17:57
  • Please be aware that default value is localhost(1414) https://github.com/ibm-messaging/mq-jms-spring/blob/master/mq-jms-spring-boot-starter/src/main/java/com/ibm/mq/spring/boot/MQConfigurationProperties.java#L72 – Andrian Soluk Aug 29 '22 at 18:02
  • I realize that I was confused by the error message displayed when I had a queue manager name error. Now that I fixed that error, I confirm that it works fine with JDK 11 and mq-jsm-spring-boot-starter 2.7.2. – fredege Aug 30 '22 at 08:30
  • Nice to hear that this was fixed... Can you please mark my answer as correct? – Andrian Soluk Aug 30 '22 at 08:43
  • May I suggest then that the error message should be reviewed in order to provide the proper host name in case of error. Otherwise this question can be considered as resolved. Thanks for your help. – fredege Aug 30 '22 at 08:43
0

As per https://github.com/ibm-messaging/mq-jms-spring the default connection properties for mq-jms-spring-boot-starter are

The default attributes are

ibm.mq.queueManager=QM1

ibm.mq.channel=DEV.ADMIN.SVRCONN

ibm.mq.connName=localhost(1414)

ibm.mq.user=admin

ibm.mq.password=passw0rd

You will most likely need to set connName, user and password. The default port is 1414, but if you are running MQ in the cloud then you will need to look up in you cloud what port to use. You will get the port from the same place you look up the server url.

You may also need to supply TLS parameters - https://github.com/ibm-messaging/mq-jms-spring#tls-related-options

You can find sample code here - https://github.com/ibm-messaging/mq-dev-patterns/tree/master/Spring-JMS The 101 sample ( https://github.com/ibm-messaging/mq-dev-patterns/tree/master/Spring-JMS/src/main/java/com/ibm/mq/samples/jms/spring/level101 ) has very little code, so a good test of whether the connection parameters are right.

chughts
  • 4,210
  • 2
  • 14
  • 27