using System; using IBM.WMQ; using System.Collections; namespace DaoCommon { public class MQHelper { public static void closeQueueSafe(MQQueue queue) { if (queue != null && queue.IsOpen) { try { queue.Close(); } catch (Exception e) { Console.WriteLine("Error cleaning up queue " + e.Message); } } } public static void closeQueueManagerSafe(MQQueueManager mqMgr) { if (mqMgr != null && mqMgr.IsOpen) { try { mqMgr.Close(); } catch (Exception e) { Console.WriteLine("Error cleaning up qmgr " + e.Message); } } } public static Hashtable getConnectionProperties(string mqHost, string mqChannel) { Hashtable connProperties = new Hashtable(); connProperties.Add(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_CLIENT); connProperties.Add(MQC.HOST_NAME_PROPERTY, mqHost); connProperties.Add(MQC.CHANNEL_PROPERTY, mqChannel); return connProperties; } } }