package implementation;

import javax.jms.ConnectionFactory;
import javax.jms.JMSException;
import javax.jms.QueueConnectionFactory;

public class ClientJMS {
	
	public ConnectionFactory getConnectionFactory() {
		
		return sonicConnectionFactory();}
	public QueueConnectionFactory getQueueConnectionFactory() {
		
		return sonicQueueConnectionFactory();}
	
	private QueueConnectionFactory sonicQueueConnectionFactory() {
		QueueConnectionFactory qcf=null;
		// code pour Sonic MQ
		String broker= "tcp://localhost:2506";		
		try {
			 qcf=(QueueConnectionFactory) new   
			  progress.message.jclient.QueueConnectionFactory (broker);
			 
		} catch (JMSException e) {
		
			e.printStackTrace();
		}
		return qcf;
	}
	private ConnectionFactory sonicConnectionFactory() {
		ConnectionFactory cf=null;
		// code pour Sonic MQ
		String broker= "tcp://localhost:2506";		
		try {
			 cf=(ConnectionFactory) new   
			  progress.message.jclient.ConnectionFactory (broker);
			 
		} catch (JMSException e) {
		
			e.printStackTrace();
		}
		return cf;
	}

}
