Пример #1
0
	channelPool.channel(function(error, channel) {
		if (error) {
			log.error({
				'component': 'stomp',
				'event': 'error',
				'error': error.message
			})
			return
		}
		log.info({
			'component': 'stomp',
			'event': 'connected'
		})
		pfint.on('memorySlot', function(slot) {
			log.info({
				'message': 'slot',
				'slot': slot
			})
			channel.send({
				'destination': config.stomp.queues['memoryslot'],
				'content-type': 'application/json'
			}, JSON.stringify(slot), function(error) {
				if (error) {
					log.error({
						'component': 'stomp',
						'event': 'error',
						'error': error.message
					})
				} else {
					log.debug({
						'component': 'stomp',
						'event': 'message_sent'
					})
				}
			})
		});
		pfint.on('route', function(route) {
			log.info({
				'message': 'route',
				'route': route
			})
			channel.send({
				'destination': config.stomp.queues['route'],
				'content-type': 'application/json'
			}, JSON.stringify(route), function(error) {
				log.error({
					'component': 'stomp',
					'event': 'error',
					'error': error.message
				})
			})
		});
		pfint.on('customCommand', function(customCommand) {
			log.info({
				'message': 'custom',
				'customCommand': customCommand
			})
			channel.send({
				'destination': config.stomp.queues['custom'],
				'content-type': 'application/json'
			}, JSON.stringify(customCommand), function(error) {
				log.error({
					'component': 'stomp',
					'event': 'error',
					'error': error.message
				})
			})
		});
	})
Пример #2
0
				})
			})
		});
	})
}


if (stompit && config.stomp) {
	stompConnect()
}

pfint.on('error', function() {
	log.error({
		'component': 'pfint',
		'event': 'error',
		'error': 'An error connecting to Pathfinder occurred'
	})
	//process.exit(5);

});

pfint.sync({
	'user': config.pathfinder.user,
	'password': config.pathfinder.password,
	'host': config.pathfinder.host,
	'port': config.pathfinder.port
})

pfint.on('connected', function() {
	log.info({
		'component': 'pfint',