senecajs / seneca-transport

Seneca micro-services message transport over TCP and HTTP.
MIT License
63 stars 45 forks source link

Support more than 2 arguments for .add / .act callbacks #151

Closed bra1n closed 7 years ago

bra1n commented 7 years ago

It seems like seneca-transport doesn't support more than 2 arguments for .add / .act callbacks, which was noticed with the seneca-amqp-transport implementation of seneca-transport: https://github.com/senecajs/seneca-amqp-transport/issues/78

Example:

// listener
require('seneca')().use('seneca-amqp-transport')
.add({a:1, b:2}, function (msg, reply) {
    reply(null, {z: msg.z}, 123) // <--- 3 arguments here
}).listen({type: 'amqp', pin: 'a:1,b:2', url: 'amqp://guest:guest@localhost:5672/'});

// client
require('seneca')().use('seneca-amqp-transport')
.client({type: 'amqp', pin: 'a:1,b:2', url: 'amqp://guest:guest@localhost:5672/'})
.act('a:1,b:2,z:9', console.log); // should log all arguments

Expected output:

null { z: 9 } 123

Actual output:

null { z: 9 } { id: 'wmkrp7ebp8yd/tjrznrcu10hm',
  accept: 'tkxxb46prhmh/1487592318189/4167/3.3.0/-',
  track: [ '2j0b5xk44e4z/1487592318564/4167/3.3.0/-' ],
  time:
   { client_sent: 1487592318854,
     listen_recv: 1487592318885,
     listen_sent: 1487592318893,
     client_recv: 1487592318896 } }

Seneca supports more than 2 arguments in act callbacks since #340.

bra1n commented 7 years ago

Duplicate of #152

nfantone commented 7 years ago

Opened another issue for the same problem on #152.

Thanks @bra1n for closing this one. Apologies, @rjrodger.