简体   繁体   English

使用Azure Service Bus Queue和BrokeredMessage.ScheduledEnqueueTimeUtc续订订阅

[英]using an Azure Service Bus Queue and BrokeredMessage.ScheduledEnqueueTimeUtc to renew subscriptions

I have a subscription model, and want to perform renew-related logic like issue new invoice, send emails, etc. For example, user would purchase the subscription today, and the renewal is in a year's time. 我有一个订阅模型,并希望执行与续订相关的逻辑,如发出新发票,发送电子邮件等。例如,用户今天将购买订阅,续订是在一年的时间。 I've been using an Azure Queue recently, and think it would apply for such a renewal. 我最近一直在使用Azure Queue,并认为它适用于这样的续订。

Is it possible to use the Azure Queue by pushing messages using BrokeredMessage.ScheduledEnqueueTimeUtc ( http://msdn.microsoft.com/en-us/library/microsoft.servicebus.messaging.brokeredmessage.scheduledenqueuetimeutc.aspx ) for such long term scheduled messages? 是否可以通过使用BrokeredMessage.ScheduledEnqueueTimeUtchttp://msdn.microsoft.com/en-us/library/microsoft.servicebus.messaging.brokeredmessage.scheduledenqueuetimeutc.aspx )推送消息来使用Azure队列来获取此类长期计划消息?

I've used it for shorter-term, like sending notifications in 1 minute time and it works great. 我已经将它用于短期,比如在1分钟内发送通知,效果很好。

This way, I can have even multiple processes listening to the queue, and be sure that only one process would perform the renewal logic. 这样,我甚至可以有多个进程监听队列,并确保只有一个进程可以执行更新逻辑。 This would solve a lot of locking-related problems, as that is kind of built-in the Azure Queue via leasing and related features. 这将解决许多与锁相关的问题,因为这是通过租赁和相关功能内置Azure Queue。

Yes, you can use it for long-term scheduling, scheduled messages have the same guaranties as normal ones. 是的,您可以将其用于长期调度,预定的消息与普通消息具有相同的保证。 But there are few things you need to be aware of: 但是你需要注意的事情很少:

  • ScheduledEnqueueTimeUtc is a time when message is going to be available (within hundreds of miliseconds) on the queue but not necessary delivered, this depends on load and state of the queue. ScheduledEnqueueTimeUtc是消息在队列上可用(在几百毫秒内)但不必传递的时间,这取决于队列的负载和状态。 So it's fine for business processes but not for time sensitive (milliseconds) usage. 因此,它适用于业务流程,但不适用于时间敏感(毫秒)的使用。 Not a problem in your case, unless your subscription cancellation is really time sensitive. 在您的情况下不是问题,除非您的订阅取消确实是时间敏感的。
  • It affects your storage quota ( Not really a problem with current quotas, but if you think about years this might be a problem) 它会影响您的存储配额(当前配额不是真正的问题,但如果您考虑多年,这可能是一个问题)
  • As far as I'm aware you can't access scheduled messages before ScheduledEnqueueTimeUtc , they are invisible. 据我所知,你无法在ScheduledEnqueueTimeUtc之前访问预定的消息,它们是不可见的。

Extremely awesome source of informations on azure messaging 关于天蓝色消息传递的非常棒的信息来源

From technological perspective it's fine but in your case I would also think about other potential problems if you think about years: 从技术角度看它很好,但在你的情况下,如果考虑多年,我也会考虑其他潜在的问题:

  • Message versioning 消息版本控制
  • What happens when you would like to change Azure to something else (AWS?) 如果您想将Azure更改为其他内容会发生什么(AWS?)
  • What if you decide to change in next year Azure Service Bus for NServiceBus 如果您决定在明年更改NServiceBus的Azure Service Bus,该怎么办?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM