hemerajs/hemera

Using wildcard on pattern matching

pola88 opened this issue · 2 comments

Hi, I am start using hemerajs and I want to use a wildcard on the patter, but when I call it I get the following error:

 No handler found for this pattern

I define the action with this pattern:

hemera.add({ topic: 'match', a: '*' }, (args, done) => ... );

And to call it:

hemera.act({ topic: 'match', a: 1 }, (error, res) => ...);

Does Hemera support this kind of patterns?

  • NATS: latest
  • Hemera: 3.1.6
  • NodeJs: 6.11.2

Thanks,
PoLa.

Hi @pola88 you have to use a regex object.

hemera.add({ topic: 'match', a: /.+/ }, (args, done) => ... );
hemera.add({ topic: 'match', a: new RegExp('/.+/') }, (args, done) => ... );

Thanks! It works!! 👍