2.4.7 • Published 3 years ago
loopback-google-pubsub v2.4.7
loopback-google-pubsub
Pubsub system for Loopback using Google Pubsub
Usage client side
In a boot script
// Instanciate with the app and tell it what model name to listen to
var pubsubClient = require('loopback-google-pubsub')(app,
{
type: 'client',
serviceName: CLIENT_NAME,
projectId: GOOGLE_CLOUD_PROJECT_ID,
modelsToSubscribe: ['Order'],
eventFn: function(modelName, methodName, modelId, data, cb) {...}
});
Then in the models you want to use pubsub
// Require the pubsub with options.serviceName
var pubsubClient = require('loopback-google-pubsub')(app, {serviceName: CLIENT_NAME});
Usage server side
In a boot script
// Instanciate with the app
var pubsubServer = require('loopback-google-pubsub')(app,
{
type: 'server',
serviceName: SERVER_NAME,
projectId: GOOGLE_CLOUD_PROJECT_ID,
modelsToBroadcast: ['Order'],
//Optional list of functions taking (modelName, methodName, instance, ctx) as arguments. If any return false, message will not be published
filters: [filterFunction1, filterFunction2]
});
Notes
process.env.NODE_ENV
is required, as it is used to differentiate topic and subscription names by environment on Google PubSub.
2.4.7
3 years ago
2.4.6
3 years ago
2.4.1
3 years ago
2.4.0
3 years ago
2.4.3
3 years ago
2.4.2
3 years ago
2.4.5
3 years ago
2.4.4
3 years ago
2.3.0
5 years ago
2.2.0
5 years ago
2.1.1
5 years ago
2.0.6
5 years ago
2.0.5
6 years ago
2.0.4
6 years ago
2.0.3
6 years ago
2.0.2
6 years ago
2.0.0
6 years ago
1.1.1
6 years ago
1.1.0
6 years ago
1.0.16
6 years ago
1.0.15
6 years ago
1.0.14
6 years ago
1.0.13
6 years ago
1.0.11
6 years ago
1.0.10
7 years ago
1.0.9
7 years ago
1.0.8
7 years ago
1.0.7
7 years ago
1.0.6
7 years ago
1.0.5
7 years ago
1.0.4
7 years ago
1.0.3
7 years ago
1.0.2
7 years ago
1.0.1
7 years ago
1.0.0
7 years ago