webjob能否在执行前消费相关消息?

Can webjob consume related messages before executing?

webjob 是否有可能在每条新消息后有一个小的延迟来监听队列并使用所有相关消息(基于消息 ID 或会话 ID 或其他)?

例如,三个用户编辑和更新了三个时间表。两个是给同一个员工的。每个计划为 PayrollUpdated 生成一个事件:1) 员工 100,第 1 周,2017 年,2) 员工 200,第 1 周,2017 年,3) 员工 100,第 1 周,2017 年。

我希望 webjob 监听队列并执行两个并发的 webjobs,每个员工一个,周,年标识符。

我不知道批处理或会话是否可以完成此操作。我也无法全神贯注于 NServiceBus 以了解这是否是一个选项。

注意:webjob任务是幂等的。

Is it possible for a webjob to listen to a queue and consume all related messages (based on message id or session id or something else) with a small delay after each new message?

开箱编号。要使用所有相关消息,您需要使用将使用消息会话的 Message Sessions, which are not supported by the ServiceBus trigger. There is an issue for exactly this problem (and also an issue for Azure Functions since they rely on WebJobs SDK). Alternatively, you could look into creating a custom WebJob extension

I am also unable to wrap my head around NServiceBus to know if that is an option or not.

使用 NServiceBus,您可以使用 Sagas 来实现它。