{"id":44451,"library":"bunnybus","title":"BunnyBus","description":"BunnyBus is a high-level enterprise bus library for RabbitMQ that simplifies pub/sub and queue management by abstracting connection, channel, binding, and subscription creation. The current stable version is 7.0.0, released with Node.js >=14 support and maintained by XO Group. It offers both callback and Promise APIs, with optional strict FIFO ordering (at a performance cost). Unlike lower-level RabbitMQ libraries, BunnyBus provides safe defaults, native callbacks for performance, and a built-in error queue / retry management system. It is designed for production messaging patterns requiring reliable delivery and easy configuration.","status":"active","version":"7.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/xogroup/bunnybus","tags":["javascript","bunnybus","rabbitmq","broker","bus","queue","pubsub","publish","subscribe"],"install":[{"cmd":"npm install bunnybus","lang":"bash","label":"npm"},{"cmd":"yarn add bunnybus","lang":"bash","label":"yarn"},{"cmd":"pnpm add bunnybus","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"RabbitMQ driver for AMQP protocol","package":"amqplib","optional":false}],"imports":[{"note":"Package uses CommonJS; no default ESM export.","wrong":"import BunnyBus from 'bunnybus';","symbol":"BunnyBus","correct":"const BunnyBus = require('bunnybus');"},{"note":"Module exports the class directly, not as a named export.","wrong":"const BunnyBus = require('bunnybus').BunnyBus;","symbol":"BunnyBus constructor (with config)","correct":"const BunnyBus = require('bunnybus'); const bus = new BunnyBus({ server: { host: 'localhost' } });"},{"note":"Constants are accessed via lib path; not exposed at the top level.","wrong":null,"symbol":"Constants","correct":"const { Events, DeliveryTypes } = require('bunnybus/lib/constants');"},{"note":"Limited TypeScript support; types may be missing. Use @types/bunnybus if available.","wrong":null,"symbol":"TypeScript types","correct":"import { BunnyBus } from 'bunnybus';"}],"quickstart":{"code":"const BunnyBus = require('bunnybus');\nconst bus = new BunnyBus();\n\nasync function main() {\n  await bus.subscribe('myQueue', {\n    'myEvent': async (message, ack) => {\n      console.log('Received:', message.data);\n      await ack();\n    }\n  });\n\n  await bus.publish({ event: 'myEvent', data: 'Hello World!' });\n  console.log('Message published');\n\n  // Cleanup after a moment\n  setTimeout(async () => {\n    await bus.close();\n    process.exit(0);\n  }, 1000);\n}\n\nmain().catch(err => {\n  console.error(err);\n  process.exit(1);\n});","lang":"javascript","description":"Demonstrates subscribing to a queue and publishing a message with async/await."},"warnings":[{"fix":"Upgrade to Node.js >=14 and migrate to async/await or use .then()/.catch().","message":"v6 to v7: Removed support for Node.js <14 and dropped callback-only API in favor of promises.","severity":"breaking","affected_versions":">=6.0.0 <7.0.0"},{"fix":"Always include an 'event' string in the message object when publishing.","message":"Published messages must contain an 'event' property; otherwise, subscription handlers won't fire.","severity":"gotcha","affected_versions":"*"},{"fix":"Always call ack() after successful processing, or use nack() for failures.","message":"Calling ack() is required; failing to do so may cause message redelivery and memory leaks.","severity":"gotcha","affected_versions":"*"},{"fix":"Set server.dispatchType to 'serial' in config only if strict ordering is required.","message":"Strict FIFO (serial dispatch) significantly reduces throughput; enable only when order is critical.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"search_vec":"'14':36 '7.0.0':32 'abstract':20 'api':49 'bind':23 'broker':99 'built':76 'built-in':75 'bunnybus':1,2,65,97 'bus':9,100 'callback':46,70 'channel':22 'configur':95 'connect':21 'cost':58 'creation':26 'current':28 'default':68 'deliveri':92 'design':85 'easi':94 'enterpris':8 'error':78 'fifo':53 'group':42 'high':6 'high-level':5 'javascript':96 'level':7,62 'librari':10,64 'lower':61 'lower-level':60 'maintain':39 'manag':18,81 'messag':88 'nativ':69 'node.js':35 'offer':44 'option':51 'order':54 'pattern':89 'perform':57,72 'product':87 'promis':48 'provid':66 'pub/sub':15 'publish':103 'pubsub':102 'queue':17,79,101 'rabbitmq':12,63,98 'releas':33 'reliabl':91 'requir':90 'retri':80 'safe':67 'simplifi':14 'stabl':29 'strict':52 'subscrib':104 'subscript':25 'support':37 'system':82 'unlik':59 'version':30 'xo':41","created_at":"2026-06-07T12:50:12.152734+00:00","updated_at":"2026-06-07T12:50:12.152734+00:00","problems":[{"fix":"Start RabbitMQ locally or configure the server host/port in the BunnyBus constructor.","cause":"RabbitMQ server is not running or unreachable.","error":"Error: connect ECONNREFUSED 127.0.0.1:5672"},{"fix":"Use correct import: const BunnyBus = require('bunnybus'); const bus = new BunnyBus();","cause":"Using require incorrectly (e.g., destructured wrong).","error":"TypeError: bus.subscribe is not a function"},{"fix":"Ensure queue configuration matches existing queue or delete the queue before redefining.","cause":"Attempting to redeclare a queue with different properties (e.g., durable vs non-durable).","error":"Error: Channel closed by server: 406 PRECONDITION_FAILED - inequivalent arg 'durable' for queue 'myQueue'"},{"fix":"Ensure subscription handlers accept (message, ack) parameters and use async/await with the ack.","cause":"Handler function does not receive an ack callback when using older API or misconfigured subscription.","error":"UnhandledPromiseRejectionWarning: Error: Cannot read property 'ack' of undefined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/xogroup/bunnybus#readme","github":"https://github.com/xogroup/bunnybus","docs":null,"changelog":null,"pypi":null,"npm":"bunnybus","openapi_spec":null,"status_page":null,"smithery":null,"categories":["messaging"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}