I've tried to follow this guide, but problem occured: I have to use spring boot version 2.7.11 which does not contain com.ibm.mq.spring.boot.MQConnectionFactoryFactory class. I assume if the class was removed, there should be another solution to configure multiple ibm mq jms brokers?
I need to create bean MQConnectionFactory which would use my MQConfigurationProperties.
In addition to the tutorial that @Rich mentions take a look at pattern 114 : Custom connection beans https://github.com/ibm-messaging/mq-dev-patterns/tree/eecc42470a821c05e11e0f0fb10477ad01bf6806/Spring-JMS#level-114-sample
which shows how to create a custom connection factory. Which in turn allows two or more custom factories enabling an application to create connections to multiple MQ host / port / channel combinations.
If you have
<dependency>
<groupId>com.ibm.mq</groupId>
<artifactId>mq-jms-spring-boot-starter</artifactId>
<version>3.0.6</version>
</dependency>
as a dependency (current version is 3.1.1), then you should have all the classes you need.
import com.ibm.mq.spring.boot.MQConnectionFactoryFactory;
@Bean
public MQConnectionFactory mqConnectionFactory() throws JMSException {
MQConfigurationProperties properties = new MQConfigurationProperties();
// Properties will be a mix of defaults, and those found in application.properties
// under ibm.mq
// Here we can override any of the properties should we need to
MQConnectionFactoryFactory mqcff = new MQConnectionFactoryFactory(properties,null);
MQConnectionFactory mqcf = mqcff.createConnectionFactory(MQConnectionFactory.class);
return mqcf;
}