Exemplo n.º 1
0
        public static ChannelPipelineIncoming AddChannelIncoming(this MicroservicePipeline pipeline
                                                                 , string channelId
                                                                 , string description = null
                                                                 , IEnumerable <ListenerPartitionConfig> partitions = null
                                                                 , IBoundaryLogger bLogger = null
                                                                 , IEnumerable <ResourceProfile> resourceProfiles = null
                                                                 , bool internalOnly = false
                                                                 , Action <ChannelPipelineIncoming, Channel> assign = null
                                                                 )
        {
            var channel = pipeline.Service.RegisterChannel(new Channel(channelId, ChannelDirection.Incoming, description, bLogger, internalOnly));

            if (partitions != null)
            {
                channel.Partitions = partitions.ToList();
            }
            if (resourceProfiles != null)
            {
                channel.ResourceProfiles = resourceProfiles.ToList();
            }

            var cpipe = new ChannelPipelineIncoming(pipeline, channel);

            assign?.Invoke(cpipe, cpipe.Channel);

            return(cpipe);
        }
Exemplo n.º 2
0
        public static MicroservicePipeline AddCommand <C>(this MicroservicePipeline pipeline
                                                          , C command
                                                          , Action <C> assignment = null
                                                          , ChannelPipelineIncoming channelIncoming = null
                                                          , ChannelPipelineOutgoing channelResponse = null
                                                          , ChannelPipelineIncoming channelMasterJobNegotiationIncoming = null
                                                          , ChannelPipelineOutgoing channelMasterJobNegotiationOutgoing = null
                                                          )
            where C : ICommand
        {
            if (channelIncoming != null && command.ChannelIdAutoSet)
            {
                command.ChannelId = channelIncoming.Channel.Id;
            }

            if (channelResponse != null && command.ResponseChannelIdAutoSet)
            {
                command.ResponseChannelId = channelResponse.Channel.Id;
            }

            if (channelMasterJobNegotiationIncoming != null && command.MasterJobNegotiationChannelIdAutoSet)
            {
                command.MasterJobNegotiationChannelIdIncoming = channelMasterJobNegotiationIncoming.Channel.Id;
            }

            if (channelMasterJobNegotiationOutgoing != null && command.MasterJobNegotiationChannelIdAutoSet)
            {
                command.MasterJobNegotiationChannelIdOutgoing = channelMasterJobNegotiationOutgoing.Channel.Id;
            }

            assignment?.Invoke(command);
            pipeline.Service.RegisterCommand(command);
            return(pipeline);
        }
Exemplo n.º 3
0
        public static MicroservicePipeline AddEventSource <E>(this MicroservicePipeline pipeline, Func <IEnvironmentConfiguration, E> creator, Action <E> assign)
            where E : IEventSource
        {
            var eSource = creator(pipeline.Configuration);

            assign?.Invoke(eSource);
            pipeline.Service.RegisterEventSource(eSource);
            return(pipeline);
        }
Exemplo n.º 4
0
        public static MicroservicePipeline AddSharedService <I>(this MicroservicePipeline pipeline, Lazy <I> service, string serviceName = null) where I : class
        {
            if (!pipeline.Service.SharedServices.RegisterService <I>(service, serviceName))
            {
                throw new SharedServiceRegistrationException(typeof(I).Name, serviceName);
            }

            return(pipeline);
        }
Exemplo n.º 5
0
        public static MicroservicePipeline Inspect(this MicroservicePipeline pipeline
                                                   , Action <IMicroservice> msAssign             = null
                                                   , Action <IEnvironmentConfiguration> cfAssign = null)
        {
            msAssign?.Invoke(pipeline.Service);
            cfAssign?.Invoke(pipeline.Configuration);

            return(pipeline);
        }
Exemplo n.º 6
0
        public static MicroservicePipeline AddLogger <L>(this MicroservicePipeline pipeline, Action <L> action = null)
            where L : ILogger, new()
        {
            var logger = new L();

            action?.Invoke(logger);

            pipeline.Service.RegisterLogger(logger);

            return(pipeline);
        }
Exemplo n.º 7
0
        public static MicroservicePipeline AttachListener <S>(this MicroservicePipeline pipeline, Func <IEnvironmentConfiguration, S> creator, Action <S> action = null)
            where S : IListener
        {
            var listener = creator(pipeline.Configuration);

            action?.Invoke(listener);

            pipeline.AttachListener(listener);

            return(pipeline);
        }
Exemplo n.º 8
0
        public static MicroservicePipeline AddLogger <L>(this MicroservicePipeline pipeline, Func <IEnvironmentConfiguration, L> creator, Action <L> action = null)
            where L : ILogger
        {
            var logger = creator(pipeline.Configuration);

            action?.Invoke(logger);

            pipeline.Service.RegisterLogger(logger);

            return(pipeline);
        }
Exemplo n.º 9
0
        public static MicroservicePipeline AddCommand <C>(this MicroservicePipeline pipeline
                                                          , Func <IEnvironmentConfiguration, C> creator
                                                          , Action <C> assignment = null
                                                          , ChannelPipelineIncoming channelIncoming = null
                                                          , ChannelPipelineOutgoing channelResponse = null
                                                          , ChannelPipelineIncoming channelMasterJobNegotiationIncoming = null
                                                          , ChannelPipelineOutgoing channelMasterJobNegotiationOutgoing = null
                                                          )
            where C : ICommand
        {
            var command = creator(pipeline.Configuration);

            return(pipeline.AddCommand(command, assignment, channelIncoming, channelResponse, channelMasterJobNegotiationIncoming));
        }
Exemplo n.º 10
0
        public static MicroservicePipeline AddEventSource(this MicroservicePipeline pipeline, IEventSource eventSource)
        {
            pipeline.Service.RegisterEventSource(eventSource);

            return(pipeline);
        }
Exemplo n.º 11
0
        public static MicroservicePipeline AttachListener(this MicroservicePipeline pipeline, IListener listener)
        {
            pipeline.Service.RegisterListener(listener);

            return(pipeline);
        }
Exemplo n.º 12
0
        public static MicroservicePipeline CallOut(this MicroservicePipeline pipe, Action <MicroservicePipeline> method)
        {
            method(pipe);

            return(pipe);
        }
Exemplo n.º 13
0
        public static MicroservicePipeline AddPayloadSerializer(this MicroservicePipeline pipeline, Func <IEnvironmentConfiguration, IPayloadSerializer> creator)
        {
            pipeline.Service.RegisterPayloadSerializer(creator(pipeline.Configuration));

            return(pipeline);
        }
Exemplo n.º 14
0
        public static MicroservicePipeline AddPayloadSerializer(this MicroservicePipeline pipeline, IPayloadSerializer serializer)
        {
            pipeline.Service.RegisterPayloadSerializer(serializer);

            return(pipeline);
        }
Exemplo n.º 15
0
        public static MicroservicePipeline AddPayloadSerializerDefaultJson(this MicroservicePipeline pipeline)
        {
            var component = pipeline.Service.RegisterPayloadSerializer(new JsonContractSerializer());

            return(pipeline);
        }
Exemplo n.º 16
0
 /// <summary>
 /// This is a helper method that identifies the current pipeline. It is useful for autocomplete identification.
 /// This command does not do anything.
 /// </summary>
 /// <param name="pipe">The pipeline.</param>
 /// <returns>The pipeline.</returns>
 public static void Ability_Is_MicroservicePipeline(this MicroservicePipeline pipe)
 {
 }
Exemplo n.º 17
0
 public ChannelPipelineIncoming(MicroservicePipeline pipeline, Channel channel) : base(pipeline, channel)
 {
 }
Exemplo n.º 18
0
        public static MicroservicePipeline AddLogger(this MicroservicePipeline pipeline, ILogger logger)
        {
            pipeline.Service.RegisterLogger(logger);

            return(pipeline);
        }
Exemplo n.º 19
0
 public ChannelPipelineBase(MicroservicePipeline pipeline, Channel channel)
 {
     Pipeline = pipeline;
     Channel  = channel;
 }
Exemplo n.º 20
0
 public static void Stop(this MicroservicePipeline pipeline)
 {
     pipeline.Service.Stop();
 }
Exemplo n.º 21
0
        public static MicroservicePipeline AttachSender(this MicroservicePipeline pipeline, ISender sender)
        {
            pipeline.Service.RegisterSender(sender);

            return(pipeline);
        }