public SagaStorageTests() { _host = Substitute.For <IConfigureHost>(); _cfg = new StoragesConfiguration(_host, Setup.GetConnection()); _cfg.EnableSagaStorage(ifExists: TableExistsAction.DropIt); _sut = new SagaStorage(Setup.GetConnection()); }
public SagaStorageTests() { _host = Substitute.For<IConfigureHost>(); _cfg = new StoragesConfiguration(_host, Setup.GetConnection()); _cfg.EnableSagaStorage(ifExists: TableExistsAction.DropIt); _sut = new SagaStorage(Setup.GetConnection()); }
/// <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)); }
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); }
public static IConfigureHost WithSqlStorages(this IConfigureHost host, IDbFactory connection, Action <StoragesConfiguration> cfgAction) { cfgAction.MustNotBeNull(); var cfg = new StoragesConfiguration(host, connection); cfgAction(cfg); return(host); }
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); }
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 }; }
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 }; }
public StoragesConfiguration(IConfigureHost host, IDbFactory factory) { _host = host; _factory = factory; }
/// <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)); }
/// <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))); }
/// <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");
/// <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()));
/// <summary> /// ONLY for development/debugging scenarios /// </summary> /// <param name="host"></param> /// <returns></returns> public static IConfigureHost WithInMemoryAudits(this IConfigureHost host) => host.PersistAuditsWith(new InMemoryAuditStorage());