Convenience wrapper for adding json messages to Azure service bus queues or topics.
(async () => {
const azureQueue = require('azure-queue-add-message')({
connectionString: '<myConnectionString>',
queueName: 'myQueueName', // queueName or topicName is required
topicName: 'myTopicName' // queueName or topicName is required
})
const message = {
id: 123,
action: 'add',
content: 'Added to queue'
}
try {
const result = await azureQueue(message)
console.log(result)
} catch (error) {
console.error(error)
}
})()