Comments (4)
This design is come from Java version, maybe we need more real device or use case to improve the device-mqtt.
Like this real device, it can't integrate with device-mqtt because it publishes and subscribes readings via different topics.
http://ftp.icpdas.com/pub/cd/mq-7200m/document/mq-7200m_user_manual_english_v100.pdf
And it didn't support Get command to handle request and send response.
from device-mqtt-go.
@tonyespy
Connection pool mechanism would be the way to resolve this issue. However, this is just a sample implementation. We need some help to implement this if it's necessary.
from device-mqtt-go.
I've just done a more thorough review of device-mqtt and its current usage of MQTT. I'm going to use this comment to document my findings, however as some of the issues I've discovered should be considered separate bugs, I will open new issues for each, as this issue is really just about how each new command received from EdgeX triggers a new client connection to be opened, and then closed after the command has been sent.
The MQTT device service implements asynchronous readings and also supports command actuation from EdgeX.
The [Driver] configuration stanza defines a set of Incoming* configuration values (including Host, Port, Topic, ClientId, ...) and a set of Response* configuration values (same set as for Incoming). Each device also includes configuration values for its own Command* MQTT broker configuration within the ProtocolProperties
struct.
The service's ProtocolDriver.Initialize() method creates separate client connections for incoming data and response messages. If this method saved the corresponding connections to its ProtocolDriver
struct, the HandleRead/Write*Commands
methods could use an existing connection vs. creating and closing connections for every command received by the service (either directly or via Core Command).
As I mentioned there are other issues with this implementation:
-
Why does it support different brokers for commands vs. [command] responses?
-
Why does it support per-device broker configuration?
-
This service can at any one time have up to 3 MQTT connections at one time. My gut tells me that most of the time, these would all point to the same broker, which means the service is generating 3x the number of pings to the same broker. I question whether there are real world scenarios where a single instance of device-mqtt would need to be configured to point to different brokers for command and data ingestion. That said, it's supported now, so I don't think we can remove it, however I would like to see the code optimized to use a single connection if all three configurations point to the same broker.
-
Finally, it looks like there's no support for secure connections (e.g. TLS) in the current implementation. This means username/password are being transmitted in cleartext when this service attaches to the broker see issue #157 for more details.
from device-mqtt-go.
@tonyespy
Connection pool mechanism would be the way to resolve this issue. However, this is just a sample implementation. We need some help to implement this if it's necessary.
I'm not sure what you mean by sample implementation? I would instead call it a reference implementation, and as such, we should strive to make it robust and usable for production scenarios. IMHOP if it's just sample code, it belongs in edgex-examples (or the example folder in device-sdk-go).
from device-mqtt-go.
Related Issues (20)
- Add "make lint" target and add to "make test" target
- Bump device-sdk-go version and update configuration.toml
- What will be the path to mqtt-scripts HOT 2
- How to receive another data frame. HOT 2
- Upgrade github.com/eclipse/paho.mqtt.golang from 1.3.5 to 1.4.1 HOT 1
- How to recognize the command from which devices. HOT 2
- Testping command returns EOF HOT 3
- ERROR: libcurl-7.80.0-r1: package mentioned in index not found. HOT 2
- fail to unmarshal event, AddEventRequest.Event.Readings[0].ValueType field validation failed on the edgex-dto-value-type tag HOT 6
- why started http2write command with mutil threads , but for many devices ,all of concur size of http is only 4? HOT 7
- How to run built image via docker run, and via docker-compose file HOT 6
- 编译2.3.0发行版本时,报错,无法完成编译 HOT 2
- Make multi-level topics the only implementation HOT 3
- Change configuration and device toml files to yaml
- device-mqtt leaks message bus credentials HOT 3
- {WIP BUG] New Async multi-reading support breaks handling of basic single reading
- No support for certificate based secure communication HOT 2
- bad device value need detail and response error message HOT 5
- Edgex mqtt error HOT 11
- jpeg images send to edgex HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from device-mqtt-go.