我有一个标准的Order/OrderLineItem设置.
白天生成的许多退款在白天持续存在,退款包括订单ID和1个或多个LineItemId.我需要在一天结束时将这些(在Windows服务中)合并到信用卡,礼品卡,奖励卡等中.
我一直在阅读Mark Seemann的书,可以看到使用Composition Root来勾勒对象图的好处.
整合过程本身就是我需要做的最多的组合.
我不明白的是这个整合逻辑应该在哪里结束?我可以假设,无论合并逻辑在哪里结束,我仍然只在组合根中使用类似Unity的东西,那组合应该很早就发生?
很高兴提供更多信息或酌情澄清!
.net c# domain-driven-design dependency-injection unity-container
我是RX的新手,一直在研究错误处理和Retry的使用。我有以下内容(是的,我知道这不是一个“真实的”单元测试,但是它给了我一些摆弄的地方!),我想知道如何继续重试,但是能够记录任何异常?
[Test]
public void Test()
{
var scheduler = new TestScheduler();
var source = scheduler.CreateHotObservable(
new Recorded<Notification<long>>(10000000, Notification.CreateOnNext(0L)),
new Recorded<Notification<long>>(20000000, Notification.CreateOnNext(1L)),
new Recorded<Notification<long>>(30000000, Notification.CreateOnNext(2L)),
new Recorded<Notification<long>>(30000001, Notification.CreateOnError<long>(new Exception("Fail"))),
new Recorded<Notification<long>>(40000000, Notification.CreateOnNext(3L)),
new Recorded<Notification<long>>(40000000, Notification.CreateOnCompleted<long>())
);
source.Retry().Subscribe(
l => Console.WriteLine($"OnNext {l}"),
exception => Console.WriteLine(exception.ToString()), // Would be logging this in production
() => Console.WriteLine("OnCompleted"));
scheduler.Start(
() => source,
0,
TimeSpan.FromSeconds(1).Ticks,
TimeSpan.FromSeconds(5).Ticks);
}
Run Code Online (Sandbox Code Playgroud)
导致...
OnNext 0
OnNext 1
OnNext 2
OnNext 3
OnCompleted
Run Code Online (Sandbox Code Playgroud)
...除了我想记录发生在2到3之间的异常外,这正是我想要发生的事情。
有没有一种方法可以使订阅服务器在OnError中看到异常(并将其记录),然后重新订阅,使其看到3?
谢谢!