Example #1
0
        private void OnPurgeOrphan(string msg, string reply, string subject)
        {
            // This may take a long time (it can unbind many services), so we run it on a different thread;
            ThreadPool.QueueUserWorkItem(
                (data) =>
            {
                Logger.Debug(Strings.OnPurgeOrphanDebugLogMessage, ServiceDescription());
                SimpleResponse response = new SimpleResponse();
                try
                {
                    PurgeOrphanRequest request = new PurgeOrphanRequest();
                    request.FromJsonIntermediateObject(JsonConvertibleObject.DeserializeFromJson(msg));

                    bool result = this.PurgeOrphan(request.OrphanInsList, request.OrphanBindingList);
                    if (result)
                    {
                        NodeNats.Publish(reply, null, EncodeSuccess(response));
                    }
                    else
                    {
                        NodeNats.Publish(reply, null, EncodeFailure(response));
                    }
                }
                catch (Exception ex)
                {
                    Logger.Warning(ex.ToString());
                    NodeNats.Publish(reply, null, EncodeFailure(response, ex));
                }
            });
        }
Example #2
0
        private void OnPurgeOrphan(string msg, string reply, string subject)
        {
            // This may take a long time (it can unbind many services), so we run it on a different thread;
            ThreadPool.QueueUserWorkItem(
                (data) =>
                {
                    Logger.Debug(Strings.OnPurgeOrphanDebugLogMessage, ServiceDescription());
                    SimpleResponse response = new SimpleResponse();
                    try
                    {
                        PurgeOrphanRequest request = new PurgeOrphanRequest();
                        request.FromJsonIntermediateObject(JsonConvertibleObject.DeserializeFromJson(msg));

                        bool result = this.PurgeOrphan(request.OrphanInsList, request.OrphanBindingList);
                        if (result)
                        {
                            nodeNats.Publish(reply, null, EncodeSuccess(response));
                        }
                        else
                        {
                            nodeNats.Publish(reply, null, EncodeFailure(response));
                        }
                    }
                    catch (Exception ex)
                    {
                        Logger.Warning(ex.ToString());
                        nodeNats.Publish(reply, null, EncodeFailure(response, ex));
                    }
                });
        }