what is the difference between ReceiveOnly and Sends atomic with Receive in Nservicebus?

huangapple go评论54阅读模式
英文:

what is the difference between ReceiveOnly and Sends atomic with Receive in Nservicebus?

问题

我已阅读关于NServiceBus支持的交易类型,但我对NServiceBus中的"ReceiveOnly"和"Sends atomic with Receive"感到困惑。是否有人能够为我更详细地描述一下?

英文:

I have read types of transactions which are supported by Nservicebus but I got confused about the ReceiveOnly and Sends atomic with Receive in Nservicebusbus.
can anyone describe it for me a little more detail?

答案1

得分: 3

ReceiveOnly :

在这种模式下,接收操作被包裹在传输的本机事务中。此模式保证消息在从传入队列中永久删除之前,必须至少有一次处理尝试(包括存储用户数据和发送消息)成功完成。

例如:在Azure Service Bus和Azure Storage Queues中,消息在接收后不会从队列中移除,而是在一段时间内对其进行隐藏。这会阻止其他实例接收该消息。如果接收者未能在该时间范围内处理消息,或者明确放弃了该消息,那么该消息将再次变为可见。其他实例将能够接收它(实际上是将传入消息回滚)。

SendsAtomicWithReceive:

这种模式类似于ReceiveOnly,但事务也与发送操作共享。这意味着消息接收操作以及任何发送或发布操作都是原子提交的,即所有传出操作与正在进行的接收操作是原子的。

NServiceBus文档链接:https://docs.particular.net/transports/transactions

英文:

ReceiveOnly :

In this mode the receive operation is wrapped in a transport's native transaction. This mode guarantees that the message is not permanently deleted from the incoming queue until there is at least one processing attempt (including storing user data and sending out messages) finished successfully.

Eg: In Azure Service Bus and Azure Storage Queues, the message is not removed from the queue after it is received, but rather its hidden for some duration. This prevents other instances from receiving the message. If the receiver fails to process the message within that time frame or explicitly abandons the message, then the message will become visible again. Other instances will be able to pick it up (effectively rolling back the incoming message).

SendsAtomicWithReceive:

This mode is similar to the ReceiveOnly, but transaction is shared with sending operations as well. That means the message receive operation and any send or publish operations are all committed atomically i.e., all outgoing operations are atomic with the ongoing receive operation.

NServiceBus documentation: https://docs.particular.net/transports/transactions

huangapple
  • 本文由 发表于 2023年7月10日 18:39:58
  • 转载请务必保留本文链接:https://go.coder-hub.com/76652932.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定