Object Storage is just a high-level interface on top of NatsJS.
It is a regular JetStream, where the Object key is a subject.
The main difference between KV and Object storages is that in the Object storage, you can store files greater than 1MB (a limitation of KV). It has no limit on the maximum object size and stores it in chunks (each message is an object chunk), so you can literally stream huge objects through NATS.
We placed this code in the @app.on_startup hook because @app.after_startup will be triggered AFTER your handlers start consuming messages. So, if you need to have access to any custom context objects, you should set them up in the @app.on_startup hook.
Also, we call awaitbroker.connect() method manually to establish the connection to be able to create a storage.
Next, we are ready to use this object right in the our handlers.
Let's create an Annotated object to shorten Context object access: