4 ms·
Azure's service bus queue has a much better solution for this: you can schedule an item to appear in the queue at any future time. https://docs.microsoft.com/en
by mcintyre1994 8y ago
Azure's service bus queue has a much better solution for this: you can schedule an item to appear in the queue at any future time. https://docs.microsoft.com/en-us/dotnet/api/microsoft.servicebus.messaging.brokeredmessage.scheduledenqueuetimeutc?view=azure-dotnet#Microsoft_ServiceBus_Messaging_BrokeredMessage_ScheduledEnqueueTimeUtc https://docs.microsoft.com/en-us/dotnet/api/microsoft.servic...
Like Amazon's new SQS Lambda trigger you can then schedule a serverless function that's triggered by new items in the queue to have arbitrary scheduling of tasks.
Using their Python API it's pretty nice:
from datetime import datetime, timedelta
from azure.servicebus import ServiceBusService, Message
sbs = ServiceBusService('task-queue', shared_access_key_name=key_name, shared_access_key_value=key_value)
d = datetime.utcnow() + timedelta(minutes=1)
task = {"some": "object"}
sbs.send_queue_message(
"task-queue",
Message(
task,
broker_properties={'ScheduledEnqueueTimeUtc': d}
)
)
- Serow225 8y agoThanks for the info, tucking that away! :)
- scarface74 8y agoYou can do the same with AWS... - set a CloudWatch scheduled rule to schedule a lambda. - or set a rule to send an sns, subscribe a queue to the sns topic and subscribe a lambda to the queue.
- efi_mk 8y agoCloudWatch is cron based, which means you can't schedule a one time event. Agree regarding sns, but in our case sns == s3
- scarface74 8y agoAWS adds a year parameter to cron. You can specify the exact time. Why use S3? S3 events aren’t guaranteed. SNS was specifically designed for this use case. https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/S...
- efi_mk 8y ago"you can schedule an item to appear in the queue at any future time" Nice! Anything similar in aws ?