The code below will run on top of a Java EE Application Client Container that connects to a remote Glassfish 4.0 server .
I am able to pass messages between client and server but I'm concerned about the confidentiality of data as it passes through public internet connection.
For EJBs, one way to achieve confidentiality is thru RMI/IIOP Over SSL http://docs.oracle.com/cd/E18930_01/html/821-2418/beakv.html#gckgn .
Any ideas encrypting data exhange on a JMS connection?
public class Message {
@Resource(lookup = "java:comp/DefaultJMSConnectionFactory")
private static QueueConnectionFactory connectionFactory;
public void send() {
Connection connection = null;
Session session = null;
try {
connection = connectionFactory.createConnection();
connection.start();
session = connection.createSession();
Queue queue = session.createQueue("queue");
MessageProducer producer = session.createProducer(queue);
String msg = "message-to-send";
producer.send(session.createObjectMessage(msg));
} catch (JMSException ex) {
// log error
} finally {
// close connections
}
}
}