I finally got this to work once I realized that the GUID must be generated and maintained by the initiator of the saga, and that the messages need to inherit ISagaMessage. I initially thought the saga was doing all that work magically, behind the scenes.
On Tuesday, April 30, 2013 10:14:31 AM UTC-4, Dan Ling wrote: > > Thanks Corey.... so now I tried registering the InMemorySagaPersister as a > singleton, but I'm still getting the same error. Is there anything else I > need to do? I'm not managing a saga guid or anything, I'm not sure if > that's required. > > public class ServerBootStrapper : UnityBootStrapper > { > protected override void ConfigureContainer() > { > base.ConfigureContainer(); > Container.RegisterType<ISagaPersister<DinnerSaga>, > InMemorySagaPersister<DinnerSaga>>(new > ContainerControlledLifetimeManager()); > //Container.RegisterType<Orchestrates<DinnerServed>, > ConsumerOf<DinnerServed>>(); > } > } > > On Monday, April 29, 2013 6:33:14 PM UTC-4, Corey wrote: >> >> If you're storing the state in memory and you get a new instance of >> ISagaPersister each time (i.e. not a singleton) then you would effectively >> have no persistence. >> >> >> On Mon, Apr 29, 2013 at 3:48 PM, Dan Ling <d.l...@gmail.com> wrote: >> >>> I'm trying to get an extremely simple saga to work. My saga is >>> successfully initiated by "DinnerCooked", but when I send it a >>> "DinnerServed" message, I'm getting a "message received but no consumer >>> found" error. >>> >>> Here is my code: >>> >>> >>> >>> public class DinnerSaga : ISaga<DinnerState>, >>> InitiatedBy<DinnerCooked>, >>> Orchestrates<DinnerServed> >>> { >>> public Guid Id { get; set; } >>> public bool IsCompleted { get; set; } >>> public DinnerState State { get; set; } >>> >>> public void Consume(DinnerCooked message) >>> { >>> Console.WriteLine("Chef cooked a {0}.", message.Dish); >>> IsCompleted = false; >>> } >>> >>> public void Consume(DinnerServed message) >>> { >>> Console.WriteLine("Dinner has been served, yum."); >>> IsCompleted = true; >>> } >>> } >>> >>> class Program >>> { >>> static void Main(string[] args) >>> { >>> Console.WriteLine("Chef is ready to cook."); >>> >>> var host = new DefaultHost(); >>> host.Start<ChefBootStrapper>(); >>> >>> Console.WriteLine("Press enter to begin cooking dinner."); >>> Console.ReadLine(); >>> >>> IServiceBus bus = host.Bus as IServiceBus; >>> bus.Send(new DinnerCooked { Dish = "steak"}); >>> >>> Console.WriteLine("Chef cooked a steak."); >>> Console.WriteLine("Press enter to serve dinner to the >>> customer."); >>> Console.ReadLine(); >>> bus.Send(new DinnerServed {Dish = "steak"}); >>> >>> Console.ReadLine(); >>> } >>> } >>> >>> public class ServerBootStrapper : UnityBootStrapper >>> { >>> protected override void ConfigureContainer() >>> { >>> base.ConfigureContainer(); >>> Container.RegisterType<ISagaPersister<DinnerSaga>, >>> InMemorySagaPersister<DinnerSaga>>(); >>> //Container.RegisterType<Orchestrates<DinnerServed>, >>> ConsumerOf<DinnerServed>>(); >>> } >>> } >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Rhino Tools Dev" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to rhino-tools-d...@googlegroups.com. >>> To post to this group, send email to rhino-t...@googlegroups.com. >>> Visit this group at http://groups.google.com/group/rhino-tools-dev?hl=en >>> . >>> For more options, visit https://groups.google.com/groups/opt_out. >>> >>> >>> >> >> -- You received this message because you are subscribed to the Google Groups "Rhino Tools Dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to rhino-tools-dev+unsubscr...@googlegroups.com. To post to this group, send email to rhino-tools-dev@googlegroups.com. Visit this group at http://groups.google.com/group/rhino-tools-dev?hl=en. For more options, visit https://groups.google.com/groups/opt_out.