persistent: true,
};
+ /**
+ * @typedef {object} PublishOptions
+ * @property {number} timestamp timestamp in ms, defaults to current
+ * @property {boolean} persistent defaults to true
+ */
/**
* Send a message to an exchange.
- * @param {String} name
- * @param {*} content
- * @param {Object} options
+ * @param {string} name name
+ * @param {*} content message content
+ * @param {PublishOptions} options options
+ * @returns {Promise<void>}
*/
async publish(name, content, options) {
const _scope = _fileScope('publish');
content = Buffer.from(typeof(content) === 'object' ? JSON.stringify(content) : content);
}
- const timestamp = (new Date()).getTime();
+ const timestamp = Date.now();
options = {
timestamp,
...Publisher.publishDefaults,
/**
* Producer only needs to plumb the exchange it sends to.
- *
- * @param {String} name
+ * @param {string} name name
*/
async establishAMQPPlumbing(name) {
const _scope = _fileScope('establishAMQPPlumbing');