Ejemplo n.º 1
0
        private static void StartProcessStitch(CrossStitchCore core, string name, MessageChannelType channelType)
        {
            var group1         = new StitchGroupName("StitchStart", name, "1");
            var packageResult1 = core.MessageBus.RequestWait <DataRequest <PackageFile>, DataResponse <PackageFile> >(DataRequest <PackageFile> .Save(new PackageFile
            {
                Id        = group1.ToString(),
                GroupName = group1,
                Adaptor   = new InstanceAdaptorDetails
                {
                    Type       = AdaptorType.ProcessV1,
                    Parameters = new Dictionary <string, string>
                    {
                        { Parameters.RunningDirectory, "." },
                        { Parameters.ExecutableName, "StitchStart.Client.exe" }
                    },
                    RequiresPackageUnzip = false,
                    Channel = channelType
                }
            }, true));
            var createResult1 = core.MessageBus.RequestWait <LocalCreateInstanceRequest, LocalCreateInstanceResponse>(new LocalCreateInstanceRequest
            {
                Name              = "StitchStart." + name,
                GroupName         = group1,
                NumberOfInstances = 1,
            });

            core.MessageBus.RequestWait <InstanceRequest, InstanceResponse>(InstanceRequest.ChannelStart, new InstanceRequest
            {
                Id = createResult1.CreatedIds.FirstOrDefault()
            });
        }
        private void SetupChannel(MessageChannelType channelType, MessageSerializerType serializerType)
        {
            var messageChannel = _channelFactory.Create(channelType, _process);
            var serializer     = _serializerFactory.Create(serializerType);

            _channel = new CoreMessageManager(_stitchInstance.Id, _observer, messageChannel, serializer);
            _channel.Start();
        }
Ejemplo n.º 3
0
 public IMessageChannel Create(MessageChannelType channelType)
 {
     if (channelType == MessageChannelType.Pipe)
     {
         var pipeName = PipeMessageChannel.GetPipeName(_csNodeId, _stitchInstanceId);
         return(new StitchPipeMessageChannel(pipeName));
     }
     return(new StdioMessageChannel());
 }
Ejemplo n.º 4
0
        public IMessageChannel Create(MessageChannelType channelType, System.Diagnostics.Process process)
        {
            if (channelType == MessageChannelType.Pipe)
            {
                var pipeName = PipeMessageChannel.GetPipeName(_csNodeId, _stitchInstanceId);
                return(new CorePipeMessageChannel(pipeName));
            }

            return(new StdioMessageChannel(process.StandardOutput, process.StandardInput));
        }