News for hackers. Stuff that matters.
Re:S3 trickery: using it as a scheduler by mcintyre1994 on Friday September 14, 2018 @06:42AM (#17986151)
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.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}
        )
    )
Re:S3 trickery: using it as a scheduler by scarface74 on Friday September 14, 2018 @08:16AM (#17986619)
You 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.

Re:S3 trickery: using it as a scheduler by efi_mk on Friday September 14, 2018 @08:31AM (#17986702)
CloudWatch is cron based, which means you can't schedule a one time event.

Agree regarding sns, but in our case sns == s3

Re:S3 trickery: using it as a scheduler by scarface74 on Friday September 14, 2018 @08:38AM (#17986741)
AWS 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/S...

Re:S3 trickery: using it as a scheduler by Serow225 on Friday September 14, 2018 @08:07AM (#17986578)
Thanks for the info, tucking that away! :)
Re:S3 trickery: using it as a scheduler by efi_mk on Friday September 14, 2018 @09:07AM (#17986903)
"you can schedule an item to appear in the queue at any future time" Nice! Anything similar in aws ?