--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-dis...@googlegroups.com.
To post to this group, send email to masstrans...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/f94b392d-e075-4059-9d76-b7f189bb00ec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Ok I've narrowed it down a bit. The responding doesn't seem to work when it happens as the result of a scheduled message. Responding immediately from the saga after the initiating message is fine. Got some code below demonstrating. Is there something else I should be doing or is this a bug?
namespace SagaTimeout{ using System; using Automatonymous; using MassTransit; using MassTransit.NLogIntegration; using MassTransit.QuartzIntegration; using MassTransit.Saga; using MassTransit.Scheduling; using Quartz.Impl;
class Program { static void Main(string[] args) { var scheduler = new StdSchedulerFactory().GetScheduler();
var bus = ServiceBusFactory.New(c => { c.UseRabbitMq(cf => { cf.ConfigureHost(new Uri("rabbitmq://localhost/sagatimeouttest"), configurator => { configurator.SetUsername("tom"); configurator.SetPassword("tom"); }); });
c.SetConcurrentConsumerLimit(1); c.UseNLog(); c.ReceiveFrom(new Uri("rabbitmq://localhost/sagatimeouttest")); c.UseJsonSerializer(); c.DisablePerformanceCounters(); c.Subscribe(x => x.Consumer(() => new ScheduleMessageConsumer(scheduler))); });
Common.Logging.LogManager.Adapter = new Common.Logging.Simple.ConsoleOutLoggerFactoryAdapter { Level = Common.Logging.LogLevel.Trace };
bus.SubscribeStateMachineSaga(new Saga(), new InMemorySagaRepository<SagaState>());
scheduler.JobFactory = new MassTransitJobFactory(bus); scheduler.Start();
bus.PublishRequest(new FirstMessage(Guid.NewGuid()), c => c.Handle<FirstMessageResponse>(x => Console.WriteLine("Got response")));
Console.WriteLine("Hit any key to exit"); Console.ReadLine(); scheduler.Shutdown(); } }
class SagaState : SagaStateMachineInstance { public Guid CorrelationId { get; private set; } public IServiceBus Bus { get; set; } public State CurrentState { get; set; }
public SagaState(Guid correlationId) { CorrelationId = correlationId; } }
class Saga : AutomatonymousStateMachine<SagaState> {
public Saga() { State(() => GotFirstMessage); Event(() => FirstMessage); Event(() => SecondMessage);
Initially( When(FirstMessage) .Then(s => s.Bus.ScheduleMessage(DateTime.UtcNow.AddSeconds(5), new SecondMessage(s.CorrelationId))) .Then(s => Console.WriteLine("Got first message")) // Responding here works //.Respond(s => new FirstMessageResponse(s.CorrelationId)); .TransitionTo(GotFirstMessage));
During(GotFirstMessage, When(SecondMessage) // Responding here doesn't work .Respond(s => new FirstMessageResponse(s.CorrelationId)));
}
public State GotFirstMessage { get; private set; } public Event<FirstMessage> FirstMessage { get; private set; } public Event<SecondMessage> SecondMessage { get; private set; } }
class FirstMessage : CorrelatedBy<Guid> { public Guid CorrelationId { get; set; }
public FirstMessage(Guid correlationId) { CorrelationId = correlationId; } }
class FirstMessageResponse : CorrelatedBy<Guid> { public Guid CorrelationId { get; set; }
public FirstMessageResponse(Guid correlationId) { CorrelationId = correlationId; } }
class SecondMessage : CorrelatedBy<Guid> { public Guid CorrelationId { get; set; }
public SecondMessage(Guid correlationId) { CorrelationId = correlationId; } }
}
--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-dis...@googlegroups.com.
To post to this group, send email to masstrans...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/7363afc0-ae89-480b-9104-493bb37e995a%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-discuss+unsub...@googlegroups.com.
To post to this group, send email to masstrans...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-dis...@googlegroups.com.
To post to this group, send email to masstrans...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/7363afc0-ae89-480b-9104-493bb37e995a%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-dis...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/b8af99f9-00c5-4322-b9a6-6883a4200c8d%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-discuss+unsub...@googlegroups.com.
To post to this group, send email to masstrans...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/7363afc0-ae89-480b-9104-493bb37e995a%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-discuss+unsub...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-dis...@googlegroups.com.
To post to this group, send email to masstrans...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/7363afc0-ae89-480b-9104-493bb37e995a%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-dis...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/b8af99f9-00c5-4322-b9a6-6883a4200c8d%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-dis...@googlegroups.com.
To post to this group, send email to masstrans...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/701e8ad6-e3e2-48fb-8cb4-bfd56dbeb97c%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-discuss+unsub...@googlegroups.com.
To post to this group, send email to masstrans...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/7363afc0-ae89-480b-9104-493bb37e995a%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-discuss+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/b8af99f9-00c5-4322-b9a6-6883a4200c8d%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-discuss+unsub...@googlegroups.com.
To post to this group, send email to masstrans...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-dis...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/65200421-7a01-44a9-a252-3f00c2bbada9%40googlegroups.com.