Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MQTT Transport issue service discovery #54

Closed
brad-decker opened this issue Jul 17, 2017 · 1 comment
Closed

MQTT Transport issue service discovery #54

brad-decker opened this issue Jul 17, 2017 · 1 comment

Comments

@brad-decker
Copy link

Having an issue with service discovery on MQTT, probably just a user error but i'd appreciate some guidance.

const Moleculer = require('moleculer');

const { ServiceBroker, Transporters: { MQTT: MqttTransport } } = Moleculer;

const transporter = new MqttTransport('mqtt://localhost:1883');

const broker = new ServiceBroker({
  logger: console,
  transporter,
});

broker.createService({
  name: 'engagedAction',
  actions: {
    create() {
      return 'hello world';
    },
  },
});

broker.start().then(() => broker.call('engagedAction.create')).then(r => console.log(r));

I run this then I switch to terminal where I create an identical ServiceBroker and call $node.services and the service from the other node is never there. I have confirmed that both nodes are connected to my MQTT service and i can see messages posting in the backend. Any thoughts on the step i'm missing?

@brad-decker
Copy link
Author

Answered my own question. The node name was the same on both clients so it screwed up the service discovery most likely thinking it should only have to look internally or something. I changed the nodeID on one service and it worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant