0.14.0 • Published 7 years ago
loopback-connector-amqp v0.14.0
loopback-connector-amqp
Loopback connector that forwards every API call to an AMQP server and receives the responses to answer the original API call.
Features
This connector forwards the call on static, instance method and change-stream request. Everything is done using native AMQP functions such as reply_to and correlation_id. See bellow the topics used to transmit the requests and listen to model's change.
Install
Just run npm
npm install --save loopback-connector-amqpSettings
Connectors settings through datasources.json:
"sourcename": {
"name": "sourcename",
"connector": "amqp",
"host": "127.0.0.1",
"port": "5672",
"login": "user",
"password": "password",
"exchange": "loopback",
"binding" : "loopback"
}nameis the sourcename of the datasource, use this name in themodel-config.jsonfile.connectorshould be"amqp"as the node module is calledloopback-connector-amqphost(default:127.0.0.1) andport(default:5672) of your AMQP serverloginandpasswordto connect to your AMQP server (default is empty)exchangename of the AMQP exchange to use (default:loopback). If the exchange doesn't exist, it will be created.bindingname of the binding prefix to use to create the topics.
Topics
The request are sent on the AMQP exchange using the following topic format:
<binding>.request.<model>.<id|static>.<method>where
<binding>is the name of the binding used in the settingsrequestis hard coded for homogeneity with projectloopback-amqp-backend<model>is the name of the model concerned by the request<id>or"static"to specify a specific instance of the model or a static method.<method>name of the method called (also works with remote methods)
Request Handler
A specific request handler has been build to process the request and respond to them using loopback: https://github.com/Weaverize/loopback-amqp-backend
Credit
Copyright (c) 2018, Weaverize SAS. All rights reserved. Contact: dev@weaverize.com.