/// <summary> /// Specifies for the given <typeparamref name="TSagaData"/> type that the given saga persister instance must be used. /// </summary> public HybridSagaPersister Customize <TSagaData>(IStoreSagaData customSagaPersisterInstance) where TSagaData : ISagaData { Customize(customSagaPersisterInstance, typeof(TSagaData)); return(this); }
public Worker(IErrorTracker errorTracker, IReceiveMessages receiveMessages, IActivateHandlers activateHandlers, IStoreSubscriptions storeSubscriptions, ISerializeMessages serializeMessages, IStoreSagaData storeSagaData, IInspectHandlerPipeline inspectHandlerPipeline, string workerThreadName, IHandleDeferredMessage handleDeferredMessage, IMutateIncomingMessages mutateIncomingMessages) { this.receiveMessages = receiveMessages; this.serializeMessages = serializeMessages; this.mutateIncomingMessages = mutateIncomingMessages; this.errorTracker = errorTracker; dispatcher = new Dispatcher(storeSagaData, activateHandlers, storeSubscriptions, inspectHandlerPipeline, handleDeferredMessage); dispatcher.UncorrelatedMessage += RaiseUncorrelatedMessage; workerThread = new Thread(MainLoop) { Name = workerThreadName }; workerThread.Start(); log.Info("Worker {0} created and inner thread started", WorkerThreadName); }
public Worker(IErrorTracker errorTracker, IReceiveMessages receiveMessages, IActivateHandlers activateHandlers, IStoreSubscriptions storeSubscriptions, ISerializeMessages serializeMessages, IStoreSagaData storeSagaData, IInspectHandlerPipeline inspectHandlerPipeline, string workerThreadName, IHandleDeferredMessage handleDeferredMessage, IMutateIncomingMessages mutateIncomingMessages, IStoreTimeouts storeTimeouts, IEnumerable <IUnitOfWorkManager> unitOfWorkManagers, ConfigureAdditionalBehavior configureAdditionalBehavior, MessageLogger messageLogger) { this.receiveMessages = receiveMessages; this.serializeMessages = serializeMessages; this.mutateIncomingMessages = mutateIncomingMessages; this.unitOfWorkManagers = unitOfWorkManagers; this.configureAdditionalBehavior = configureAdditionalBehavior; this.messageLogger = messageLogger; this.errorTracker = errorTracker; dispatcher = new Dispatcher(storeSagaData, activateHandlers, storeSubscriptions, inspectHandlerPipeline, handleDeferredMessage, storeTimeouts); dispatcher.UncorrelatedMessage += RaiseUncorrelatedMessage; nullMessageReceivedBackoffHelper = CreateBackoffHelper(configureAdditionalBehavior.BackoffBehavior); workerThread = new Thread(MainLoop) { Name = workerThreadName }; workerThread.Start(); log.Info("Worker {0} created and inner thread started", WorkerThreadName); }
/// <summary> /// Initializes a new instance of the <see cref="InMemoryPersistence"/> class. /// </summary> /// <param name="messageSender">The <see cref="IMessageSender">messgae sender</see> used to dispatch persisted messages.</param> /// <param name="sagaStorage">The <see cref="IStoreSagaData">object</see> used to store saga data.</param> public InMemoryPersistence(IMessageSender messageSender, IStoreSagaData sagaStorage) { Arg.NotNull(messageSender, nameof(messageSender)); Arg.NotNull(sagaStorage, nameof(sagaStorage)); MessageSender = messageSender; SagaStorage = sagaStorage; }
protected override void DoSetUp() { DropTable("sagas"); DropTable("saga_index"); persister = new SqlServerSagaPersister(ConnectionStrings.SqlServer, "saga_index", "sagas") .EnsureTablesAreCreated(); }
/// <summary> /// Initializes a new instance of the <see cref="SagaConfiguration"/> class. /// </summary> /// <param name="storage">The configure <see cref="IStoreSagaData">saga storage</see>.</param> /// <param name="metadata">The configured <see cref="SagaMetadataCollection">collection saga metadata</see>.</param> public SagaConfiguration(IStoreSagaData storage, SagaMetadataCollection metadata) { Arg.NotNull(storage, nameof(storage)); Arg.NotNull(metadata, nameof(metadata)); Storage = storage; Metadata = metadata; }
/// <summary> /// Indicates the message bus configuration will have the specified saga store. /// </summary> /// <param name="value">The configured <see cref="IStoreSagaData">saga store</see>.</param> /// <returns>The original <see cref="MessageBusConfigurationBuilder"/> instance.</returns> public virtual MessageBusConfigurationBuilder HasSagaStorage(IStoreSagaData value) { Arg.NotNull(value, nameof(value)); Contract.Ensures(Contract.Result <MessageBusConfiguration>() != null); SagaStorage = value; return(this); }
/// <summary> /// Constructs the hybrid saga persister and configures the fallback saga persister, which will be used in all cases /// where a custom saga persister has not been supplied. /// </summary> public HybridSagaPersister(IStoreSagaData fallbackSagaPersister) { if (fallbackSagaPersister == null) { throw new ArgumentException(@"When configuring the HybridSagapersister, it is important that you supply a fallback saga persister which will be used in cases where no customized saga persister can be found."); } this.fallbackSagaPersister = fallbackSagaPersister; }
protected override void DoSetUp() { activator = new HandlerActivatorForTesting(); storeSagaData = Mock <IStoreSagaData>(); dispatcher = new Dispatcher(storeSagaData, activator, new InMemorySubscriptionStorage(), new RearrangeHandlersPipelineInspector(), new DeferredMessageHandlerForTesting()); }
internal SagaActivator(IMessageBusConfiguration configuration) { Contract.Requires(configuration != null); var sagas = configuration.Sagas; this.configuration = configuration; clock = configuration.Clock; storage = sagas.Storage; sagaMetadata = sagas.Metadata; }
/// <summary> /// Constructs the dispatcher with the specified instances to store and retrieve saga data, /// create message handlers, store and retrieve subscriptions, and to inspect and /// possibly rearrange the handler pipeline. /// </summary> public Dispatcher(IStoreSagaData storeSagaData, IActivateHandlers activateHandlers, IStoreSubscriptions storeSubscriptions, IInspectHandlerPipeline inspectHandlerPipeline, IHandleDeferredMessage handleDeferredMessage) { this.storeSagaData = storeSagaData; this.activateHandlers = activateHandlers; this.storeSubscriptions = storeSubscriptions; this.inspectHandlerPipeline = inspectHandlerPipeline; this.handleDeferredMessage = handleDeferredMessage; }
protected override void DoSetUp() { factory = Activator.CreateInstance <TFactory>(); var headers = new Dictionary <string, object> { { Headers.ReturnAddress, "none" }, { Headers.MessageId, "just_some_message_id" }, }; messageContext = MessageContext.Establish(headers); persister = factory.CreatePersister(); }
protected override void DoSetUp() { activateHandlers = new HandlerActivatorForTesting(); determineMessageOwnership = Mock<IDetermineMessageOwnership>(); sendMessages = Mock<ISendMessages>(); serializeMessages = new JsonMessageSerializer(); storeSagaData = Mock<IStoreSagaData>(); receiveMessages = new MessageReceiverForTesting(serializeMessages); inspectHandlerPipeline = new TrivialPipelineInspector(); storeSubscriptions = Mock<IStoreSubscriptions>(); bus = CreateTheBus(); bus.Start(); }
protected override void DoSetUp() { activateHandlers = new HandlerActivatorForTesting(); determineDestination = Mock <IDetermineDestination>(); sendMessages = Mock <ISendMessages>(); serializeMessages = new JsonMessageSerializer(); storeSagaData = Mock <IStoreSagaData>(); receiveMessages = new MessageReceiverForTesting(serializeMessages); inspectHandlerPipeline = new TrivialPipelineInspector(); storeSubscriptions = Mock <IStoreSubscriptions>(); bus = CreateTheBus(); bus.Start(); }
protected override void DoSetUp() { var headers = new Dictionary <string, object> { { Headers.ReturnAddress, "none" }, { Headers.MessageId, "just_some_message_id" }, }; persister = TrackDisposable(Activator.CreateInstance <TFactory>()).CreatePersister(); TrackDisposable(TransactionContext.None()); messageContext = MessageContext.Establish(headers); }
/// <summary> /// Constructs the bus with the specified ways of achieving its goals. /// </summary> /// <param name="activateHandlers">The bus will use this to construct handlers for received messages.</param> /// <param name="sendMessages">Will be used to send transport messages when you send, publish, and reply.</param> /// <param name="receiveMessages">Will be used to receive transport messages. If the bus is configured to run with multiple threads, this one should be reentrant.</param> /// <param name="storeSubscriptions">Will be used to store subscription information. Is only relevant if the bus is a publisher, i.e. it publishes messages and other services assume they can subscribe to its messages.</param> /// <param name="storeSagaData">Will be used to store saga data. Is only relevant if one or more handlers are derived from <see cref="Saga"/>.</param> /// <param name="determineDestination">Will be used to resolve a destination in cases where the message destination is not explicitly specified as part of a send/subscribe operation.</param> /// <param name="serializeMessages">Will be used to serialize and deserialize transport messages.</param> /// <param name="inspectHandlerPipeline">Will be called to inspect the pipeline of handlers constructed to handle an incoming message.</param> public RebusBus(IActivateHandlers activateHandlers, ISendMessages sendMessages, IReceiveMessages receiveMessages, IStoreSubscriptions storeSubscriptions, IStoreSagaData storeSagaData, IDetermineDestination determineDestination, ISerializeMessages serializeMessages, IInspectHandlerPipeline inspectHandlerPipeline) { this.activateHandlers = activateHandlers; this.sendMessages = sendMessages; this.receiveMessages = receiveMessages; this.storeSubscriptions = storeSubscriptions; this.determineDestination = determineDestination; this.serializeMessages = serializeMessages; this.storeSagaData = storeSagaData; this.inspectHandlerPipeline = inspectHandlerPipeline; rebusId = Interlocked.Increment(ref rebusIdCounter); log.Info("Rebus bus created"); }
/// <summary> /// Constructs the dispatcher with the specified instances to store and retrieve saga data, /// create message handlers, store and retrieve subscriptions, and to inspect and /// possibly rearrange the handler pipeline. /// </summary> public Dispatcher(IStoreSagaData storeSagaData, IActivateHandlers activateHandlers, IStoreSubscriptions storeSubscriptions, IInspectHandlerPipeline inspectHandlerPipeline, IHandleDeferredMessage handleDeferredMessage, IStoreTimeouts storeTimeouts) { this.storeSagaData = storeSagaData; this.activateHandlers = activateHandlers; this.storeSubscriptions = storeSubscriptions; this.inspectHandlerPipeline = inspectHandlerPipeline; this.handleDeferredMessage = handleDeferredMessage; this.storeTimeouts = storeTimeouts; sagaDataIdPropertyName = Reflect.Path <ISagaData>(s => s.Id); sagaDataPropertyName = Reflect.Path <Saga <ISagaData> >(s => s.Data); }
protected RebusBus CreateBus(string inputQueueName, IActivateHandlers activateHandlers, IStoreSubscriptions storeSubscriptions, IStoreSagaData storeSagaData, string errorQueueName) { var messageQueue = new MsmqMessageQueue(inputQueueName).PurgeInputQueue(); MsmqUtil.PurgeQueue(errorQueueName); serializer = new JsonMessageSerializer(); var bus = new RebusBus(activateHandlers, messageQueue, messageQueue, storeSubscriptions, storeSagaData, this, serializer, pipelineInspector, new ErrorTracker(errorQueueName), null, new ConfigureAdditionalBehavior()); EnsureProperDisposal(bus); EnsureProperDisposal(messageQueue); return bus; }
void Customize(IStoreSagaData customSagaPersisterInstance, Type sagaDataType) { if (customSagaPersisterInstance == null) { throw new ArgumentNullException("customSagaPersisterInstance", "When adding a custom saga persister, you need to supply an instance!"); } var key = sagaDataType; if (customSagaPersisters.ContainsKey(key)) { throw new InvalidOperationException( string.Format( "A custom saga persister of type {0} has already been supplied for {1} - only one custom persister can be supplied for each saga data type!", customSagaPersisters[key].GetType(), key)); } customSagaPersisters[key] = customSagaPersisterInstance; }
/// <summary> /// Constructs the bus with the specified ways of achieving its goals. /// </summary> /// <param name="activateHandlers">The bus will use this to construct handlers for received messages.</param> /// <param name="sendMessages">Will be used to send transport messages when you send, publish, and reply.</param> /// <param name="receiveMessages">Will be used to receive transport messages. If the bus is configured to run with multiple threads, this one should be reentrant.</param> /// <param name="storeSubscriptions">Will be used to store subscription information. Is only relevant if the bus is a publisher, i.e. it publishes messages and other services assume they can subscribe to its messages.</param> /// <param name="storeSagaData">Will be used to store saga data. Is only relevant if one or more handlers are derived from <see cref="Saga"/>.</param> /// <param name="determineDestination">Will be used to resolve a destination in cases where the message destination is not explicitly specified as part of a send/subscribe operation.</param> /// <param name="serializeMessages">Will be used to serialize and deserialize transport messages.</param> /// <param name="inspectHandlerPipeline">Will be called to inspect the pipeline of handlers constructed to handle an incoming message.</param> /// <param name="errorTracker">Will be used to track failed delivery attempts.</param> public RebusBus(IActivateHandlers activateHandlers, ISendMessages sendMessages, IReceiveMessages receiveMessages, IStoreSubscriptions storeSubscriptions, IStoreSagaData storeSagaData, IDetermineDestination determineDestination, ISerializeMessages serializeMessages, IInspectHandlerPipeline inspectHandlerPipeline, IErrorTracker errorTracker) { this.activateHandlers = activateHandlers; this.sendMessages = sendMessages; this.receiveMessages = receiveMessages; this.storeSubscriptions = storeSubscriptions; this.determineDestination = determineDestination; this.serializeMessages = serializeMessages; this.storeSagaData = storeSagaData; this.inspectHandlerPipeline = inspectHandlerPipeline; this.errorTracker = errorTracker; batch = new RebusBatchOperations(determineDestination, storeSubscriptions, this); routing = new RebusRouting(this); rebusId = Interlocked.Increment(ref rebusIdCounter); log.Info("Rebus bus created"); }
/// <summary> /// Constructs the bus with the specified ways of achieving its goals. /// </summary> /// <param name="activateHandlers">The bus will use this to construct handlers for received messages.</param> /// <param name="sendMessages">Will be used to send transport messages when you send, publish, and reply.</param> /// <param name="receiveMessages">Will be used to receive transport messages. If the bus is configured to run with multiple threads, this one should be reentrant.</param> /// <param name="storeSubscriptions">Will be used to store subscription information. Is only relevant if the bus is a publisher, i.e. it publishes messages and other services assume they can subscribe to its messages.</param> /// <param name="storeSagaData">Will be used to store saga data. Is only relevant if one or more handlers are derived from <see cref="Saga"/>.</param> /// <param name="determineMessageOwnership">Will be used to resolve a destination in cases where the message destination is not explicitly specified as part of a send/subscribe operation.</param> /// <param name="serializeMessages">Will be used to serialize and deserialize transport messages.</param> /// <param name="inspectHandlerPipeline">Will be called to inspect the pipeline of handlers constructed to handle an incoming message.</param> /// <param name="errorTracker">Will be used to track failed delivery attempts.</param> /// <param name="storeTimeouts">Optionally provides an internal timeout manager to be used instead of sending timeout requests to an external timeout manager</param> /// <param name="configureAdditionalBehavior"></param> public RebusBus( IActivateHandlers activateHandlers, ISendMessages sendMessages, IReceiveMessages receiveMessages, IStoreSubscriptions storeSubscriptions, IStoreSagaData storeSagaData, IDetermineMessageOwnership determineMessageOwnership, ISerializeMessages serializeMessages, IInspectHandlerPipeline inspectHandlerPipeline, IErrorTracker errorTracker, IStoreTimeouts storeTimeouts, ConfigureAdditionalBehavior configureAdditionalBehavior) { this.activateHandlers = activateHandlers; this.sendMessages = sendMessages; this.receiveMessages = receiveMessages; this.storeSubscriptions = storeSubscriptions; this.determineMessageOwnership = determineMessageOwnership; this.serializeMessages = serializeMessages; this.storeSagaData = storeSagaData; this.inspectHandlerPipeline = inspectHandlerPipeline; this.errorTracker = errorTracker; this.storeTimeouts = storeTimeouts; this.configureAdditionalBehavior = configureAdditionalBehavior; batch = new RebusBatchOperations(determineMessageOwnership, storeSubscriptions, this); routing = new RebusRouting(this); rebusId = Interlocked.Increment(ref rebusIdCounter); continuations = new RebusSynchronizationContext(); log.Info("Rebus bus {0} created", rebusId); if (storeTimeouts == null) { var timeoutManagerEndpointAddress = RebusConfigurationSection .GetConfigurationValueOrDefault(s => s.TimeoutManagerAddress, "rebus.timeout"); log.Info("Using external timeout manager with input queue '{0}'", timeoutManagerEndpointAddress); timeoutManagerAddress = timeoutManagerEndpointAddress; } else { log.Info("Using internal timeout manager"); timeoutManagerAddress = this.receiveMessages.InputQueueAddress; dueTimeoutScheduler = new DueTimeoutScheduler(storeTimeouts, new DeferredMessageReDispatcher(this)); } }
/// <summary> /// Adds the specified saga persister to the list of available saga persisters. At most one persister of each type may be added this way. /// </summary> public HybridSagaPersister Add(IStoreSagaData customSagaPersister) { availableCustomSagaPersisters.Add(customSagaPersister); return(this); }
public MessageDeferringSagaPersister(IStoreSagaData inner, Func <Exception, bool> filter) { _inner = inner.ThrowIfNull(nameof(inner)); _filter = filter.ThrowIfNull(nameof(filter)); }
protected override void DoSetUp() { persister = new SqlServerSagaPersister(ConnectionString); DeleteRows("sagas"); DeleteRows("saga_index"); }
public void Use(IStoreSagaData storeSagaData) { Backbone.StoreSagaData = storeSagaData; }
public static void DoTheTest(IStoreSagaData persister, int numberOfSagas, int iterations) { var sagaDatas = Enumerable.Range(0, numberOfSagas) .Select(i => new SomePieceOfFairlyComplexSagaData { Id = Guid.NewGuid(), EmbeddedThings = { new SomeEmbeddedThing(), new SomeEmbeddedThing(), new SomeEmbeddedThing(), new SomeEmbeddedThing(), new SomeEmbeddedThing(), new SomeEmbeddedThing(), }, AnotherEmbeddedThing = new AnotherEmbeddedThing { Leafs = { new LeafThing(), new LeafThing(), new LeafThing(), new LeafThing(), } }, OrdinaryField = Guid.NewGuid().ToString(), YetAnotherEmbeddedThing = new YetAnotherEmbeddedThing { EvenDeeperEmbeddedThing = new EvenDeeperEmbeddedThing() } }) .ToList(); var pathsToIndex = new[] { Reflect.Path<SomePieceOfFairlyComplexSagaData>(d => d.Id), Reflect.Path<SomePieceOfFairlyComplexSagaData>(d => d.OrdinaryField), Reflect.Path<SomePieceOfFairlyComplexSagaData>(d => d.AnotherEmbeddedThing.EmbeddedValue), Reflect.Path<SomePieceOfFairlyComplexSagaData>( d => d.YetAnotherEmbeddedThing.EvenDeeperEmbeddedThing.FinallySomeValue), }; Console.WriteLine("Running {0} iterations of saving/updating {1} sagas", iterations, numberOfSagas); var stopwatch = Stopwatch.StartNew(); for (var counter = 0; counter < iterations; counter++) { foreach (var data in sagaDatas) { persister.Save(data, pathsToIndex); } } var elapsed = stopwatch.Elapsed; Console.WriteLine(@"Saving/updating {0} sagas {1} times took {2:0.0} s - that's {3:0} ops/s", numberOfSagas, iterations, elapsed.TotalSeconds, numberOfSagas*iterations/elapsed.TotalSeconds); }
public Worker( IErrorTracker errorTracker, IReceiveMessages receiveMessages, IActivateHandlers activateHandlers, IStoreSubscriptions storeSubscriptions, ISerializeMessages serializeMessages, IStoreSagaData storeSagaData, IInspectHandlerPipeline inspectHandlerPipeline, string workerThreadName, IHandleDeferredMessage handleDeferredMessage, IMutateIncomingMessages mutateIncomingMessages, IStoreTimeouts storeTimeouts, IEnumerable<IUnitOfWorkManager> unitOfWorkManagers, ConfigureAdditionalBehavior configureAdditionalBehavior, MessageLogger messageLogger, RebusSynchronizationContext continuations) { this.receiveMessages = receiveMessages; this.serializeMessages = serializeMessages; this.mutateIncomingMessages = mutateIncomingMessages; this.unitOfWorkManagers = unitOfWorkManagers; this.configureAdditionalBehavior = configureAdditionalBehavior; this.messageLogger = messageLogger; this.continuations = continuations; this.errorTracker = errorTracker; dispatcher = new Dispatcher(storeSagaData, activateHandlers, storeSubscriptions, inspectHandlerPipeline, handleDeferredMessage, storeTimeouts); dispatcher.UncorrelatedMessage += RaiseUncorrelatedMessage; nullMessageReceivedBackoffHelper = CreateBackoffHelper(configureAdditionalBehavior.BackoffBehavior); workerThread = new Thread(MainLoop) { Name = workerThreadName }; workerThread.Start(); log.Info("Worker {0} created and inner thread started", WorkerThreadName); }
protected override void DoSetUp() { persister = new SqlServerSagaPersister(ConnectionStrings.SqlServer, "saga_index", "sagas"); DeleteRows("sagas"); DeleteRows("saga_index"); }
public DualSagaPersister(IStoreSagaData oldSagaPersister, IStoreSagaData newSagaPersister) { _oldSagaPersister = oldSagaPersister; _newSagaPersister = newSagaPersister; }
protected RebusBus CreateBus(string inputQueueName, IActivateHandlers activateHandlers, IStoreSubscriptions storeSubscriptions, IStoreSagaData storeSagaData, string errorQueueName) { var messageQueue = new MsmqMessageQueue(inputQueueName).PurgeInputQueue(); MsmqUtil.PurgeQueue(errorQueueName); serializer = new JsonMessageSerializer(); var bus = new RebusBus(activateHandlers, messageQueue, messageQueue, storeSubscriptions, storeSagaData, this, serializer, pipelineInspector, new ErrorTracker(errorQueueName), null, new ConfigureAdditionalBehavior()); EnsureProperDisposal(bus); EnsureProperDisposal(messageQueue); return(bus); }
public SagaDataSnatcher(IStoreSagaData innerSagaPersister) { this.innerSagaPersister = innerSagaPersister; }
private bool IsNewStoreSagaData(IStoreSagaData sagaPersister) { return(sagaPersister == _newSagaPersister); }
public static void DoTheTest(IStoreSagaData persister, int numberOfSagas, int iterations) { var sagaDatas = Enumerable.Range(0, numberOfSagas) .Select(i => new SomePieceOfFairlyComplexSagaData { Id = Guid.NewGuid(), EmbeddedThings = { new SomeEmbeddedThing(), new SomeEmbeddedThing(), new SomeEmbeddedThing(), new SomeEmbeddedThing(), new SomeEmbeddedThing(), new SomeEmbeddedThing(), }, AnotherEmbeddedThing = new AnotherEmbeddedThing { Leafs = { new LeafThing(), new LeafThing(), new LeafThing(), new LeafThing(), } }, OrdinaryField = Guid.NewGuid().ToString(), YetAnotherEmbeddedThing = new YetAnotherEmbeddedThing { EvenDeeperEmbeddedThing = new EvenDeeperEmbeddedThing() } }) .ToList(); var pathsToIndex = new[] { Reflect.Path <SomePieceOfFairlyComplexSagaData>(d => d.Id), Reflect.Path <SomePieceOfFairlyComplexSagaData>(d => d.OrdinaryField), Reflect.Path <SomePieceOfFairlyComplexSagaData>(d => d.AnotherEmbeddedThing.EmbeddedValue), Reflect.Path <SomePieceOfFairlyComplexSagaData>(d => d.YetAnotherEmbeddedThing.EvenDeeperEmbeddedThing.FinallySomeValue), }; Console.WriteLine("Running {0} iterations of saving/updating {1} sagas", iterations, numberOfSagas); var stopwatch = Stopwatch.StartNew(); for (var counter = 0; counter < iterations; counter++) { foreach (var data in sagaDatas) { if (counter == 0) { persister.Insert(data, pathsToIndex); } else { persister.Update(data, pathsToIndex); } } } var elapsed = stopwatch.Elapsed; Console.WriteLine(@"Saving/updating {0} sagas {1} times took {2:0.0} s - that's {3:0} ops/s", numberOfSagas, iterations, elapsed.TotalSeconds, numberOfSagas * iterations / elapsed.TotalSeconds); }
protected RebusBus CreateBus(string inputQueueName, IActivateHandlers activateHandlers, IStoreSubscriptions storeSubscriptions, IStoreSagaData storeSagaData, string errorQueueName) { var messageQueue = new MsmqMessageQueue(inputQueueName, errorQueueName).PurgeInputQueue(); MsmqUtil.PurgeQueue(errorQueueName); serializer = new JsonMessageSerializer(); var bus = new RebusBus(activateHandlers, messageQueue, messageQueue, storeSubscriptions, storeSagaData, this, serializer, pipelineInspector); toDispose.Add(bus); toDispose.Add(messageQueue); return bus; }
Task <SagaSearchResult> ISagaInstanceActivator.GetData(ISagaInstance instance, IStoreSagaData store, object message, CancellationToken cancellationToken) { Contract.Requires <ArgumentNullException>(instance != null, nameof(instance)); Contract.Requires <ArgumentNullException>(store != null, nameof(store)); Contract.Requires <ArgumentNullException>(message != null, nameof(message)); Contract.Ensures(Contract.Result <Task <SagaSearchResult> >() != null); return(null); }
/// <summary> /// Initializes a new instance of the <see cref="SearchForSagaByProperty{TData}"/> class. /// </summary> /// <param name="sagaStorage">The underlying <see cref="IStoreSagaData">saga storage</see>.</param> public SearchForSagaByProperty(IStoreSagaData sagaStorage) { Arg.NotNull(sagaStorage, nameof(sagaStorage)); store = sagaStorage; }