示例#1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SqlMessageReceiver"/> class.
        /// </summary>
        /// <param name="subscriptionId">The <see cref="Guid">GUID</see> that identifies the associated stream.</param>
        /// <param name="configuration">The associated <see cref="SqlMessageQueueConfiguration">SQL queue configuration</see>.</param>
        public SqlMessageReceiver(Guid subscriptionId, SqlMessageQueueConfiguration configuration)
        {
            Arg.NotNull(configuration, nameof(configuration));

            Configuration  = configuration;
            SubscriptionId = subscriptionId;
        }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SqlMessageSender"/> class.
        /// </summary>
        /// <param name="configuration">The associated <see cref="SqlMessageQueueConfiguration">SQL queue configuration</see>.</param>
        public SqlMessageSender(SqlMessageQueueConfiguration configuration)
        {
            Arg.NotNull(configuration, nameof(configuration));

            Configuration     = configuration;
            messageSerializer = configuration.MessageSerializer;
        }
示例#3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SqlMessageReceiver"/> class.
        /// </summary>
        /// <param name="streamName">The logical name of the associated stream. The name should be unique.</param>
        /// <param name="configuration">The associated <see cref="SqlMessageQueueConfiguration">SQL queue configuration</see>.</param>
        public SqlMessageReceiver(string streamName, SqlMessageQueueConfiguration configuration)
        {
            Arg.NotNullOrEmpty(streamName, nameof(streamName));
            Arg.NotNull(configuration, nameof(configuration));

            Configuration  = configuration;
            SubscriptionId = Uuid.FromString(streamName);
        }
示例#4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SqlMessageReceiver"/> class.
        /// </summary>
        /// <param name="configuration">The associated <see cref="SqlMessageQueueConfiguration">SQL queue configuration</see>.</param>
        /// <remarks>This constructor will use the name of entry assembly, calling assembly, and finally the defining assembly,
        /// in that prescedence, as the basis of the subscription identifier.</remarks>
        public SqlMessageReceiver(SqlMessageQueueConfiguration configuration)
        {
            Arg.NotNull(configuration, nameof(configuration));

            var assembly = GetEntryAssembly() ?? GetCallingAssembly() ?? GetType().GetTypeInfo().Assembly;

            Configuration  = configuration;
            SubscriptionId = Uuid.FromString(assembly.GetName().Name);
        }
示例#5
0
        SqlMessagePump(Guid subscriptionId, DateTimeOffset from, SqlMessageQueueConfiguration configuration, IObserver <IMessageDescriptor> observer)
        {
            Contract.Requires(configuration != null);
            Contract.Requires(observer != null);

            this.subscriptionId = subscriptionId;
            this.from           = from;
            this.configuration  = configuration;
            this.observer       = observer;
            messageSerializer   = configuration.MessageSerializer;
        }
示例#6
0
        internal static SqlMessagePump StartNew(Guid subscriptionId, DateTimeOffset from, SqlMessageQueueConfiguration configuration, IObserver <IMessageDescriptor> observer)
        {
            Contract.Requires(configuration != null);
            Contract.Requires(observer != null);
            Contract.Ensures(Contract.Result <SqlMessagePump>() != null);

            var messagePump = new SqlMessagePump(subscriptionId, from, configuration, observer);

            messagePump.Start();
            return(messagePump);
        }