Exemple #1
0
        private void OnCheckOrphan(string msg, string reply, string subject)
        {
            Logger.Debug(Strings.CheckOrphanLogMessage, ServiceDescription());

            CheckOrphanResponse response = new CheckOrphanResponse();

            try
            {
                CheckOrphanRequest request = new CheckOrphanRequest();
                request.FromJsonIntermediateObject(JsonConvertibleObject.DeserializeFromJson(msg));

                // TODO: vladi: investigate further if this needs to be parallelized; seems that this would take a very short time, and it's not tied to a specific instance, so it could run on a new thread
                this.CheckOrphan(request.Handles);

                response.OrphanInstances = OrphanInstancesHash;
                response.OrphanBindings  = OrphanBindingHash;
                response.Success         = true;
            }
            catch (Exception ex)
            {
                Logger.Warning(Strings.CheckOrphanExceptionLogMessage, ex.ToString());
                response.Success = false;
                response.Error   = new Dictionary <string, object>()
                {
                    { "message", ex.Message },
                    { "stack", ex.StackTrace }
                };
            }
            finally
            {
                NodeNats.Publish(string.Format(CultureInfo.InvariantCulture, Strings.NatsSubjectOrphanResult, ServiceName()), null, response.SerializeToJson());
            }
        }
        private void OnCheckOrphan(string msg, string reply, string subject)
        {
            Logger.Debug(Strings.CheckOrphanLogMessage, ServiceDescription());

            CheckOrphanResponse response = new CheckOrphanResponse();
            try
            {
                CheckOrphanRequest request = new CheckOrphanRequest();
                request.FromJsonIntermediateObject(JsonConvertibleObject.DeserializeFromJson(msg));

                // TODO: vladi: investigate further if this needs to be parallelized; seems that this would take a very short time, and it's not tied to a specific instance, so it could run on a new thread
                this.CheckOrphan(request.Handles);

                response.OrphanInstances = orphanInstancesHash;
                response.OrphanBindings = orphanBindingHash;
                response.Success = true;
            }
            catch (Exception ex)
            {
                Logger.Warning(Strings.CheckOrphanExceptionLogMessage, ex.ToString());
                response.Success = false;
                response.Error = new Dictionary<string, object>()
                {
                    { "message", ex.Message },
                    { "stack", ex.StackTrace }
                };
            }
            finally
            {
                nodeNats.Publish(string.Format(CultureInfo.InvariantCulture, Strings.NatsSubjectOrphanResult, ServiceName()), null, response.SerializeToJson());
            }
        }