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 [email protected].
To post to this group, send email to [email protected].
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.