azure-eventhub-publisher
v1.0.4
Published
lightweight lib to publish events into an azure eventhub instance
Downloads
2
Readme
AzureEventhubPublisher
azure-eventhub-publisher
lightweight npm module to publish events into an azure eventhub instance.
CLI
Installation
$ npm install azure-eventhub-publisher -g
Usage
To publish and event to an eventhub instance, run the following command :
Send a single event
azure-eventhub-publisher --config=<CONFIG_FILE_PATH> --event=<EVENT_FILE_PATH>
Send a batch of events
azure-eventhub-publisher --config=<CONFIG_FILE_PATH> --events=<EVENTS_FILE_PATH>
Arguments
configuration
CLI configuration argument expects a path to a json file mirroring a configuration parameter as defined in below LIB section
event
CLI event argument expects a path to a json file mirroring an event parameter as defined in below LIB section
LIB
Installation
$ npm install azure-eventhub-publisher
Usage
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)
Parameters
configuration
An object defining the 2 following properties
eventhubConnectionString
The full eventhub connexion string which can be found in "Shared Access Policies" section of an Event Hubs namespace in Azure Portal interface.
eventhubName
The name of the eventhub entity which can be found into the "Event Hubs" section of an Event Hubs namespace in Azure Portal interface.
event
An arbitrary object that will be sent to the eventhub instance defined into the configuration
License
MIT