/** * 加载备份MQ配置 * @throws EisException */ public AbstractServiceProvider(String alt) { this.config = CacheManager.getInstance().getConfig(); alt = alt + "."; MQParameter receive = new MQParameter(config.getProperty(alt + ConfigConstants.MQ_PROVIDER_RECV_IP), int.Parse(config.getProperty(alt + ConfigConstants.MQ_PROVIDER_RECV_PORT)), config.getProperty(alt + ConfigConstants.MQ_PROVIDER_RECV_CHANNEL), int.Parse(config.getProperty(alt + ConfigConstants.MQ_PROVIDER_RECV_CCSID)), config.getProperty(alt + ConfigConstants.MQ_PROVIDER_RECV_QMANAGER), config.getProperty(alt + ConfigConstants.MQ_PROVIDER_RECV_QUEUE)); receiveList.Add(receive); MQParameter send = new MQParameter(config.getProperty(alt + ConfigConstants.MQ_PROVIDER_SEND_IP), int.Parse(config.getProperty(alt + ConfigConstants.MQ_PROVIDER_SEND_PORT)), config.getProperty(alt + ConfigConstants.MQ_PROVIDER_SEND_CHANNEL), int.Parse(config.getProperty(alt + ConfigConstants.MQ_PROVIDER_SEND_CCSID)), config.getProperty(alt + ConfigConstants.MQ_PROVIDER_SEND_QMANAGER), config.getProperty(alt + ConfigConstants.MQ_PROVIDER_SEND_QUEUE)); sendList.Add(send); connectionPoolManager = new PoolableMQConnectionManager(sendList, receiveList, int.Parse(config.getProperty(ConfigConstants.MQ_PROVIDER_POOL_MAXNUM)), int.Parse(config.getProperty(ConfigConstants.MQ_PROVIDER_GETCONN_TIMEOUT))); ProviderShutDownHook.register(this); }
/** * 加载主MQ配置 * @throws EisException */ public AbstractServiceProvider() { this.config = CacheManager.getInstance().getConfig(); // String AltConfig = config.getProperty(ConfigConstants.ALTERNATIVE_PROVIDER_CONFIG); // if (AltConfig == null){ // AltConfig = ""; // } // String[] AltConfigArr = AltConfig.split(ConfigConstants.ALTERNATIVE_CONFIG_SPLIT); // List<MQParameter> receiveList = new ArrayList<MQParameter>(); MQParameter receive = new MQParameter(config.getProperty(ConfigConstants.MQ_PROVIDER_RECV_IP), int.Parse(config.getProperty(ConfigConstants.MQ_PROVIDER_RECV_PORT)), config.getProperty(ConfigConstants.MQ_PROVIDER_RECV_CHANNEL), int.Parse(config.getProperty(ConfigConstants.MQ_PROVIDER_RECV_CCSID)), config.getProperty(ConfigConstants.MQ_PROVIDER_RECV_QMANAGER), config.getProperty(ConfigConstants.MQ_PROVIDER_RECV_QUEUE)); receiveList.Add(receive); // for (int i = 0; i < AltConfigArr.length; i++) { // String receiveAlt = AltConfigArr[i].trim(); // MQParameter receive_t = new MQParameter(config.getProperty(receiveAlt + ConfigConstants.MQ_PROVIDER_RECV_IP), // Integer.parseInt(config.getProperty(receiveAlt + ConfigConstants.MQ_PROVIDER_RECV_PORT)), // config.getProperty(receiveAlt + ConfigConstants.MQ_PROVIDER_RECV_CHANNEL), // Integer.parseInt(config.getProperty(receiveAlt + ConfigConstants.MQ_PROVIDER_RECV_CCSID)), // config.getProperty(receiveAlt + ConfigConstants.MQ_PROVIDER_RECV_QMANAGER), // config.getProperty(receiveAlt + ConfigConstants.MQ_PROVIDER_RECV_QUEUE)); // // receiveList.add(receive_t); // } // List<MQParameter> sendList = new ArrayList<MQParameter>(); MQParameter send = new MQParameter(config.getProperty(ConfigConstants.MQ_PROVIDER_SEND_IP), int.Parse(config.getProperty(ConfigConstants.MQ_PROVIDER_SEND_PORT)), config.getProperty(ConfigConstants.MQ_PROVIDER_SEND_CHANNEL), int.Parse(config.getProperty(ConfigConstants.MQ_PROVIDER_SEND_CCSID)), config.getProperty(ConfigConstants.MQ_PROVIDER_SEND_QMANAGER), config.getProperty(ConfigConstants.MQ_PROVIDER_SEND_QUEUE)); sendList.Add(send); // for (int i = 0; i < AltConfigArr.length; i++) { // String sendAlt = AltConfigArr[i].trim(); // MQParameter send_t = new MQParameter(config.getProperty(sendAlt + ConfigConstants.MQ_PROVIDER_SEND_IP), // Integer.parseInt(config.getProperty(sendAlt + ConfigConstants.MQ_PROVIDER_SEND_PORT)), // config.getProperty(sendAlt + ConfigConstants.MQ_PROVIDER_SEND_CHANNEL), // Integer.parseInt(config.getProperty(sendAlt + ConfigConstants.MQ_PROVIDER_SEND_CCSID)), // config.getProperty(sendAlt + ConfigConstants.MQ_PROVIDER_SEND_QMANAGER), // config.getProperty(sendAlt + ConfigConstants.MQ_PROVIDER_SEND_QUEUE)); // sendList.add(send_t); // } connectionPoolManager = new PoolableMQConnectionManager(sendList, receiveList, int.Parse(config.getProperty(ConfigConstants.MQ_PROVIDER_POOL_MAXNUM)), int.Parse(config.getProperty(ConfigConstants.MQ_PROVIDER_GETCONN_TIMEOUT))); ProviderShutDownHook.register(this); }