CN113676532A - Method for connecting equipment with message middleware and Internet of things system - Google Patents

Method for connecting equipment with message middleware and Internet of things system Download PDF

Info

Publication number
CN113676532A
CN113676532A CN202110939211.1A CN202110939211A CN113676532A CN 113676532 A CN113676532 A CN 113676532A CN 202110939211 A CN202110939211 A CN 202110939211A CN 113676532 A CN113676532 A CN 113676532A
Authority
CN
China
Prior art keywords
message middleware
cloud platform
middleware
equipment
message
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110939211.1A
Other languages
Chinese (zh)
Inventor
王小青
何奎
曹连峰
陶洋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Lubangtong Intelligent Technology Co ltd
Original Assignee
Guangzhou Lubangtong Intelligent Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangzhou Lubangtong Intelligent Technology Co ltd filed Critical Guangzhou Lubangtong Intelligent Technology Co ltd
Priority to CN202110939211.1A priority Critical patent/CN113676532A/en
Publication of CN113676532A publication Critical patent/CN113676532A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/141Setup of application sessions
    • GPHYSICS
    • G16INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR SPECIFIC APPLICATION FIELDS
    • G16YINFORMATION AND COMMUNICATION TECHNOLOGY SPECIALLY ADAPTED FOR THE INTERNET OF THINGS [IoT]
    • G16Y30/00IoT infrastructure
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/12Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/143Termination or inactivation of sessions, e.g. event-controlled end of session

Abstract

The invention belongs to the field of communication, and discloses a method for connecting message middleware by equipment, which comprises the following steps: step 1: the method comprises the steps that a cloud platform receives an activation request sent by equipment, and the cloud platform stores addresses of a plurality of message middleware and records the number of equipment connected with each message middleware; step 2: distributing a message middleware for the equipment and sending the address of the message middleware to the equipment; the device is connected with the corresponding message middleware through the address and is in communication connection with the cloud platform through the message middleware.

Description

Method for connecting equipment with message middleware and Internet of things system
Technical Field
The invention relates to the field of communication, in particular to a method for connecting equipment with message middleware and an Internet of things system.
Background
The performance of the message middleware ActiveMQ is poor, the ActiveMQ accesses 1 ten thousand devices according to the optimal maximum device access amount through large-batch technical verification, and the ActiveMQ cannot support tens of thousands, hundreds of thousands or even more devices if the ActiveMQ needs to be accessed.
For the case of multiple message middleware, CN201910520789.6 discloses a method and system for reducing the number of message middleware connections, the method comprising: the client sends a message to the agent layer; the proxy service in the proxy layer distributes the message to the corresponding connection service according to a preset distribution strategy; the connection service that receives the message sends the message to the MQ connection specified in the message.
The method carries out load balance of the message middleware through the agent layer, specifically, the message is firstly sent to the connection service of the agent layer, and the connection service is responsible for the message to be sent to which middleware.
The method is also powerless in application scenes of hundreds of thousands of devices, and requires a connection service to have larger data processing capacity.
Therefore, the technical problem that the present scheme was solved is: under the condition of how a plurality of message middleware exist, the device more appropriately selects the message middleware to communicate with the cloud platform.
Disclosure of Invention
The invention aims to provide a method for connecting message middleware by equipment, which loads tens of thousands of equipment through a plurality of message middleware, allocates resources of the message middleware by a cloud platform according to rules, and realizes stable communication connection of the tens of thousands of equipment based on the message middleware.
The invention also discloses an Internet of things system.
In order to achieve the purpose, the invention provides the following technical scheme: a method for a device to connect to message middleware, comprising the steps of:
step 1: the method comprises the steps that a cloud platform receives an activation request sent by equipment, and the cloud platform stores addresses of a plurality of message middleware and records the number of equipment connected with each message middleware;
step 2: distributing a message middleware for the equipment and sending the address of the message middleware to the equipment; the device is connected with the corresponding message middleware through the address and is in communication connection with the cloud platform through the message middleware.
In the method for connecting the device with the message middleware, when the device cannot establish communication connection with the message middleware distributed by the cloud platform, the device sends an activation request to the cloud platform.
In the method for connecting the device to the message middleware, when the device is removed from the cloud platform, the cloud platform can disconnect the device by accessing the ActiveMQ through jmx.
JMX (java management extensions), a framework for embedding management functions into application programs, equipment, systems and the like, can span a series of heterogeneous operating system platforms, system architectures and network transmission protocols, and flexibly develop seamless integrated systems, networks and service management applications.
The ActiveMQ opens the interface of JMX to the external system enhancement function to use, and the connection of the client can be disconnected through the interface of the ActiveMQ.
In the method for connecting message middleware by devices, in step 2, the message middleware with the least number of connected devices is selected and allocated to the device according to the number of devices connected to each message middleware.
In the method for connecting message middleware by the equipment, after the message middleware is allocated to the equipment, the record of the number of the equipment connected by the message middleware is updated.
In the above method for the device to connect to the message middleware, the message middleware is ActiveMQ message middleware.
Meanwhile, the invention also discloses an Internet of things system, which comprises a cloud platform and a plurality of message middleware;
the cloud platform comprises the following modules:
a request receiving module: the cloud platform is used for receiving an activation request sent by equipment, and storing addresses of a plurality of message middleware and recording the number of equipment connected with each message middleware;
message middleware distribution module: the device is used for allocating a message middleware to the device according to the activation request and sending the address of the message middleware to the device; the device is connected with the corresponding message middleware through the address and is in communication connection with the cloud platform through the message middleware;
the equipment sends an activation request to a request receiving module and receives the address of the message middleware sent by a message middleware distribution module; the device is connected with the message middleware through the address of the message middleware and establishes communication connection with the cloud platform.
In the above system of internet of things, the cloud platform further includes a disconnection device connection module: when the device is removed from the cloud platform, the user disconnects the device by accessing the ActiveMQ through jmx.
In the above system of internet of things, the message middleware distribution module is further configured to update the record of the number of devices connected to the message middleware after distributing a message middleware to the device.
In the above system of internet of things, the message middleware allocation module is configured to select, according to the number of devices connected to each message middleware, a message middleware with the smallest number of connected devices to allocate to the device;
the message middleware is ActiveMQ message middleware.
Compared with the prior art, the invention has the beneficial effects that:
the invention loads tens of thousands of devices through a plurality of ActiveMQs, and the platform allocates the resources of the ActiveMQs according to the rules without forwarding the messages by the agent layer, thereby realizing that the devices in the whole Internet of things system are in the best communication state.
Drawings
Fig. 1 is a data interaction flow among a device, a message middleware, and a cloud platform according to embodiment 1 of the present invention;
fig. 2 is an interaction flow when a message middleware of embodiment 1 of the present invention fails;
fig. 3 is an interaction flow when the cloud platform removes the device according to embodiment 1 of the present invention;
FIG. 4 is a block flow diagram of embodiment 1 of the present invention;
FIG. 5 is a block diagram showing the structure of embodiment 2 of the present invention;
fig. 6 is an interaction process of the device performing connection authentication in embodiment 1 of the present invention;
fig. 7 is a data interaction process of a device deletion apparatus in embodiment 1 of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Example 1
Referring to fig. 1-4, a method for a device to connect to message middleware includes the steps of:
step 1: the method comprises the steps that a cloud platform receives an activation request sent by equipment, and the cloud platform stores addresses of a plurality of message middleware and records the number of equipment connected with each message middleware; the record of the number of devices to which the message middleware is connected is updated each time a message middleware is assigned to a device.
The message middleware of the present invention is typically an ActiveMQ message middleware, but does not exclude other types of message middleware such as RabbitMQ, Kafka, RocketMQ, etc.
The activation request sent by the equipment comprises the ID of the equipment, and the ID of the equipment, an account number and a password which are allocated to the equipment are stored in the cloud platform in advance; and (5) after the cloud platform receives the activation request, performing step 2.
Step 2: distributing a message middleware for the equipment and sending the address of the message middleware to the equipment; the device is connected with the corresponding message middleware through the address and is in communication connection with the cloud platform through the message middleware.
One alternative strategy for assigning a message middleware to a device is: and selecting the message middleware with the least number of connected devices to be distributed to the devices according to the number of the connected devices on each message middleware.
But other strategies may be chosen, such as:
1. assigning according to a proportion of the weights
2. Random allocation
3. Allocation according to a polling algorithm
The equipment is connected with the message middleware through the address of the message middleware, wherein the authentication process is involved, and the authentication process can refer to CN 202010861045.3; the method includes that the equipment writes an account number and a password of the equipment into connection request information and sends the account number and the password to message middleware corresponding to the address, the message middleware generates an authentication request and sends the account number and the password in the authentication request and the connection request information to a cloud platform, the cloud platform authenticates the authentication, and after the authentication is passed, the message middleware and the equipment are connected.
The method for the device to connect the corresponding message middleware through the address comprises the following steps:
the device sends the connection request to the message middleware through the address; the connection request comprises an account and a password which are allocated to the equipment by the cloud platform;
in the process of registering the equipment to the cloud platform, the cloud platform generates an account and a password aiming at the equipment;
when the device sends an activation request, the cloud platform sends the address of the message middleware and simultaneously sends the account number and the password to the device.
The message middleware generates an authentication request and sends the authentication request, the account and the password to the cloud platform;
the cloud platform authenticates the account and the password according to the authentication request; the connection authentication operation may refer to fig. 6;
if the cloud platform deletes the account and the password of the device stored in the cloud platform, the authentication of the cloud platform fails, and the device cannot be connected with the message middleware. Delete device operation may refer to fig. 7.
In general, the device is a message producer and the cloud platform is a message consumer.
In the operation process, the equipment and the message middleware normally communicate, when the equipment cannot establish communication connection with the message middleware distributed by the cloud platform, the message middleware is indicated to have a fault, and the equipment sends an activation request to the cloud platform at this time.
At this time, the cloud platform executes step 1 and step 2 to reassign a message middleware to the device.
The device is connected with the ActiveMQ middleware through MQTT, and needs to be identified through three-way handshake of TCP protocol and response code of MQTT protocol:
TCP three-way handshake fails to establish connection, it means ActiveMQ is unavailable
If the TCP has established a connection, if the response code passing through the MQTT protocol is not 0x00, the connection cannot be established, the error code of 0x04 (which may occur in the case where the cloud platform deletes the account and the password of the device) may immediately restart the activation process, and if the other error codes are rejected, the connection may be tried many times, and if the connection is not successful, the activation process may be restarted.
The response code is as follows:
Figure BDA0003214079080000061
when the device is removed from the cloud platform, the cloud platform will disconnect the device by accessing the ActiveMQ through jmx.
In the embodiment, tens of thousands of devices are loaded through a plurality of ActiveMQs, the resources of the ActiveMQs are allocated by the platform according to rules, and the forwarding processing of messages is not required by an agent layer, so that the devices in the whole Internet of things system can be in the optimal communication state.
Example 2
Referring to fig. 5, an internet of things system includes a cloud platform 1, a plurality of message middleware 2;
the cloud platform 1 comprises the following modules:
the request receiving module 11: the cloud platform is used for receiving an activation request sent by the equipment 3, and the cloud platform stores addresses of a plurality of message middleware and records the number of equipment connected with each message middleware;
message middleware distribution module 12: the device is used for allocating a message middleware to the device according to the activation request and sending the address of the message middleware to the device; the device is connected with the corresponding message middleware through the address and is in communication connection with the cloud platform through the message middleware; after a message middleware is distributed to the equipment, updating the record of the number of the equipment connected with the message middleware;
as a further preferred aspect, the message middleware distribution module is configured to select, according to the number of devices connected to each message middleware, a message middleware with the smallest number of connected devices to distribute to the devices;
disconnect device connection module 13: when the device is removed from the cloud platform, the user disconnects the device by accessing the ActiveMQ through jmx.
The equipment sends an activation request to a request receiving module and receives the address of the message middleware sent by a message middleware distribution module; the device is connected with the message middleware through the address of the message middleware and establishes communication connection with the cloud platform.
When the device needs to be disconnected, an operator can operate the device disconnection module on the cloud platform, the device connection is disconnected by accessing the ActiveMQ through jmx, and the device does not repeatedly initiate activation operation.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential attributes thereof. The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference sign in a claim should not be construed as limiting the claim concerned.

Claims (10)

1. A method for a device to connect to message middleware, comprising the steps of:
step 1: the method comprises the steps that a cloud platform receives an activation request sent by equipment, and the cloud platform stores addresses of a plurality of message middleware and records the number of equipment connected with each message middleware;
step 2: distributing a message middleware for the equipment and sending the address of the message middleware to the equipment; the device is connected with the corresponding message middleware through the address and is in communication connection with the cloud platform through the message middleware.
2. The method for the device to connect to the message middleware according to claim 1, wherein the device sends the activation request to the cloud platform when the device cannot establish the communication connection with the message middleware allocated by the cloud platform.
3. The method for connecting the message middleware to the device according to claim 1, wherein when the device is removed from the cloud platform, the cloud platform accesses the ActiveMQ through jmx to disconnect the device and delete the account and password of the device stored in the cloud platform;
the method for the device to connect the corresponding message middleware through the address comprises the following steps:
the device sends the connection request to the message middleware through the address; the connection request comprises an account and a password which are allocated to the equipment by the cloud platform;
the message middleware generates an authentication request and sends the authentication request, the account and the password to the cloud platform;
the cloud platform authenticates the account and the password according to the authentication request;
if the cloud platform deletes the account and the password of the device stored in the cloud platform, the authentication of the cloud platform fails, and the device cannot be connected with the message middleware.
4. The method for connecting message middleware of claim 1, wherein in step 2, the message middleware with the least number of connected devices is selected and allocated to the device according to the number of connected devices on each message middleware.
5. The method of claim 1, wherein the device is configured to update the record of the number of devices connected by the message middleware after a message middleware is assigned to the device.
6. The method of device attachment messaging middleware of claim 1, wherein the messaging middleware is ActiveMQ messaging middleware.
7. The Internet of things system is characterized by comprising a cloud platform and a plurality of message middleware;
the cloud platform comprises the following modules:
a request receiving module: the cloud platform is used for receiving an activation request sent by equipment, and storing addresses of a plurality of message middleware and recording the number of equipment connected with each message middleware;
message middleware distribution module: the device is used for allocating a message middleware to the device according to the activation request and sending the address of the message middleware to the device; the device is connected with the corresponding message middleware through the address and is in communication connection with the cloud platform through the message middleware;
the equipment sends an activation request to a request receiving module and receives the address of the message middleware sent by a message middleware distribution module; the device is connected with the message middleware through the address of the message middleware and establishes communication connection with the cloud platform.
8. The system of claim 7, wherein the cloud platform further comprises a disconnect device connection module: when the device is removed from the cloud platform, the user disconnects the device by accessing the ActiveMQ through jmx.
9. The system according to claim 7, wherein the message middleware distribution module is further configured to update the record of the number of devices connected to the message middleware after distributing a message middleware to the device.
10. The system according to claim 7, wherein the message middleware distribution module is configured to select, according to the number of devices connected to each message middleware, the message middleware with the smallest number of connected devices to distribute to the devices;
the message middleware is ActiveMQ message middleware.
CN202110939211.1A 2021-08-16 2021-08-16 Method for connecting equipment with message middleware and Internet of things system Pending CN113676532A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110939211.1A CN113676532A (en) 2021-08-16 2021-08-16 Method for connecting equipment with message middleware and Internet of things system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110939211.1A CN113676532A (en) 2021-08-16 2021-08-16 Method for connecting equipment with message middleware and Internet of things system

Publications (1)

Publication Number Publication Date
CN113676532A true CN113676532A (en) 2021-11-19

Family

ID=78543104

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110939211.1A Pending CN113676532A (en) 2021-08-16 2021-08-16 Method for connecting equipment with message middleware and Internet of things system

Country Status (1)

Country Link
CN (1) CN113676532A (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080162644A1 (en) * 2006-12-29 2008-07-03 Krishnan Kalyanaraman B Auto selection of connectors in a middleware framework
CN107846447A (en) * 2017-09-21 2018-03-27 烽火通信科技股份有限公司 A kind of method of the home terminal access message-oriented middleware based on MQTT agreements
CN111741040A (en) * 2019-06-26 2020-10-02 腾讯科技(深圳)有限公司 Connection establishing method, address obtaining method, device, equipment and storage medium
CN111988324A (en) * 2020-08-25 2020-11-24 广州鲁邦通物联网科技有限公司 Data communication method, system, equipment and storage medium
CN112565334A (en) * 2020-11-04 2021-03-26 深圳市宏电技术股份有限公司 Access method and device of Internet of things equipment and MQTT gateway
CN112732463A (en) * 2021-01-16 2021-04-30 刘铮 Message subscription method and device based on big data

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080162644A1 (en) * 2006-12-29 2008-07-03 Krishnan Kalyanaraman B Auto selection of connectors in a middleware framework
CN107846447A (en) * 2017-09-21 2018-03-27 烽火通信科技股份有限公司 A kind of method of the home terminal access message-oriented middleware based on MQTT agreements
CN111741040A (en) * 2019-06-26 2020-10-02 腾讯科技(深圳)有限公司 Connection establishing method, address obtaining method, device, equipment and storage medium
CN111988324A (en) * 2020-08-25 2020-11-24 广州鲁邦通物联网科技有限公司 Data communication method, system, equipment and storage medium
CN112565334A (en) * 2020-11-04 2021-03-26 深圳市宏电技术股份有限公司 Access method and device of Internet of things equipment and MQTT gateway
CN112732463A (en) * 2021-01-16 2021-04-30 刘铮 Message subscription method and device based on big data

Similar Documents

Publication Publication Date Title
EP1558001B1 (en) Method and apparatus for operating an open network having a proxy
KR20000004988A (en) Method and apparatus for client managed flow control on a limited memorycomputer system
CN107528891B (en) Websocket-based automatic clustering method and system
CN111711697A (en) Message pushing method, device, equipment and storage medium
CN103795569A (en) Server connection method and device based on connection pool
CN113904917A (en) Meteorological data service platform based on micro-service architecture
CN114398176A (en) Service access method, device, electronic equipment and storage medium
JP4669601B2 (en) Network terminal device, network, and task distribution method
CN113794652A (en) Data processing method and device, electronic equipment and storage medium
CN114338063A (en) Message queue system, service processing method, and computer-readable storage medium
US7519855B2 (en) Method and system for distributing data processing units in a communication network
CN110138753B (en) Distributed message service system, method, apparatus, and computer-readable storage medium
CN113177179B (en) Data request connection management method, device, equipment and storage medium
CN111314241B (en) Task scheduling method and scheduling system
CN113676532A (en) Method for connecting equipment with message middleware and Internet of things system
KR101251630B1 (en) System and method for providing push service
CN112616143B (en) Method and device for distributing communication numbers, electronic equipment and storage medium
CN111935296B (en) System for high-availability infinite MQTT message service capacity expansion
US7647379B2 (en) System and method for re-routing messaging traffic to external resources
CN113535402A (en) Load balancing processing method and device based on 5G MEC and electronic equipment
CN108055305B (en) Storage expansion method and storage expansion device
CN113765871A (en) Fortress management method and device
CN109040236A (en) A kind of server cut-in method and network system
CN111147389A (en) TCP long connection server load balancing system and method
CN111385323B (en) EJB service processing method, device, equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination