Skip to content

v2.0.0

Choose a tag to compare

@kfitzgerald kfitzgerald released this 22 Mar 21:28
· 12 commits to master since this release

Rewrite using Rascal as our underlying driver

Breaking Changes

  • Underlying driver has changed from forked-version of postwait's amqp to rascal/amqplib
  • Queue configuration has changed, see rascal's configuration scheme
  • QueueService
       * constructor no longer takes queues param, this is setup in the rascal config
       * queues property has been removed
       * connect is now an async function (no more callback)
       * many internal member functions have been removed
  • QueueWorker
       * constructor option queueName is now subscriptionName
       * constructor requires option service (instance of QueueService)
       * many internal members have been removed
       * init is now an async function (no more callback)
       * subscribe is now an async function (no more callback)
       * onReady has been removed
       * onSubscribed no longer has arguments
       * onUnsubscribed no longer has arguments
       * onMessage signature has changed to (message, content, ackOrNack)
       * onMessageHandled has been removed
       * handleMessage signature has changed to (message, content, ackOrNack)
       * onServiceError has been removed
  • BatchQueueWorker
       * option batchSize now translates to a prefetch of (batchSize * 2), so Async.Cargo can optimally deliver the desired batch size to the app.
       * handleMessageBatch has changed signature to (messages, defaultAckOrNack)
         * Messages are wrapped, and can be individually acknowledged via messages[i].ackOrNack(...). Likewise, defaultAckOrNAck(...) will handle the remaining messages in the batch.
       * onMessage signature has changed to (message, content, ackOrNack)
       * onMessageHandled has been removed
       * prepareForShutdown override has been removed

Other notable changes:

  • QueueService
       * Vastly simplified logic, 40% reduction in code thanks to Rascal taking on error handling and recovery
       * publish returns a promise, callback is optional.
       * Added QueueService.generateConfigFromQueueNames(queueNames, config) helper to generate Rascal vhost config given array of queue names.
  • QueueWorker
       * Vastly simplified logic, 35% reduction in code thanks to Rascal taking on the complexities
  • BatchQueueWorker
       * Simplified logic, 30% reduction in code thanks to Rascal
       * constructor now takes option skipInit:true to not start subscribing upon construction
  • Updated example app
  • Rewrote tests from scratch
  • Updated docs