lightweight npm module to publish events into an azure eventhub instance.
$ npm install azure-eventhub-publisher -g
To publish and event to an eventhub instance, run the following command :
azure-eventhub-publisher --config=<CONFIG_FILE_PATH> --event=<EVENT_FILE_PATH>
azure-eventhub-publisher --config=<CONFIG_FILE_PATH> --events=<EVENTS_FILE_PATH>
CLI configuration argument expects a path to a json file mirroring a configuration parameter as defined in below LIB section
CLI event argument expects a path to a json file mirroring an event parameter as defined in below LIB section
$ npm install azure-eventhub-publisher
const { publishEvent, publishEvents } = require("azure-eventhub-publisher")
const configuration = {
eventhubConnectionString: <EVENTHUB_CONNECTION_STRING>,
eventhubName: <EVENTHUB_NAME>
}
// publish a single event
const event = {
'test':'test'
}
publishEvent(configuration, event)
// publish a batch of events
const events = [{
'test':'test'
}, {
'test':'test'
}]
publishEvents(configuration, events)
An object defining the 2 following properties
The full eventhub connexion string which can be found in "Shared Access Policies" section of an Event Hubs namespace in Azure Portal interface.
The name of the eventhub entity which can be found into the "Event Hubs" section of an Event Hubs namespace in Azure Portal interface.
An arbitrary object that will be sent to the eventhub instance defined into the configuration
MIT