Storage notifications
Storage can now put an event into a Queue every time an object is created or
overwritten. Each .notify() call adds a rule with an optional prefix and
suffix:
const work = new alien.Queue("work").build()
const objects = new alien.Storage("objects")
.notify(work, { prefix: "uploads/", suffix: ".json" })
.notify(work, { prefix: "uploads/", suffix: ".csv" })
.build()Consume the queue with a Worker's queue trigger, batched or not, or with
queue.receive(). storageEventFromMessage returns the same StorageEvent
on every cloud, with the bucket, key, and timestamp.
S3 delivers straight to SQS, Cloud Storage publishes to Pub/Sub, and Azure
routes Blob Storage events through Event Grid into Service Bus. Under
alien dev, each rule keeps a cursor, so a restart doesn't replay objects
already delivered.
On a frozen bucket, the rules belong to initial setup, so changing one needs the customer's admin to rerun initial setup. On a live bucket, Alien updates the rules on every release and touches only its own entries.
- Rules: up to 10 per Storage, and no two rules may match the same key
- Python and Rust:
storage_event_from_message - Storage triggers: on AWS, updating or removing a Worker storage trigger no longer clears other entries in the bucket's notification configuration