当前位置:网站首页>RMS to EAP is simply implemented through mqtt
RMS to EAP is simply implemented through mqtt
2022-07-05 10:07:00 【panda_ two hundred and twenty-five thousand and four hundred】
Tips : When the article is finished , Directories can be generated automatically , How to generate it, please refer to the help document on the right
List of articles
Preface
EAP yes MES Bridge with equipment ,EAP adopt SECS International standard protocol for data transmission with the machine . Our company RMS through SECS International standard protocol for data transmission with the machine , Just more should be in MES Business logic on the Internet , Put it in RMS On , It's not used so much in architecture EAP The division of labor is clear ,RMS Taking away the business logic and transforming it can also become EAP, I'll simply try
Tips : The following is the main body of this article , The following cases can be used for reference
One 、MQTT
1、 Using message queuing
MES And other systems send information to RMS,RMS The received message is passing SECS\GEM Communicate with semiconductor devices
advantage :
1、 Decouple the system , Improve response time , System functions converge inward , Opening to the outside world ;
2、 Split the asynchronous function of the system , Reduce functional coupling , Provide development efficiency ;
There are advantages and disadvantages , Specific information can be found online , That's not true
MQTT Protocol is a message queuing transmission protocol , Adopt subscription 、 Publishing mechanism , Subscribers receive only the data they have subscribed to , Non subscription data will not be received , It ensures the necessary data exchange , It also avoids the storage and processing caused by invalid data . Therefore, it has been widely used in the industrial Internet of things .
I'm using rabbitmq, because rabbitmq Support MQTT agreement , also MQTT The protocol also supports for Web Message push , It's easy to implement , Support both WEB, There are support clients , Or a general agreement , Any system can use this protocol to communicate with RMS Communications
Two 、 Use steps
1.rabbitmq Support MQTT agreement
The code is as follows ( Example ):
The first one is rabbitmq_mqtt Provides interaction with back-end services , Corresponding port 1883.
rabbitmq-plugins enable rabbitmq_mqtt
The second kind rabbitmq_web_mqtt Provide interaction with the front end , Corresponding port 15675.
rabbitmq-plugins enable rabbitmq_web_mqtt
2.RMS Listen for messages and send messages
stay RMS Add the code as follows ( Example ):
RMS Listen to messages sent by other systems , Through SECS\GEM Communicate with semiconductor devices , The machine returns the result and then passes MQTT Send the results to other systems
3.Web Listen for messages and send messages
The code is as follows ( Example ):
<script type="text/javascript">
// mqtt agreement rabbitmq service
var brokerIp = "10.20.36.64";
// mqtt Protocol port number
var port = 15675;
// Accept the subject of the push message
var topic = "test";
// mqtt Connect
client = new Paho.MQTT.Client(brokerIp, port, "/ws", "clientId_" + parseInt(Math.random() * 100, 10));
var options = {
timeout: 3, // Timeout time
keepAliveInterval: 30, // Heartbeat time
userName: "admin", // user name
password: "admin", // password
onSuccess: function () {
console.log((" Successful connection ~"));
client.subscribe("test1", {
qos: 1 });
},
onFailure: function (message) {
alert(message.errorMessage);
console.log((" The connection fails ~" + message.errorMessage));
}
};
// in consideration of https The situation of
if (location.protocol == "https:") {
options.useSSL = true;
}
client.connect(options);
console.log((" Already connected to " + brokerIp + ":" + port));
// Disconnect event
client.onConnectionLost = function (responseObject) {
console.log(" Lose connection - " + responseObject.errorMessage);
};
// Receive message event
client.onMessageArrived = function (message) {
alert("222:"+message.payloadString);
console.log(" Accept the theme : " + message.destinationName + " The news of : " + message.payloadString);
$("#arrivedDiv").append("<br/>" + message.payloadString);
var count = $("#count").text();
count = Number(count) + 1;
$("#count").text(count);
};
// Push to a specific topic
function sendMessage() {
var a = $("#message").val();
if (client.isConnected()) {
var message = new Paho.MQTT.Message(a);
message.destinationName = topic;
client.send(message);
alert(message);
}
else {
alert("isConnected:" + client.isConnected());
}
}
</script>
4.RMS and WEB After the client starts
test WEB End
test RMS End
rabbitmq In the queue, there will be mqtt- The first line , When you close the client , The queue also disappeared .
summary
Record every bit of it
边栏推荐
- 让AI替企业做复杂决策真的靠谱吗?参与直播,斯坦福博士来分享他的选择|量子位·视点...
- 【OpenCV 例程200篇】219. 添加数字水印(盲水印)
- .Net之延迟队列
- Tdengine connector goes online Google Data Studio app store
- E-commerce apps are becoming more and more popular. What are the advantages of being an app?
- (1) Complete the new construction of station in Niagara vykon N4 supervisor 4.8 software
- 盗版DALL·E成梗图之王?日产5万张图像,挤爆抱抱脸服务器,OpenAI勒令改名
- Kotlin Compose 与原生 嵌套使用
- Cent7 Oracle database installation error
- [app packaging error] to proceed, either fix the issues identified by lint, or modify your build script as follow
猜你喜欢
Meitu lost 300 million yuan in currency speculation for half a year. Huawei was exposed to expand its enrollment in Russia. Alphago's peers have made another breakthrough in chess. Today, more big new
写入速度提升数十倍,TDengine 在拓斯达智能工厂解决方案上的应用
盗版DALL·E成梗图之王?日产5万张图像,挤爆抱抱脸服务器,OpenAI勒令改名
Kotlin Compose 多个条目滚动
揭秘百度智能测试在测试自动执行领域实践
oracle 多行数据合并成一行数据
[NTIRE 2022]Residual Local Feature Network for Efficient Super-Resolution
QT event filter simple case
Windows uses commands to run kotlin
移动端异构运算技术-GPU OpenCL编程(进阶篇)
随机推荐
Getting started with Apache dolphin scheduler (one article is enough)
Meitu lost 300 million yuan in currency speculation for half a year. Huawei was exposed to expand its enrollment in Russia. Alphago's peers have made another breakthrough in chess. Today, more big new
一文读懂TDengine的窗口查询功能
如何獲取GC(垃圾回收器)的STW(暫停)時間?
TDengine可通过数据同步工具 DataX读写
ThreadLocal source code learning
Officially launched! Tdengine plug-in enters the official website of grafana
美图炒币半年亏了3个亿,华为被曝在俄罗斯扩招,AlphaGo的同类又刷爆一种棋,今日更多大新闻在此...
Is it really reliable for AI to make complex decisions for enterprises? Participate in the live broadcast, Dr. Stanford to share his choice | qubit · viewpoint
The king of pirated Dall · e? 50000 images per day, crowded hugging face server, and openai ordered to change its name
分布式数据库下子查询和 Join 等复杂 SQL 如何实现?
How to implement complex SQL such as distributed database sub query and join?
How Windows bat script automatically executes sqlcipher command
从“化学家”到开发者,从甲骨文到 TDengine,我人生的两次重要抉择
Dry goods sorting! How about the development trend of ERP in the manufacturing industry? It's enough to read this article
MySQL数字类型学习笔记
解决Navicat激活、注册时候出现No All Pattern Found的问题
From "chemist" to developer, from Oracle to tdengine, two important choices in my life
Develop and implement movie recommendation applet based on wechat cloud
Resolve the horizontal (vertical) sliding conflict between viewpager and WebView