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

Query Regarding FlatMode Configuration in MTConnect CPP Agent #452

Closed
Pranay265 opened this issue May 8, 2024 Discussed in #432 · 9 comments · Fixed by #454
Closed

Query Regarding FlatMode Configuration in MTConnect CPP Agent #452

Pranay265 opened this issue May 8, 2024 Discussed in #432 · 9 comments · Fixed by #454
Assignees
Labels

Comments

@Pranay265
Copy link

Discussed in https://github.com/orgs/mtconnect/discussions/432

Originally posted by Pranay265 April 1, 2024
I am currently working with the MTConnect CPP Agent 2.3.0.3 and have a question regarding the FlatMode configuration option in the agent's agent.cfg file.

I noticed that when I enable or disable FlatMode (e.g., FlatMode = true or FlatMode = false), it doesn't seem to have any effect on the MQTT topic structure generated by the agent. Specifically, I am trying to achieve a flat topic structure like MTConnect/Devices/{deviceuuid}/Observations/{DataItemID}.

Here is an example of my sink configuration in the agent.cfg file:
Sinks {
MqttService {
Server = localhost
Port = 1883
ObservationTopic = MTConnect/Devices/
FlatMode = true
}
}

I expected that enabling FlatMode would flatten the MQTT topic structure, but I haven't observed any change in the topics generated.

Could you please provide some insights into how FlatMode should be correctly configured to achieve a flat topic structure in the MQTT output of the MTConnect CPP Agent? Additionally, are there any specific considerations or dependencies that I should be aware of when using FlatMode?

@wsobel : Any guidance or clarifications on this matter would be greatly appreciated.

@wsobel
Copy link
Member

wsobel commented May 8, 2024

I don't see the configuration anywhere in the docs. It may have been removed because it did not work properly. @rajwork9 may be able to remember.

I would suggest moving to the Mqtt2Service since I am deprecating the MqttService in 2.5. It uses a different methodology to publish.

Please also provide more info on what you are trying to do. This can help me address the issue.

@rajwork9
Copy link
Collaborator

rajwork9 commented May 8, 2024

i don't see this option is available with MTConnect CPP Agent 2.3.0.3, in older versions it's called MqttFormatFlat = X value if you don't define then it takes default value as 7.

Will: this MqttFormatFlat worked fine but may be during change of concept we missed to add or decided to not to have this option.

@Pranay265
Copy link
Author

Pranay265 commented May 8, 2024

Thank you, @wsobel & @rajwork9 , for your swift responses. Allow me to provide further clarification on our query. Essentially, we are exploring the possibility of standardizing the topic and payload structure across various MTConnect agent implementations, particularly unifying them with respect to the .NET versions. Our aim is to establish a consistent format for both topics and payloads, thereby streamlining data handling.

Here is the specific topic and payload structure we aim to achieve, illustrated with the attached screenshot for reference:

Topic Structure:
MTConnect/Devices/{deviceuuid}/Observations/{DataItemID}
For example: MTConnect/Devices/printer1234/Observations/pathExecution

Payload Structure:
{
"dataItemId": "pathExecution",
"name": "PathExecution",
"category": "EVENT",
"type": "EXECUTION",
"sequence": 59,
"timestamp": "2024-01-09T08:55:35.5094291Z",
"instanceId": 1704628706,
"result": "ACTIVE"
}
e.g
image-20240322-114305

Furthermore, I attempted to utilize Mqtt2Service for the latest versions (2.3.0.3 & 2.5.0.0) as requested. However, I encountered an issue where the payload wasn't received at all. Attached is the agent.cfg file for your reference, along with screenshots of the topic and payload structure. Kindly advise if any steps are missing or if additional information is required for clarity.
image

agent.cfg.txt

@wsobel
Copy link
Member

wsobel commented May 8, 2024

Odd there is no sample topic. It is always there when i test. I'll check on the windows build.

@wsobel
Copy link
Member

wsobel commented May 8, 2024

The payload is the entire document.

@Pranay265
Copy link
Author

Thank you, @wsobel , for addressing this concern. We eagerly await your insights on the matter. Is it feasible to synchronize the topic structure to match the flattening approach demonstrated in the first screenshot, in conjunction with Mqtt2Service?
image

@rajwork9 , could you kindly provide details on the specific version where MqttFormatFlat = X is operational? Additionally, sharing the agent.cfg file would greatly assist us in understanding the configuration. Thank you.

@wsobel
Copy link
Member

wsobel commented May 9, 2024

The only reason I could find is the machine is idle or disconnected and a sample has not been produced yet. Is this true?

If so once the machine connects, a sample should be created.

I will log this as a bug since I should immediately produce a sample to create the topic, even if empty. I just want to make sure I'm addressing the right situation.

Thanks
Will

@Pranay265
Copy link
Author

Yes, correct. The machine was in idle state.

@wsobel
Copy link
Member

wsobel commented May 9, 2024

Then I know the issue. I can fix it quite easily.

@wsobel wsobel linked a pull request May 13, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants