TaskCluster AMQP Event Proxy
This allows browser client to bind to AMQP exchanges listed in
taskcluster-client
and listen for events over a SockJS backed websocket.
<!-- Include taskcluster-client -->
<script src="/.../taskcluster-client.js"></script>
<script>
// Create QueueEvents client from taskcluster-client
var queueEvents = new taskcluster.QueueEvents();
// Create listener
var listener = new taskcluster.WebListener();
// Declare bindings (you can do this at anytime)
listener.bind(queueEvents.taskCompleted({
taskId: "<myTaskId>"
})).then(function() {
// Connect and start listening
return listener.connect();
});
// Listen for messages
listener.on('message', function(message) {
// Got message in same format as returned by AMQPListener
console.log(JSON.stringify(message));
});
// Listen for errors
listener.on('error', function(error) {
// Got an error message
});
// Listen for listener closure
listener.on('close', function() {
// Listener is now closed for some reason
});
// Close listener
listener.close();
</script>
Testing
- Add pulse credentials to test profile in user-config.yml (Check user-config-example.yml)
- Add pulse credentials to test profile in config.yml
- Add taskcluster credentials to test profile in config.yml. Ensure you have the necessary scopes.
- If required add influxDb connection string to default in config.yml
yarn install
and thenyarn test
Deployment
- Supply config as environment variables (see
server.js
). - Use
tools.taskcluster.net/pulse-inspector
to verify that it works
Service Owner
Service Owner: jonasfj@mozilla.com
- Previous
- Up
- Next