I am looking at a ways to share the nested container between a Consumer observer and a consumer but I am not quite sure how to do it.
public class ConsumerObserver :
IConsumeObserver
{
Task IConsumeObserver.PreConsume<T>(ConsumeContext<T> context)
{
// called before the consumer's Consume method is called
return Task.FromResult(0);
}
Task IConsumeObserver.ConsumeFault<T>(ConsumeContext<T> context, Exception exception)
{
// called if the consumer's Consume method throws an exception
return Task.Run(() =>
{
var container = IoC.GetWorkflowContainer();
var uow = container.GetInstanceWrapper<IUnitOfWork>();
// get hold of the nested container used by conumer here and roll back my transaction
uow.UseTransactions(true);
});
}
}