Пример #1
0
        public static E AttachCommand <E>(this E cpipe, Type contract
                                          , Func <TransmissionPayload, List <TransmissionPayload>, IPayloadSerializationContainer, Task> commandFunction
                                          , string referenceId  = null
                                          , int startupPriority = 100
                                          , IPipelineChannelOutgoing <IPipeline> channelResponse = null
                                          )
            where E : IPipelineChannelIncoming <IPipeline>
        {
            string channelId, messageType, actionType;

            if (!ServiceMessageHelper.ExtractContractInfo(contract, out channelId, out messageType, out actionType))
            {
                throw new InvalidMessageContractException(contract);
            }

            if (channelId != cpipe.Channel.Id)
            {
                throw new InvalidPipelineChannelContractException(contract, channelId, cpipe.Channel.Id);
            }

            var command = new CommandInline(commandFunction, channelId, messageType, actionType, referenceId);

            cpipe.Pipeline.AddCommand(command, startupPriority, null, cpipe, channelResponse);

            return(cpipe);
        }
Пример #2
0
        public static E AttachCommand <E>(this E cpipe
                                          , Func <TransmissionPayload, List <TransmissionPayload>, IPayloadSerializationContainer, Task> commandFunction
                                          , ServiceMessageHeader header
                                          , string referenceId  = null
                                          , int startupPriority = 100
                                          , IPipelineChannelOutgoing <IPipeline> channelResponse = null
                                          )
            where E : IPipelineChannelIncoming <IPipeline>
        {
            var command = new CommandInline(header, commandFunction, referenceId);

            cpipe.Pipeline.AddCommand(command, startupPriority, null, cpipe, channelResponse);

            return(cpipe);
        }
Пример #3
0
        public static P AddCommand <P>(this P pipeline
                                       , Func <TransmissionPayload, List <TransmissionPayload>, IPayloadSerializationContainer, Task> commandFunction
                                       , MessageFilterWrapper message
                                       , string referenceId  = null
                                       , int startupPriority = 100
                                       , IPipelineChannelIncoming <P> channelIncoming = null
                                       , IPipelineChannelOutgoing <P> channelResponse = null
                                       )
            where P : IPipeline
        {
            var command = new CommandInline(message, commandFunction, referenceId);

            pipeline.AddCommand(command, startupPriority, null, channelIncoming, channelResponse);

            return(pipeline);
        }