Exemple #1
0
        static string ValidateOrCreateOutgoingChannel(IPipeline pipeline, string outgoingChannelId, Guid componentId, bool create)
        {
            outgoingChannelId = string.IsNullOrEmpty(outgoingChannelId?.Trim()) ? $"CommandInitiator{componentId.ToString("N").ToUpperInvariant()}":outgoingChannelId;

            if (pipeline.ToMicroservice().Communication.HasChannel(outgoingChannelId, ChannelDirection.Incoming))
            {
                return(outgoingChannelId);
            }

            if (!create)
            {
                throw new ChannelDoesNotExistException(outgoingChannelId, ChannelDirection.Incoming, pipeline.ToMicroservice().Id.Name);
            }

            var outPipe = pipeline.AddChannelIncoming(outgoingChannelId, internalOnly: true);

            return(outgoingChannelId);
        }