MQTT for Adapter/Agent communication #30
Replies: 3 comments 2 replies
-
Yes, the Adapter > Agent communication is implementation specific and not technically part of the MTConnect standard. The SHDR over TCP communication was just something that MTConnect developed as a simple protocol to feed data into the Agent from an external application. One of the original purposes for developing the Agent portion of MTConnect.NET was to eliminate the SHDR/TCP connection as any Adapter that is written in .NET should be able to use MTConnect.NET to implement an Agent in the "Adapter" application itself. So instead of an Adapter application reading from a PLC and sending that data over TCP to the Agent, using MTConnect.NET the Adapter application can read from the PLC and then run an MTConnect Agent inside the same application. I'm currently working on a new Docs site that has documentation, tutorials, etc. that will hopefully clarify all of the functionality of MTConnect.NET and how to create Agents, Adapters, and Clients using it. This will document what is part of the MTConnect standard as well as the non-standard functionality that I've added. I agree that using MQTT for the Agent > Client communication would be much more valuable than the Adapter > Agent communication. I started working on an MQTT Agent implementation HERE but I don't have it finished. If you or anyone else is interested in helping (testing, feedback, etc.) there is a simple demo running at the below MQTT connection: Host: trakhound.com I was still working on the topic format and the source code for it is not organized yet but it could be ready to package and test without too much effort if I have anyone that is interested. I would definitely appreciate any feedback on any of that. In the MQTT Agent I started setting up, the application would read from the PLC and then also host an MQTT broker within the same application. I can also make one that reads from SHDR over TCP and/or one that just sends the MQTT messages to an external broker. |
Beta Was this translation helpful? Give feedback.
-
I just published the 0.6.0 release that includes some of the updates mentioned in this thread. It includes a lot of changes among which are the updates to ShdrAdapter which I mentioned. Let me know if anyone finds any issues with it or have any questions on how to implement the new classes. |
Beta Was this translation helpful? Give feedback.
-
@scottmwyant I just published the new 1.3.0 release that contains MQTT Agents. There are two MQTT Agents, one that publishes to an external MQTT broker and one that has an MQTT broker built in. The topic structure is listed in the ReadMe and is structured so that you can subscribe similar to below: All Devices:
A specific Device:
A specific Device's Observations:
A specific Device's Path Observations:
Let me know if you get a chance to test any of this and let me know if you find any issues or have any other feedback. Thanks, |
Beta Was this translation helpful? Give feedback.
-
Writing in response to your proposal to send data from the adapter to the agent over MQTT (4th bullet point in #29).
IMO, it seems the communication between the agent and the adapters is an implementation detail. All of the big projects I've seen dealing with MT Connect (MTConnect Institute, TrakHound, Mazak) provide implementations of both components, Adapter and Agent.
As an aside, it would be good if the 3rd party developers would be clear about how their Agent differs (if it does) from the reference implementation.
As a general consumer of this technology, I don't care what protocol is used between the components as long as they talk. In this mindset, it may only become relevant if I want to mix and match components from different developers.
What appears would make a larger impact to consumers would be an MQTT agent. I believe this is addressed in v2.0 of the spec; I need to go study the spec again.
In any case, the big differences in my mind are who initializes the connection, and how many hops are needed.
Using TCP, the adapter is listening for connections, the Agent knows about the adapter and makes a connection. With MQTT the adapter and the agent would both have to know about a broker. Great abstraction between the adapter and the agent but I'm with you, I don't see an obvious use case. Seems like it would be more useful to have an option for MQTT between the Agent and the client application.
Best case scenario in my mind would be an agent and adapter running locally on the HMI so that the agent can push JSON data to a cloud service, etc.
Beta Was this translation helpful? Give feedback.
All reactions