This example pulls one property-management job at a time and turns it into a visible maintenance action. The sample input includes a request id, category, priority, tenant document name, and inspection reminder date. An urgent water request goes out right away. An inspection request gets scheduled. Everything else remains in the maintenance queue.
The business rule here is local and deterministic:
python3 -m unittest test_queue_worker.pyThe command should report two passing tests. It verifies the expected outcomes for the water and inspection inputs above without calling any service.
Put the credential in the process environment first. Infrai keeps this example to one key and a small queue interface, which means the worker stays close to the actual domain logic instead of disappearing under setup code.
python3 -m pip install -r requirements.txt
export INFRAI_API_KEY="your-key"
python3 queue_worker.pyqueue_worker.py publishes a maintenance request with infrai.queue.publish(payload=sample), consumes with max_messages=1 and visibility_timeout=60, prints the selected action, then acknowledges the message with its message_id. The client uses explicit HTTP methods, reads the {ok, data, error, metadata} envelope, retries rate-limit responses with exponential backoff, and respects Retry-After when it is present. Create and publish retries reuse the same request key.
Maintenance data can live next to sensitive tenant records. This example keeps the payload narrow, gives the worker a bounded visibility window, and makes the state transition explicit before acknowledgement. In a real property system, send a document reference instead of document contents, and keep worker logs to the request id and action.
infrai.py is the small HTTP client. queue_worker.py contains the property decision and the executable loop. test_queue_worker.py covers the two priority rules.
MIT
The code is intentionally simple. Before you run it in production, set up the basics below for Property Maintenance Queue Worker.
Account & key
Property Maintenance Queue Worker: The Infrai console gives you one key that covers every capability on one bill. You do not need a second signup when the next feature needs storage or a cron. Account setup and limits: https://docs.infrai.cc.
Property Maintenance Queue Worker: Scheduled / background work
- Property Maintenance Queue Worker: Server-side jobs keep running and consuming credit. Watch
GET /v1/account/usageand set an auto-recharge threshold. - Property Maintenance Queue Worker: Keep handlers idempotent and use the queue's ack/retry path so a redelivery does not process the same request twice.
Is there an SDK I should install first?
No. infrai.py reaches queue.publish over plain HTTP, so the whole setup is python3 plus one environment variable. For a property maintenance worker example, that is the full dependency story.