0

I have a simple setup of Senecajs and RabbitMQ.

Listener

// foo.js (listener)
var seneca = require('seneca')();

seneca
  .use('seneca-amqp-transport')
  .add({
    "role": "foo",
    "cmd": "ping"
  }, (args, done) => {
     done(null, { result: "Hi FOO" });
  })
  .listen({
    type: 'amqp',
    pin: 'cmd:ping',
    url: 'amqp://guest:guest@localhost:5672'
  });// default - 10101 

Client

// app.js (client)

var seneca = require('seneca');

var foo = seneca()
  .use('seneca-amqp-transport')
  .client({
    type: 'amqp',
    pin: 'role:foo,cmd:ping',
    url: "amqp://guest:guest@localhost:5672"
  })
  .act('role:foo,cmd:ping', { message: 'Aha!' }, (err, response) => {
    if (err) console.error(err);
    else console.log(response);
  });

package.json

 ...
 "dependencies": {
    "seneca": "^3.17.0",
    "seneca-amqp-transport": "^2.2.0"
 }
...

When I run those two files (node foo.js then node app.js) the app.js throws the following error:


 code: 'act_execute',
  seneca: true,
  package: 'seneca',
  msg:
   'seneca: Action cmd:ping,role:foo failed: Cannot read 
property \'pattern\' of undefined.',
  details:
   { message: 'Cannot read property \'pattern\' of undefined',
     pattern: 'cmd:ping,role:foo',
     fn:
      { [Function: transport_client]
        id:
         'pg:cmd:ping,role:foo,pin:role:foo,cmd:ping,type:amqp,url:amqp://guest:guest@0.0.0.0:5672' },
     callback: [Function],
     instance: 'Seneca/hhdy5dxvtas8/1574507599580/4684/3.17.0/-',
     callpoint: undefined,
     'orig$':
      TypeError: Cannot read property 'pattern' of undefined

However, I can clearly see (in RabbitMQ dashboard) that those connections are established...

This is the first time I am playing with Senecajs and RabbitMQ... What I am doing wrong?

stedejan
  • 145
  • 1
  • 2
  • 9

1 Answers1

1

It seems that adding var "{legacy: {meta:true}}" to Seneca initializator solved the problem...

var seneca = require('seneca')({legacy: {meta:true}});
stedejan
  • 145
  • 1
  • 2
  • 9