protected void WhenInitializingBuilders()
        {
            var factory = new CommandBuildersFactory(ConnectionStringSettings);

            MessageJournalingCommandBuilders    = factory.InitMessageJournalingCommandBuilders();
            MessageQueueingCommandBuilders      = factory.InitMessageQueueingCommandBuilders();
            SubscriptionTrackingCommandBuilders = factory.InitSubscriptionTrackingCommandBuilders();
        }
Beispiel #2
0
        /// <inheritdoc />
        public async Task <IMessageQueueingService> CreateMessageQueueingService(QueueingElement configuration)
        {
            var connectionName = configuration.GetString("connectionName");

            if (string.IsNullOrWhiteSpace(connectionName))
            {
                throw new ConfigurationErrorsException(
                          "Attribute 'connectionName' is required for SQL message queueing service");
            }

            var connectionStringSettings = ConfigurationManager.ConnectionStrings[connectionName];

            if (connectionStringSettings == null)
            {
                throw new ConfigurationErrorsException($"Connection string settings \"{connectionName}\" not found");
            }

            var securityTokenServiceFactory = new SecurityTokenServiceFactory();
            var securityTokenConfig         = configuration.SecurityTokens;
            var securityTokenService        = await securityTokenServiceFactory.InitSecurityTokenService(securityTokenConfig);

            var messageEncryptionServiceFactory = new MessageEncryptionServiceFactory();
            var messageEncryptionConfig         = configuration.Encryption;
            var messageEncryptionService        = await messageEncryptionServiceFactory.InitMessageEncryptionService(messageEncryptionConfig);

            var connectionProvider             = new DefaultConnectionProvider(connectionStringSettings);
            var commandBuildersFactory         = new CommandBuildersFactory(connectionStringSettings);
            var messageQueueingCommandBuilders = commandBuildersFactory.InitMessageQueueingCommandBuilders();
            var messageQueueingOptions         = new SQLMessageQueueingOptions(connectionProvider, messageQueueingCommandBuilders)
            {
                SecurityTokenService     = securityTokenService,
                MessageEncryptionService = messageEncryptionService
            };
            var sqlMessageQueueingService = new SQLMessageQueueingService(messageQueueingOptions);

            sqlMessageQueueingService.Init();
            return(sqlMessageQueueingService);
        }