Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to connect to MQ using Java

Tags:

java

ibm-mq

I want to make a connection & send a string to MQ using JAVA.

Following are the MQ details.

  • JNDI Name: ABCDEFH
  • Queue Manager: ABCDEFH
  • Host Name or IP Address: ABCDEFH
  • Port: ABCDEFH
  • Channel: ABCDEFH
  • Transport Type: ABCDEFH

I am new to this, so can you please help me with sample code for this. Thanks!

like image 965
Amrinder Singh Avatar asked Dec 17 '25 18:12

Amrinder Singh


1 Answers

There are two different APIs you can use to send an MQ message using the Java language. You can use the MQ Classes for Java and you can use the JMS API.

Since you mention JNDI, I suspect you mean the JMS API. However, I will answer for both. You sound like you want some sample code. The IBM MQ product supplies you with sample code to look at.

For the MQ Classes for Java, I suggest you look at <wmq-installation-directory>\Tools\wmqjava\samples\MQSample.java - that's the "Hello World" app for the Java classes.

For the JMS interface, I suggest you look at <wmq-installation-directory>\Tools\jms\samples\JmsProducer.java

like image 184
Morag Hughson Avatar answered Dec 20 '25 07:12

Morag Hughson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!