예제 #1
0
        /// <inheritdoc />
        /// <summary>
        /// Initializes a new <see cref="T:Platibus.SQL.SQLMessageQueue" /> with the specified values
        /// </summary>
        /// <param name="queueName">The name of the queue</param>
        /// <param name="listener">The object that will be notified when messages are
        ///     added to the queue</param>
        /// <param name="options">(Optional) Settings that influence how the queue behaves</param>
        /// <param name="diagnosticService">(Optional) The service through which diagnostic events
        ///     are reported and processed</param>
        /// <param name="connectionProvider">The database connection provider</param>
        /// <param name="commandBuilders">A collection of factories capable of
        ///     generating database commands for manipulating queued messages that conform to the SQL
        ///     syntax required by the underlying connection provider</param>
        /// <param name="securityTokenService">(Optional) The message security token
        ///     service to use to issue and validate security tokens for persisted messages.</param>
        /// <param name="messageEncryptionService"></param>
        /// <exception cref="T:System.ArgumentNullException">Thrown if <paramref name="connectionProvider" />,
        /// <paramref name="commandBuilders" />, <paramref name="queueName" />, or <paramref name="listener" />
        /// are <c>null</c></exception>
        public SQLMessageQueue(QueueName queueName,
                               IQueueListener listener,
                               QueueOptions options, IDiagnosticService diagnosticService, IDbConnectionProvider connectionProvider,
                               IMessageQueueingCommandBuilders commandBuilders, ISecurityTokenService securityTokenService,
                               IMessageEncryptionService messageEncryptionService)
            : base(queueName, listener, options, diagnosticService)
        {
            if (queueName == null)
            {
                throw new ArgumentNullException(nameof(queueName));
            }
            if (listener == null)
            {
                throw new ArgumentNullException(nameof(listener));
            }

            ConnectionProvider       = connectionProvider ?? throw new ArgumentNullException(nameof(connectionProvider));
            CommandBuilders          = commandBuilders ?? throw new ArgumentNullException(nameof(commandBuilders));
            MessageEncryptionService = messageEncryptionService;
            SecurityTokenService     = securityTokenService ?? throw new ArgumentNullException(nameof(securityTokenService));

            MessageEnqueued         += OnMessageEnqueued;
            MessageAcknowledged     += OnMessageAcknowledged;
            AcknowledgementFailure  += OnAcknowledgementFailure;
            MaximumAttemptsExceeded += OnMaximumAttemptsExceeded;
        }
        protected void WhenInitializingBuilders()
        {
            var factory = new CommandBuildersFactory(ConnectionStringSettings);

            MessageJournalingCommandBuilders    = factory.InitMessageJournalingCommandBuilders();
            MessageQueueingCommandBuilders      = factory.InitMessageQueueingCommandBuilders();
            SubscriptionTrackingCommandBuilders = factory.InitSubscriptionTrackingCommandBuilders();
        }
 public SQLMessageQueueingService(IDbConnectionProvider connectionProvider,
                                  IMessageQueueingCommandBuilders commandBuilders,
                                  ISecurityTokenService securityTokenService = null,
                                  IDiagnosticService diagnosticService       = null)
     : this(new SQLMessageQueueingOptions(connectionProvider, commandBuilders)
 {
     DiagnosticService = diagnosticService,
     SecurityTokenService = securityTokenService
 })
 {
 }
 /// <summary>
 /// Initializes a new <see cref="SQLMessageQueueingService"/> with the specified connection
 /// string settings and dialect
 /// </summary>
 /// <param name="options">Options influencing the behavior of this service</param>
 /// <exception cref="ArgumentNullException">Thrown if <paramref name="options"/>
 /// is <c>null</c></exception>
 /// <remarks>
 /// <para>If a SQL dialect is not specified, then one will be selected based on the
 /// supplied connection string settings</para>
 /// <para>If a security token service is not specified then a default implementation
 /// based on unsigned JWTs will be used.</para>
 /// </remarks>
 /// <seealso cref="Platibus.Config.Extensibility.IMessageQueueingCommandBuildersProvider"/>
 public SQLMessageQueueingService(SQLMessageQueueingOptions options)
 {
     if (options == null)
     {
         throw new ArgumentNullException(nameof(options));
     }
     DiagnosticService         = options.DiagnosticService ?? Diagnostics.DiagnosticService.DefaultInstance;
     ConnectionProvider        = options.ConnectionProvider;
     CommandBuilders           = options.CommandBuilders;
     _securityTokenService     = options.SecurityTokenService ?? new JwtSecurityTokenService();
     _messageEncryptionService = options.MessageEncryptionService;
 }
 public SQLMessageQueueingService(ConnectionStringSettings connectionStringSettings,
                                  IMessageQueueingCommandBuilders commandBuilders = null,
                                  ISecurityTokenService securityTokenService      = null,
                                  IDiagnosticService diagnosticService            = null)
     : this(new SQLMessageQueueingOptions(new DefaultConnectionProvider(connectionStringSettings),
                                          commandBuilders)
 {
     DiagnosticService = diagnosticService,
     SecurityTokenService = securityTokenService
 })
 {
 }
예제 #6
0
 /// <summary>
 /// Initializes <see cref="SQLMessageQueueingOptions"/>
 /// </summary>
 /// <param name="connectionProvider">A factory object that provides
 /// connections to the database</param>
 /// <param name="commandBuilders">Dialect-specific factories for creating
 /// database commands</param>
 public SQLMessageQueueingOptions(IDbConnectionProvider connectionProvider, IMessageQueueingCommandBuilders commandBuilders)
 {
     ConnectionProvider = connectionProvider ?? throw new ArgumentNullException(nameof(connectionProvider));
     CommandBuilders    = commandBuilders ?? throw new ArgumentNullException(nameof(commandBuilders));
 }