Skip to content

Instantly share code, notes, and snippets.

@nazt
Forked from anonymous/gist:3495664
Created August 28, 2012 06:54
Show Gist options
  • Select an option

  • Save nazt/3495665 to your computer and use it in GitHub Desktop.

Select an option

Save nazt/3495665 to your computer and use it in GitHub Desktop.
var ignite = require('ignite')
, _ = require('underscore')
, request = require('request')
, cashcardController = require('./cashcardController.js')
, txService
, dbService
, cashcardFactory
, controller;
// MOCK SERVICE
txService = {
setPropertyMap: function (opts, cb) {
if (opts.pass) {
console.log(":: CALL txService.setPropertyMap ::")
cb();
}
else {
cb(function(err) { })
}
}
}
dbService = {
insertTx: function (opts, cb) {
if (opts.pass) {
console.log(":: CALL dbService.insertTx ::")
cb();
}
else {
cb(function(err) { })
}
},
InsTxException: function (msg) {
console.log("INSERT EXCEPTION: ", msg)
}
}
// cashcardFactory
cashcardFactory = new ignite.Factory(cashcardController, {
request: request,
dbService: dbService,
// dbService: require('./libs/dbService.js'),
txService: require('./libs/txService.js')
})
function process(options, exchange, queue, message) {
var controller = cashcardFactory.spawn(options, message, exchange, queue);
}
var options = {}
, exchange = {}
, queue = {}
, message = { sequence: '0000000001' };
process(options, exchange, queue, message)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment