internal IList <string> GetQueueNames(WsObjectNameFilter filter)
        {
            return(RetryOnHCONNError(() =>
            {
                var result = new List <string>();

                var pcfMsg = _messageAgent.NewRequest(MQC.MQCMD_INQUIRE_Q_NAMES);

                if (filter != null)
                {
                    pcfMsg.AddParameter(MQC.MQCA_Q_NAME,
                                        string.IsNullOrEmpty(filter.NamePrefix[0]) ? "*" : string.Concat(filter.NamePrefix[0], "*"));
                }
                else
                {
                    pcfMsg.AddParameter(MQC.MQCA_Q_NAME, "*");
                }

                pcfMsg.AddParameter(MQC.MQIA_Q_TYPE, MQC.MQQT_ALL);

                var pcfResponse = _messageAgent.Send(pcfMsg);

                result.AddRange(pcfResponse[0].GetStringListParameterValue(MQC.MQCACF_Q_NAMES));

                return result.Select(x => x.Trim()).Where(n => filter == null || filter.IsMatch(n)).ToList();
            }));
        }
        internal IEnumerable <string> GetListenerNames(WsObjectNameFilter filter)
        {
            try
            {
                return(RetryOnHCONNError(() =>
                {
                    var pcfMsg = _messageAgent.NewRequest(MQC.MQCMD_INQUIRE_LISTENER);

                    if (filter != null)
                    {
                        pcfMsg.AddParameter(MQC.MQCACH_LISTENER_NAME,
                                            string.IsNullOrEmpty(filter.NamePrefix[0]) ? "*" : string.Concat(filter.NamePrefix[0], "*"));
                    }
                    else
                    {
                        pcfMsg.AddParameter(MQC.MQCACH_LISTENER_NAME, "*");
                    }

                    var pcfResponses = _messageAgent.Send(pcfMsg);

                    var result = new List <string>();

                    foreach (var r in pcfResponses)
                    {
                        string value;
                        if (r.TryGetStringParameterValue(MQC.MQCACH_LISTENER_NAME, out value))
                        {
                            result.Add(value);
                        }
                    }

                    return result.Select(x => x.Trim()).Where(n => filter == null || filter.IsMatch(n)).ToList();
                }));
            }
            catch (MQException ex)
            {
                if (ex.ReasonCode == MQC.MQRCCF_CFH_COMMAND_ERROR)
                {
                    return(new string[0]);
                }
                throw;
            }
        }