Hi, lately I wrote about radius project. It’s already done. Now we are testing. But in a meantime I just want to mark one thing about sending jms message to remote server. All you need to do is to set “addresslist” property in QueueConnectionFactory on local machine and of course create comparable QueueConnectionFactory on remote.
For
Glassfish Admin Panel / Resources/ JMS Resources/ connection factories:
jms/akira/connectionfactory + property addresslist= 10.17.210.66:7676 (host:port)
Glassfish Admin Panel / Resources/ JMS Resources/ JMS Destination Resources
jms/queue/devilman + queue name devilman
and simple example of code to send msg using that remote JMS Connection Factories
public void sendTestMSg(String msgText) throws NamingException, JMSException {
QueueConnection queueCon = null;
try {
// get the initial context, refer to your app server docs for this
Context ctx = new InitialContext();
// get the connection factory, and open a connection
QueueConnectionFactory qcf = (QueueConnectionFactory) ctx.lookup("jms/akira/connectionfactory");
queueCon = qcf.createQueueConnection();
// create queue session off the connection
QueueSession queueSession = queueCon.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
// get handle on queue, create a sender and send the message
Queue queue = (Queue) ctx.lookup("jms/queue/devilman");
QueueSender sender = queueSession.createSender(queue);
Message msg = queueSession.createTextMessage("hello...");
msg.setBooleanProperty("ACK_DEBUG", true);
msg.setFloatProperty("ACK_BALANCE", 24234.44f);
sender.send(msg);
System.out.println("sent the message");
} finally {
// close the queue connection
if (queueCon != null) {
queueCon.close();
}
}
}
And of course you need to make appreciate imports to test this method.
That was a simple tip. I was searching through the web for it and it wasn’t obvious to find it on oracle pages.