コード例 #1
0
 public SagaStorageTests()
 {
     _host = Substitute.For <IConfigureHost>();
     _cfg  = new StoragesConfiguration(_host, Setup.GetConnection());
     _cfg.EnableSagaStorage(ifExists: TableExistsAction.DropIt);
     _sut = new SagaStorage(Setup.GetConnection());
 }
コード例 #2
0
 public SagaStorageTests()
 {
     _host = Substitute.For<IConfigureHost>();
     _cfg = new StoragesConfiguration(_host, Setup.GetConnection());
     _cfg.EnableSagaStorage(ifExists: TableExistsAction.DropIt);
     _sut = new SagaStorage(Setup.GetConnection());
 }
コード例 #3
0
        /// <summary>
        /// Register bus types in container. You still need to use <see cref="AutofacContainer"/> when building bus
        /// </summary>
        /// <param name="bus"></param>
        /// <param name="cfg"></param>
        /// <param name="builder"></param>
        /// <param name="extraConfig">Enable additional features</param>
        /// <returns></returns>
        public static IConfigureHost RegisterWithAutofac(this IConfigureHost bus, ContainerBuilder builder, Action <AutofacBusRegistration> extraConfig = null)
        {
            builder.MustNotBeNull();
            var container = new AutofacBusRegistration(builder);

            extraConfig?.Invoke(container);
            return(bus.RegisterTypesInContainer(container));
        }
コード例 #4
0
        public ProcessingStorageTests()
        {
            _host = Substitute.For <IConfigureHost>();

            _host.WithProcessingStorage(Arg.Do <IStoreUnhandledMessages>(v => _sut = v));
            _cfg = new StoragesConfiguration(_host, Setup.GetConnection());
            _cfg.EnableProcessorStorage(ifExists: TableExistsAction.DropIt);
        }
コード例 #5
0
ファイル: Extensions.cs プロジェクト: DomainBus/DomainBus.Sql
        public static IConfigureHost WithSqlStorages(this IConfigureHost host, IDbFactory connection, Action <StoragesConfiguration> cfgAction)
        {
            cfgAction.MustNotBeNull();
            var cfg = new StoragesConfiguration(host, connection);

            cfgAction(cfg);
            return(host);
        }
コード例 #6
0
 public ProcessingStorageTests()
 {
     _host = Substitute.For<IConfigureHost>();
     
     _host.WithProcessingStorage(Arg.Do<IStoreUnhandledMessages>(v => _sut = v));
     _cfg =new StoragesConfiguration(_host,Setup.GetConnection());
     _cfg.EnableProcessorStorage(ifExists: TableExistsAction.DropIt);
     
 }
コード例 #7
0
        public ReserveIdStorageTests()
        {
            _host = Substitute.For <IConfigureHost>();

            _host.WithReserveIdStorage(Arg.Do <IStoreReservedMessagesIds>(v => _sut = v));
            _cfg = new StoragesConfiguration(_host, Setup.GetConnection());
            _cfg.EnableReserveIdStorage(ifExists: TableExistsAction.DropIt);

            _src = new ReservedIdsSource()
            {
                Count       = 2,
                HandlerType = GetType(),
                MessageId   = Guid.Empty
            };
        }
コード例 #8
0
        public ReserveIdStorageTests()
        {
            _host = Substitute.For<IConfigureHost>();

            _host.WithReserveIdStorage(Arg.Do<IStoreReservedMessagesIds>(v => _sut = v));
            _cfg = new StoragesConfiguration(_host, Setup.GetConnection());
            _cfg.EnableReserveIdStorage(ifExists: TableExistsAction.DropIt);

            _src=new ReservedIdsSource()
            {
                Count = 2,
                HandlerType = GetType(),
                MessageId = Guid.Empty
            };
        }
コード例 #9
0
 public StoragesConfiguration(IConfigureHost host, IDbFactory factory)
 {
     _host    = host;
     _factory = factory;
 }
コード例 #10
0
ファイル: Extensions.cs プロジェクト: DomainBus/DomainBus.Sql
 /// <summary>
 ///
 /// </summary>
 /// <param name="host"></param>
 /// <param name="cnxString"></param>
 /// <param name="cfg"></param>
 /// <returns></returns>
 public static IConfigureHost WithSqlServerStorages(this IConfigureHost host, string cnxString, Action <StoragesConfiguration> cfg)
 {
     return(host.WithSqlStorages(GetFactory(cnxString), cfg));
 }
コード例 #11
0
 /// <summary>
 /// Sets up 2 message processors identified by <see cref="ServiceBus.CommandsProcessor"/> and <see cref="ServiceBus.EventsProcessor"/>
 /// without polling i.e for non-distributed apps
 /// </summary>
 /// <param name="procs"></param>
 /// <param name="enablePolling"></param>
 /// <returns></returns>
 public static IConfigureHost DefaultProcessors(this IConfigureHost procs, bool enablePolling = false)
 {
     return(procs.ConfigureProcessors(p => p.AddWithAttributeConvention(ServiceBus.CommandsProcessor, s => s.PollingEnabled = enablePolling)
                                      .AddWithAttributeConvention(ServiceBus.EventsProcessor, s => s.PollingEnabled = enablePolling)));
 }
コード例 #12
0
 /// <summary>
 /// Sets host name to 'local'. For monolith mode
 /// </summary>
 /// <param name="host"></param>
 /// <returns></returns>
 public static IConfigureHost LocalHost(this IConfigureHost host)
 => host.HostnameIs("local");
コード例 #13
0
 /// <summary>
 /// Autoconfiguration from types of the provided assemblies
 /// </summary>
 /// <param name="host"></param>
 /// <param name="asms"></param>
 /// <returns></returns>
 public static IConfigureHost RegisterHandlersAndSagaStatesFrom(this IConfigureHost host, params Assembly[] asms)
 =>
 host.AutoConfigureFrom(asms.SelectMany(a => a.GetExportedTypes()));
コード例 #14
0
 /// <summary>
 /// ONLY for development/debugging scenarios
 /// </summary>
 /// <param name="host"></param>
 /// <returns></returns>
 public static IConfigureHost WithInMemoryAudits(this IConfigureHost host)
 => host.PersistAuditsWith(new InMemoryAuditStorage());
コード例 #15
0
 public StoragesConfiguration(IConfigureHost host, IDbFactory factory)
 {
     _host = host;
     _factory = factory;
 }