@contrast/screener-service
v1.12.14
Published
Service to talk to local docker daemon and cloud
Downloads
131
Maintainers
Keywords
Readme
@contrast/screener-service
This module houses client code for talking to either the local or cloud provisioning services as well as RMQ interfacing.
:pushpin: Important Note: If you are looking for documentation on how to use the Screener with the Node Agent, look into the Wiki!
Install
npm i @contrast/screener-service
API
Creating a session
const provisioningClient = require('@contrast/screener-service').client;
const response = await provisioningClient.createSession(
process.env.SCREENER_AGENT_URL
);
const { id: sessionId } = response;
const { hostname, port, username, password } = response.mq;
Starting an app
const { id: appId, url: appUrl } = await provisioningClient.startApp({
sessionId,
'express',
port: 3000,
'12',
'assess',
agentUrl: process.env.SCREENER_AGENT_URL
});
Polling an app
await provisioningClient.pollApp({ appUrl });
Stopping an app
await provisioningClient.stopApp(appId);
Interacting with Rabbit MQ
const RmqClient = require('@contrast/screener-service').rmqClient;
// connect
const mq = new RmqClient(`amap://${username}:${password}@${hostname}:${port}`, exchangeName);
await mq.connect();
// create a queue
await mq.createQueue(queueName);
// poll for message
const msg = await mq.getMessage(queueName, msgType, timeout);