seneca-gcloudpubsub-transport
v1.0.2
Published
Seneca GCLOUD pub/sub transport
Downloads
16
Maintainers
Readme
seneca-gcloudpubsub-transport
Seneca GCLOUD Pub/Sub transport.
Seneca is a microservices framework and Google Cloud Pub/Sub brings the scalability, flexibility, and reliability of enterprise message-oriented middleware to the cloud.
This transport sends request to a topic and wait for results in another queue in Google Cloud Pub/Sub
Installation
npm install seneca-gcloudpubsub-transport --save
Usage
You are going to need credentials file to run this from your local machine
// server.js
require('seneca')({log:"debug"})
.use('gcloudpubsub-transport')
.add('role:foo,cmd:two', function (args, done) { done(null, { bar: args.bar }) })
.listen({type:'gcloud',
topicPrefix: 'test',
projectId:'putYourProjectIdHere'
keyFilename: '/path/to/your/keyfilename.json'});
// client.js
let seneca = require('seneca')({ log: "debug" });
seneca.use('gcloudpubsub-transport');
var client = seneca.client({type:'gcloud',
topicPrefix: 'test',
projectId:'putYourProjectIdHere'
keyFilename: '/path/to/your/keyfilename.json'});
client.act('role:foo,cmd:two', { bar: 'hello from gcloud' }, function (err, response) {
if (err) {
console.log(err);
}
else {
console.log(response);
}
});
node server.js
node client.js
License
Licensed under The MIT License (MIT)
For the full copyright and license information, please view the LICENSE.txt file.