예제 #1
0
        /// <inheritdoc />
        public Task <IMessageJournal> CreateMessageJournal(JournalingElement configuration)
        {
            var connectionName = configuration.GetString("connectionName");

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

            var connectionStringSettings = ConfigurationManager.ConnectionStrings[connectionName];

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

            var databaseName   = configuration.GetString("database");
            var collectionName = configuration.GetString("collection");
            var database       = MongoDBHelper.Connect(connectionStringSettings, databaseName);
            var journalOptions = new MongoDBMessageJournalOptions(database)
            {
                CollectionName = collectionName
            };
            var sqlMessageJournalingService = new MongoDBMessageJournal(journalOptions);

            return(Task.FromResult <IMessageJournal>(sqlMessageJournalingService));
        }
예제 #2
0
        /// <inheritdoc />
        public Task <IMessageJournal> CreateMessageJournal(JournalingElement configuration)
        {
            var path          = configuration.GetString("path");
            var sqliteBaseDir = GetRootedDirectory(path);
            var sqliteMessageQueueingService = new SQLiteMessageJournal(sqliteBaseDir);

            sqliteMessageQueueingService.Init();
            return(Task.FromResult <IMessageJournal>(sqliteMessageQueueingService));
        }
예제 #3
0
        /// <inheritdoc />
        public Task <IMessageJournal> CreateMessageJournal(JournalingElement configuration)
        {
            var connectionName = configuration.GetString("connectionName");

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

            var connectionStringSettings = ConfigurationManager.ConnectionStrings[connectionName];

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

            sqlMessageJournalingService.Init();
            return(Task.FromResult <IMessageJournal>(sqlMessageJournalingService));
        }