How to use the seneca.client function in seneca

To help you get started, we’ve selected a few seneca examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github BarnesFoundation / barnes-tms-extract / src / scripts / nightlyColorProcess.js View on Github external
const exec = require('child_process').exec;
const path = require('path');
const logger = require('../util/logger.js')(path.join(__dirname, "logs/cron_logs.txt"));

logger.info("Beginning color process nightly cron");

// Run the CSV processing script
logger.info("Processing Cooper-Hewitt color data");
const seneca = require('seneca')() // eslint-disable-line
	.client({ type: 'tcp', pin: 'role:color', port: 10205 })
	.act('role:color,cmd:process', () => {
		logger.info("Exiting");
		process.exit(0);
	});
github BarnesFoundation / barnes-tms-extract / src / scripts / tileImages.js View on Github external
const seneca = require('seneca')({ // eslint-disable-line
	transport: {
		tcp: {
			timeout: 60000,
		},
	},
})
  .client({ type: 'tcp', pin: 'role:images', port: 10204, timeout: 60000 })
  .act('role:images,cmd:tile', () => {
	process.exit(0);
});
github BarnesFoundation / barnes-tms-extract / src / scripts / nightlyRun.js View on Github external
const path = require('path');
const logger = require('../util/logger.js')(path.join(__dirname, "logs/cron_logs.txt"));

const argv = require('minimist')(process.argv.slice(2));

const source = argv.d || path.resolve(__dirname, '../dashboard/public/output');

logger.info("Beginning nightly cron");

// Cleanup old CSVs
logger.info("Cleaning up old CSVs");
exec(['node', path.resolve(__dirname, './oldCSVClean.js'), '-d', source].join(' '));

// Run the CSV processing script
logger.info("Pulling latest from TMS");
const seneca = require('seneca')() // eslint-disable-line
	.client({ type: 'tcp', pin: 'role:tmstocsv' })
	.act('role:tmstocsv,cmd:runNightly', () => {
		logger.info("Exiting");
		process.exit(0);
	});
github senecajs-labs / seneca-queue / examples / out-process-client.js View on Github external
var s = require('seneca')()
          .client({ type: 'http', port: 8083 })
          .client({ type: 'tcp', port: 8081, pin: 'cmd:enqueue-remote,queue:q1' })
          .client({ type: 'tcp', port: 8082, pin: 'cmd:enqueue-remote,queue:q2' })
          .use('..', {
            queues: ['q1', 'q2']
          })

s.act({ role: 'queue', cmd: 'enqueue', msg: { task: 'my task', param: 1 }})
s.act({ role: 'queue', cmd: 'enqueue', msg: { task: 'my task', param: 2 }})
s.act({ role: 'queue', cmd: 'enqueue', msg: { task: 'my task', param: 3 }})
s.act({ other: 'call' }, function(err, result) {
  if (err) {
    console.log(err)
    process.exit(1)
  }

seneca

A Microservices Framework for Node.js

MIT
Latest version published 5 months ago

Package Health Score

70 / 100
Full package analysis