public async Task <TestSaga08.SagaData08> FindBy(SomeOtherMessage message, SynchronizedStorageSession storageSession, ReadOnlyContextBag context) { Context.FinderUsed = true; var sagaData = await SagaPersister.Get <TestSaga08.SagaData08>(message.SagaId, storageSession, (ContextBag)context).ConfigureAwait(false); return(sagaData); }
public async Task SerializationExceptionFromClassUsedInStreamsAndAlsoStateTestTest() { Guid facilityGuid = Guid.NewGuid(); MessageContract messageReceivedFromStream = null; #region Stream setup spy IStreamProvider callpointStreamProvider = _fixture.HostedCluster.StreamProviderManager.GetStreamProvider("StreamProvider"); IAsyncStream <MessageContract> callpointStream = callpointStreamProvider.GetStream <MessageContract>(facilityGuid, "Namespace"); var subHandle = callpointStream.SubscribeAsync((message, token) => { messageReceivedFromStream = message; return(TaskDone.Done); }); IStreamProvider streamProvider = _fixture.HostedCluster.StreamProviderManager.GetStreamProvider("StreamProviderOther"); IAsyncStream <SomeOtherMessage> messageStream = streamProvider.GetStream <SomeOtherMessage>(facilityGuid, "NamespaceOther"); #endregion var aceMessage = new SomeOtherMessage { MyProp = "MyProp" }; await messageStream.OnNextAsync(aceMessage); await Task.Delay(TimeSpan.FromMilliseconds(1000)); Assert.NotNull(messageReceivedFromStream); Assert.IsType <MessageContract>(messageReceivedFromStream); }
public void Handle(MyMessage message) { SomeOtherMessage someOtherMessage = new SomeOtherMessage(); someOtherMessage.SetHeader("MyCustomHeader", "My custom value"); bus.Send(someOtherMessage); }
public void Handle(MyMessage message) { var someOtherMessage = new SomeOtherMessage(); Bus.SetMessageHeader(someOtherMessage, "MyCustomHeader", "My custom value"); Bus.Send(someOtherMessage); }
public Task <TestSaga08.SagaData08> FindBy(SomeOtherMessage message, SynchronizedStorageSession storageSession, ReadOnlyContextBag context) { Context.FinderUsed = true; var bag = new ContextBag(); bag.Set(context.Get <IncomingMessage>()); return(SagaPersister.Get <TestSaga08.SagaData08>("Property", "Test", storageSession, bag)); }
public Task Handle(StartSagaMessage message, IMessageHandlerContext context) { var otherMessage = new SomeOtherMessage { SagaId = Data.Id }; return(context.SendLocal(otherMessage)); }
public void Handle(MyMessage message) { var someOtherMessage = new SomeOtherMessage(); bus.SetMessageHeader( msg: someOtherMessage, key: "MyCustomHeader", value: "My custom value"); bus.Send(someOtherMessage); }
public async Task <TestSaga08.SagaData08> FindBy(SomeOtherMessage message, SynchronizedStorageSession storageSession, ReadOnlyContextBag context) { Context.FinderUsed = true; var sagaInstance = new TestSaga08.SagaData08 { Property = "jfbsjdfbsdjh" }; //Make sure saga exists in the store. Persisters expect it there when they save saga instance after processing a message. await SagaPersister.Save(sagaInstance, SagaCorrelationProperty.None, storageSession, new ContextBag()).ConfigureAwait(false); return(sagaInstance); }
private async Task HandleMessage(SomeOtherMessage msg, StreamSequenceToken t) { _logger.Info($"facility={this.GetPrimaryKey()} Publishing msg={msg}"); var orleansStreamProvider = base.GetStreamProvider("StreamProvider"); var stream = orleansStreamProvider.GetStream <MessageContract>(this.GetPrimaryKey(), "Namespace"); MessageContract outboundMessage = new MessageContract { MyProp = msg.MyProp }; await stream.OnNextAsync(outboundMessage); }
public Task <TestSaga.SagaData> FindBy(SomeOtherMessage message, SynchronizedStorageSession session, ReadOnlyContextBag context) { Context.FinderUsed = true; return(session.GetSagaData <TestSaga.SagaData>( context: context, whereClause: "json_extract(Data,'$.Property') = @propertyValue", appendParameters: (builder, append) => { var parameter = builder(); parameter.ParameterName = "propertyValue"; parameter.Value = "Test"; append(parameter); })); }
public Task <TestSaga.SagaData> FindBy(SomeOtherMessage message, SynchronizedStorageSession session, ReadOnlyContextBag context, CancellationToken cancellationToken = default) { testContext.FinderUsed = true; return(session.GetSagaData <TestSaga.SagaData>( context: context, whereClause: @"""Data""->>'Property' ='Test'", appendParameters: (builder, append) => { var parameter = builder(); parameter.ParameterName = "propertyValue"; parameter.Value = "Test"; append(parameter); }, cancellationToken)); }
public void When_Transform_Message_On_Rule_Should_Handle_Message_On_Subscriber() { var messagebus = new UniRxMessageBus(); var handler = new SomeMessageHandler(string.Empty); messagebus.AddRule(MessageRouteRule.Create <SomeOtherMessage, SomeMessage, SomeMessageHandler>(string.Empty, false, null, new SampleTransformer(), null)); messagebus.Subscribe <SomeMessageHandler, SomeMessage>(handler, new MessageHandlerActionExecutor <SomeMessage>(msg => handler.Handle(msg))); var message = new SomeOtherMessage("First message", string.Empty, DateTime.UtcNow); messagebus.RaiseEvent(message); Assert.AreEqual(1, handler.HandleCallCount); }
public Task Handle(SomeOtherMessage message, IMessageHandlerContext context) { TestContext.HandledOtherMessage = true; return(Task.FromResult(0)); }
// This additional, unused, message is required to reprododuce https://github.com/Particular/NServiceBus/issues/4888 public Task Handle(SomeOtherMessage message, IMessageHandlerContext context) { return(Task.FromResult(0)); }
public void Handle(SomeOtherMessage message) { }