Closed L-David closed 6 years ago
Apparently the issue maybe on the topic if we use a topic across Hemera stack of services on different hosts machine sometime it cannot resolve the the action assign to that pattern. Is there any limitation on the topic use? Or should we used different pattern matching.
Hi @L-David, if you scale a service on multiple hosts you have to ensure that each service has the same set of patterns available otherwise you will run into a PatternNotFound
issue because NATS will load balance all requests and it can't differentiate.
Is this the issue?
Closing due to inactivity
We have a Host where NATS server & a Hemera instance are exposed. This Hemera instance works great. But if we add other Hemera instances that are in other Host machines. Everything becomes really unstable. Sometimes the pattern is matched and return with whats expected but many other times it responds with a PatternNotFound: No action found for this pattern. We have added Timeout we also have added natsbroad & tracer logs to look if it was getting added and the service is getting added
But still, sometimes it finds an action sometimes it doesn't:
`const nats = require('nats').connect({ url: process.env.NATS_URL, user: process.env.NATS_USER, pass: process.env.NATS_PW });
const hemera = new Hemera(nats, { logLevel: 'info', childLogger: true, tag: 'test', timeout: 10000 });
hemera.use(HemeraJoi);
const start = async () => { try { await hemera.ready(); let Joi = hemera.joi; hemera.add( { topic: 'math', cmd: 'sub', a: Joi.number().required(), b: Joi.number().required() }, async function (req) { try { return = req.a - req.b; } catch (error) { console.error(error); return error; } } ); hemera.log.info('Service listening'); } catch (err) { hemera.log.error(err); process.exit(1); } };
start();`