Created
March 13, 2015 16:52
-
-
Save irjudson/39b6f958d864753992e8 to your computer and use it in GitHub Desktop.
EH test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var sbus = require('node-sbus-amqp10'); | |
var config = { | |
"servicebus": process.env.AZURE_SERVICE_BUS, | |
"saskey_name": process.env.AZURE_SAS_KEY_NAME, | |
"saskey": process.env.AZURE_SAS_KEY, | |
"eventhub": process.env.AZURE_EVENTHUB_NAME | |
}; | |
var hub = sbus.EventHubClient(config.servicebus, config.eventhub, config.saskey_name, config.saskey); | |
hub.getEventProcessor('$Default', function (conn_err, processor) { | |
if (conn_err) { | |
console.log("Connection Error: " + conn_err); | |
} else { | |
processor.init(function (rx_err, partition, payload) { | |
if (rx_err) { | |
console.log("Recieve Error: " + rx_err); | |
} else { | |
console.log("Recieved message!"); | |
// console.log(partition); | |
// console.log(payload); | |
} | |
}, function (init_err) { | |
if (init_err) { | |
console.log("Initialization Error: " + init_err); | |
} else { | |
processor.receive(); | |
} | |
}); | |
} | |
processor.teardown(function() { console.log("Tearing down EventHub Processor."); } ); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment