UsamaImran/rabbitMQ-common — reverse-engineered prompt
Reverse engineered prompt
Build me a small TypeScript library for Node apps that makes RabbitMQ easy to use in microservices. I want simple Producer and Consumer classes so a developer can publish JSON messages to a queue and create a consumer by writing an onMessage handler. Please handle the annoying production stuff inside the library, like managing connections and channels, reconnecting with exponential backoff, keeping separate connections for different broker URLs, cleaning up listeners during recovery, and not looping forever on bad JSON messages.
Add Dead Letter Queue support, queue options for publishing and consuming, close and isConnected methods, and clear typed errors for connection, publish, and consume failures. Let users pass in their own logger instead of forcing console logs. Keep it type safe and easy to import from a Node TypeScript project. Include clear README examples for publishing, consuming, error handling, custom logging, and migration notes from an older version. Look up current amqplib docs if needed.
Want more depth? Deep Reverse