Пример #1
0
        internal static InitInstanceRequest Deserialize(string initMessage)
        {
            var result = new InitInstanceRequest();

            var parsers = new Queue <Action <string> >(
                new Action <string>[] {
                s => result.CallId       = long.Parse(s),
                s => result.Id           = long.Parse(s),
                s => result.TypeName     = s,
                s => result.AssemblyName = s
            });

            CSVSerializer.Deserialize(Prefix, initMessage, parsers);
            return(result);
        }
Пример #2
0
        private void OnMessage(object sender, string rawMessage)
        {
            if (rawMessage.StartsWith(MessagePrefix) == false)
            {
                return;
            }

            if (InitInstanceRequest.CanDeserialize(rawMessage))
            {
                InitInstance(rawMessage);
                return;
            }

            if (DisposeInstanceRequest.CanDeserialize(rawMessage))
            {
                DisposeInstance(rawMessage);
                return;
            }
        }
Пример #3
0
        public InitInstanceResult InitInstance(InitInstanceRequest initInstanceRequest,
                                               IsInfrastructureMessage handler = null)
        {
            var InstanceWrapper = new InstanceWrapper();
            var result          = InitInstance(
                initInstanceRequest.CallId,
                initInstanceRequest.TypeName,
                initInstanceRequest.AssemblyName,
                () => (IWorkerMessageService)(InstanceWrapper.Services = new InjectableMessageService(IsInfrastructureMessage(handler))));

            InstanceWrapper.Instance = result.Instance;
            if (result.IsSuccess)
            {
                instances[initInstanceRequest.Id] = InstanceWrapper;
            }
            else
            {
                InstanceWrapper.Dispose();
            }

            return(result);
        }
Пример #4
0
        public void InitInstance(string initMessage)
        {
            var result = InitInstance(InitInstanceRequest.Deserialize(initMessage));

            MessageService.PostMessage(result.Serialize());
        }