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

cpp_example_template: Unique client_id for each agent #356

Open
vincentraymond-ua opened this issue Jun 14, 2022 · 3 comments
Open

cpp_example_template: Unique client_id for each agent #356

vincentraymond-ua opened this issue Jun 14, 2022 · 3 comments
Assignees

Comments

@vincentraymond-ua
Copy link
Collaborator

Currently, the example C++ agent template uses a hard-coded value for the mqtt::async_client client_id:

this->mqtt_client = make_shared<mqtt::async_client>(address, "agent");

The MQTT standard requires that client_ids be unique, otherwise it will disconnect the old client for the new one.

Perhaps we could introduce an agent_name variable and base the client_id off of that?

@adarshp
Copy link
Collaborator

adarshp commented Jun 16, 2022

@vincentraymond-ua - Thanks for catching that!

Eventually we should make this (and the heartbeat period) settable using a config file. I don't have the bandwidth to implement this myself in the near future, but will keep this in mind as an issue to be addressed before we deploy an agent based on this template to Study 4.

@adarshp
Copy link
Collaborator

adarshp commented Jun 23, 2022

@ualiangzhang - eventually when you get around to creating a C++ component that plugs into the message bus, please base it off of this template.

As a corollary, please also implement JSON config file parsing for things like client_id, heartbeat interval, etc. using Boost.JSON.

We can also discuss this at our 1-on-1 meetings.

@ualiangzhang
Copy link

@adarshp Thanks for letting me know! We can discuss this at our meeting next week.

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

3 participants