I am able to run the below Java code to send a message to SonicMQ JMS queue. It is copied from here:
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.JMSException;
import javax.jms.MessageProducer;
import javax.jms.Session;
public class JmsClient
{
public static void main(String[] args) throws JMSException
{
ConnectionFactory factory = new progress.message.jclient.ConnectionFactory("tcp://<host>:<port>", "<user>", "<password>");
Connection connection = factory.createConnection();
try
{
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
try
{
MessageProducer producer = session.createProducer(session.createQueue("<queue>"));
try
{
producer.send(session.createTextMessage("<message body>"));
}
finally
{
producer.close();
}
}
finally
{
session.close();
}
}
finally
{
connection.close();
}
}
}
However, I get error:
javax.jms.InvalidDestinationException: Queue not found
I think this is because I need to specify queue "Domain Name." Where to put "Domain Name" in this code?
As stated here the following JNDI parameter should be set:
sonicsw.jndi.mfcontext.domain=[Domain_Name]
How to set JNDI parameter in the code above?