DEV Community

Using multiple JMS servers with Spring Boot

Eduardo Issao Ito on August 13, 2020

Spring Boot support for JMS is straightforward to use. But the default configuration is limited to one server. Let's see how to use more than one ...
Collapse
 
kundycoos profile image
Eng kue

I am getting an error on this line, MQConnectionFactoryFactory is expecting 0 parameters but found 2

return new MQConnectionFactoryFactory(properties, factoryCustomizers.getIfAvailable()).createConnectionFactory(MQConnectionFactory.class);

Collapse
 
adzubla profile image
Eduardo Issao Ito • Edited

Probably you are importing the wrong class... Look at the complete source code with all imports at github.com/adzubla/qmgrs

Collapse
 
greeger profile image
Deev Greg

but I can not import import com.ibm.mq.spring.boot.MQConnectionFactoryFactory;

Collapse
 
singleta_20db82f05b5a4a23 profile image
singleta

Add an extra property of null in between the existing two. It's a new Spring class SSLBundles. It's optional

Collapse
 
nainiacharya0406 profile image
nainiacharya0406

Can you please help me with Producer and consumer for this..

Collapse
 
ctopcanada profile image
ctopCanada

if the situation is that two channels(One is for GET, the other is for PUT), one queue manager, one queue, can I use the same idea for that?

Collapse
 
adzubla profile image
Eduardo Issao Ito • Edited

Yes, you would have two ConnectionFactories with distinct channels. Note that if you are using the same queue manager name for both ConnectionFactories, you should change how the the endpoint Id is constructed.

Collapse
 
akhettar profile image
Ayache Khettar

Thanks for sharing Eduardo. You are referring to only one queue(destination). How do you wire your example to support multiple destinations for given connection manager?

Thanks

Ayache

Collapse
 
fam_developer profile image
Fam Developer

Hi man
I want to delete the message manually but everything I do is automatically read and deleted from the queue. What solution do you offer?

Collapse
 
nainiacharya0406 profile image
nainiacharya0406

By using the dynamic approach I am creating the Producer as well and pushing the message as below:
jmsTemplate.convertAndSend("queueName", "msg");
but getting invocationTargetException there