Ejemplo n.º 1
0
        /// <summary>
        /// This is the default constructor.
        /// </summary>
        /// <param name="channelId">The string based channel id.</param>
        /// <param name="priorityPartitions">The number of priority channels. Null denotes a single channel of priority one.</param>
        public MessagingServiceBase(string channelId
                                    , IEnumerable <P> priorityPartitions
                                    , IBoundaryLogger boundaryLogger = null)
            : base()
        {
            if (channelId == null)
            {
                throw new ArgumentNullException("channelId", "channelId cannot be null");
            }

            if (priorityPartitions == null)
            {
                throw new ArgumentNullException("priorityPartitions", "priorityPartitions cannot be null");
            }

            //Set the partition priority to a single partition if null or an empty set.
            PriorityPartitions = priorityPartitions.ToList();
            if (PriorityPartitions.Count == 0)
            {
                throw new ArgumentOutOfRangeException("priorityPartitions", "priorityPartitions must have at least one member.");
            }

            BoundaryLogger = boundaryLogger;

            ChannelId = channelId;

            //This is the collection of client holder for the appropriate partitions.
            mClients = new Dictionary <int, H>();
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// This is the default constructor.
 /// </summary>
 /// <param name="channelId">The string based channel id.</param>
 /// <param name="priorityPartitions">The number of priority channels. Null denotes a single channel of priority one.</param>
 /// <param name="defaultTimeout">This is the default timeout for incoming messages. By default this is set to 1 minute if left blank.</param>
 public MessagingListenerBase(string channelId
                              , IEnumerable <ListenerPartitionConfig> priorityPartitions = null
                              , string mappingChannelId = null
                              , IEnumerable <ResourceProfile> resourceProfiles = null
                              , IBoundaryLogger boundaryLogger = null)
     : base(channelId, priorityPartitions, boundaryLogger)
 {
     mSupportedMessageTypes = new List <MessageFilterWrapper>();
     MappingChannelId       = mappingChannelId;
     ResourceProfiles       = resourceProfiles == null?new List <ResourceProfile>(): resourceProfiles.ToList();
 }
Ejemplo n.º 4
0
        /// <summary>
        /// The default constructor.
        /// </summary>
        /// <param name="id">The channel Id.</param>
        /// <param name="direction">The direction of the channel - Incoming or outgoing</param>
        /// <param name="description">The optional description</param>
        /// <param name="internalOnly">This property specifies that the channel should only be used for internal messaging.</param>
        public Channel(string id, ChannelDirection direction, string description = null, IBoundaryLogger boundaryLogger = null, bool internalOnly = false)
        {
            if (string.IsNullOrEmpty(id))
            {
                throw new ArgumentNullException("id cannot be null or empty.");
            }

            Id             = id;
            Direction      = direction;
            Description    = description;
            InternalOnly   = internalOnly;
            BoundaryLogger = boundaryLogger;
        }
Ejemplo n.º 5
0
 /// <summary>
 /// This is the default constructor.
 /// </summary>
 /// <param name="channelId">The string based channel id.</param>
 /// <param name="priorityPartitions">The number of priority channels. Null denotes a single channel of priority one.</param>
 public MessagingSenderBase(string channelId
                            , IEnumerable <SenderPartitionConfig> priorityPartitions
                            , IBoundaryLogger boundaryLogger = null)
     : base(channelId, priorityPartitions, boundaryLogger)
 {
 }