Beispiel #1
0
 public void SetPutStatus(GetPutStatus newStatus)
 {
     try
     {
         (QueueManager as WsQueueManager)?.SetQueuePutInhibitCore(this, newStatus);
         RefreshInfo();
     }
     catch (MQException ibmEx)
     {
         throw ibmEx.ToMqException(AddExtraInfoToError);
     }
 }
        internal void SetQueuePutInhibitCore(WsQueue theQueue, GetPutStatus newStatus)
        {
            RetryOnHCONNError(() =>
            {
                Exception pcfError = null;

                if (WsSoftwareInfo.AvoidPCFWhenPossible == false)
                {
                    var pcfMsg = _messageAgent.NewRequest(MQC.MQCMD_CHANGE_Q);
                    pcfMsg.AddParameter(MQC.MQCA_Q_NAME, theQueue.Name);
                    pcfMsg.AddParameter(MQC.MQIA_Q_TYPE, theQueue.QueueTypeCore);
                    pcfMsg.AddParameter(MQC.MQIA_INHIBIT_PUT,
                                        newStatus == GetPutStatus.Inhibited ? MQC.MQQA_PUT_INHIBITED : MQC.MQQA_PUT_ALLOWED);

                    if (_messageAgent.TrySend(pcfMsg))
                    {
                        return;
                    }

                    pcfError = _messageAgent.LastError;
                }

                // fallback option

                try
                {
                    MQQueue mqQ    = OpenQueueCore(theQueue.Name, OpenQueueMode.ForSet);
                    mqQ.InhibitPut = newStatus == GetPutStatus.Inhibited ? MQC.MQQA_PUT_INHIBITED : MQC.MQQA_PUT_ALLOWED;
                    mqQ.Close();
                }
                catch (MQException ex)
                {
                    if (pcfError != null)
                    {
                        ex.Data.Add("PCFError", pcfError.ToString());
                    }
                    throw;
                }
            });
        }
Beispiel #3
0
 private async Task SetGetStatusAsync(GetPutStatus status, IList <QueueInfo> queues)
 {
     await Parent.ExecuteAsync((ct) =>
     {
         using (var ps = Progress.Start(queues.Count, ct, LongRunningState.Yes))
         {
             ps.SetTitle("Changing 'get' status...");
             foreach (var q in queues)
             {
                 if (ps.CancellationToken.IsCancellationRequested)
                 {
                     break;
                 }
                 ps.ReportNext();
                 if (q.GetStatus.HasValue)
                 {
                     q.SetGetStatus(status);
                 }
             }
         }
     });
 }
 public void SetPutStatus(GetPutStatus newStatus)
 {
     QueueSource.SetPutStatus(newStatus);
 }