Disclosure of Invention
The invention provides a message interaction method, a message interaction device, electronic equipment and a readable storage medium, and aims to improve the efficiency of message interaction.
In order to achieve the above object, the present invention provides a message interaction method, including:
acquiring a subscription and release relationship between a producer and a consumer, and configuring a subscription configuration table and a release configuration table according to the subscription and release relationship and the consumer subscription information, wherein the subscription configuration table is connected with the release configuration table through an associated main key;
when a message interaction instruction is received, reading a consumer ID contained in the message interaction instruction;
inquiring consumer configuration information with an open switch field in the subscription configuration table according to the consumer ID;
determining a primary key field in the subscription configuration table according to the consumer configuration information;
inquiring the producer ID with the switch field being on in the release configuration table by using the associated main keys in the subscription configuration table and the release configuration table according to the main key field in the subscription configuration table;
and receiving a message sent by the producer corresponding to the producer ID, and sending the message to a consumer of a platform subscribing the producer to publish the message.
When a message interaction instruction is received, reading a consumer ID contained in the message interaction instruction, querying consumer configuration information with a switch field on in the subscription configuration table according to the consumer ID, optionally, reading the consumer ID contained in the message interaction instruction, including:
identifying an operation code in the message interaction instruction;
confirming the consumer address according to the operation code;
and inquiring the ID of the consumer in a preset consumer address matching database according to the consumer address.
When a message interaction instruction is received, reading a consumer ID contained in the message interaction instruction, inquiring consumer configuration information with an open switch field in the subscription configuration table according to the consumer ID, and optionally inquiring the consumer configuration information with the open switch field in the subscription configuration table according to the consumer ID, wherein the method comprises the following steps:
reading consumer configuration information consistent with the consumer ID in the subscription configuration table according to the consumer ID;
finding a switch field in the subscription configuration table which is consistent with the consumer ID by using a find instruction;
and according to the switch field, screening out the consumer configuration information with the switch field on from the consumer configuration information.
Optionally, the querying, according to the primary key field in the subscription configuration table, the producer ID with the switch field being on in the publication configuration table by using the associated primary key in the subscription configuration table and the publication configuration table includes:
according to the main key field in the subscription configuration table, determining a system corresponding to the consumer by using the associated main keys in the subscription configuration table and the release configuration table;
inquiring a publisher contained in the system;
screening out producers with open switch fields from the publishers;
and looking up the issuer ID of the producer with the switch field being on in the issuing configuration table.
Optionally, the sending the message to a consumer subscribing to the platform for the producer to publish messages includes:
looking up the configuration information of the producer corresponding to the producer ID in the release configuration table;
determining the message subject of the producer according to the configuration information;
querying a platform subscribing to the message topic and consumers in the platform;
sending the message to a consumer in the platform.
Optionally, before configuring the subscription configuration table and the publication configuration table according to the subscription and publication relationship, the method further includes:
and acquiring the ID of the consumer, the ID of the producer and configuration information, and constructing an initial subscription configuration table and an initial release configuration table.
Optionally, the configuring a subscription configuration table and a publication configuration table according to the subscription and publication relationship and the consumer subscription information includes:
according to the subscription and release relationship, respectively filling the consumer ID and the producer ID into a consumer ID field and a producer ID field in the initial subscription configuration table and the initial release configuration table;
and correspondingly filling switch fields in the initial subscription configuration table and the initial release configuration table according to the consumer subscription information to obtain a subscription configuration table and a release configuration table.
In order to solve the above problem, the present invention further provides a message interaction apparatus, including:
the configuration table configuration module is used for acquiring a subscription and release relationship between a producer and a consumer, and configuring a subscription configuration table and a release configuration table according to the subscription and release relationship and the consumer subscription information, wherein the subscription configuration table is connected with the release configuration table through a related main key;
the consumer configuration information acquisition module is used for reading a consumer ID contained in a message interaction instruction when the message interaction instruction is received, and inquiring consumer configuration information with an open switch field in the subscription configuration table according to the consumer ID;
and the message sending module is used for determining a main key field in the subscription configuration table according to the consumer configuration information, inquiring a producer ID with an open switch field in the release configuration table by using the associated main keys in the subscription configuration table and the release configuration table according to the main key field in the subscription configuration table, receiving a message sent by a producer corresponding to the producer ID, and sending the message to a consumer subscribing a platform for the producer to release the message.
In order to solve the above problem, the present invention also provides an electronic device, including:
a memory storing at least one computer program; and
and the processor executes the computer program stored in the memory to realize the message interaction method.
In order to solve the above problem, the present invention also provides a computer-readable storage medium, in which at least one computer program is stored, and the at least one computer program is executed by a processor in an electronic device to implement the message interaction method described above.
The embodiment of the invention prevents the wrong relation and message sending caused by disorder by acquiring the subscription and publishing relation and the subscription information of the consumer between a producer and a consumer, further configures a subscription configuration table and a publishing configuration table according to the subscription and publishing relation and the subscription information of the consumer, wherein the subscription configuration table and the publishing configuration table are connected through a related main key to define the message transmission path between the producer and the consumer, next, when receiving a message interaction instruction, reads the consumer ID of the consumer contained in the message interaction instruction, determines the message sending direction, improves the accuracy of message interaction, further, inquires the consumer configuration information with a switch field opened in the subscription configuration table according to the consumer ID, determines the message type consumed by the consumer according to the configuration information, inquiring the producer ID with the switch field being on in the release configuration table by using the associated main keys in the subscription configuration table and the release configuration table according to the message type, controlling a single data source by using the switch fields in the subscription configuration table and the release configuration table, accurately corresponding to different message queues in message interaction, thereby the migration and conversion progress of different message queues in the message exchange process can be not required to be unified, the joint debugging is more convenient, the difficulty of the migration and conversion of message data is reduced, thereby improving the efficiency of data migration and conversion, and finally, receiving the message sent by the producer corresponding to the producer ID, and the message is sent to the consumer who subscribes the platform for the producer to publish the message, so that the message transmission is completed, the message interaction efficiency is improved, and the difficulty of message data migration and conversion is reduced. Therefore, the multi-platform message interaction method, device, equipment and storage medium provided by the embodiment of the invention can improve the message interaction efficiency.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The embodiment of the invention provides a message interaction method. The execution subject of the message interaction method includes, but is not limited to, at least one of electronic devices that can be configured to execute the method provided by the embodiments of the present application, such as a server, a terminal, and the like. In other words, the message interaction method may be performed by software or hardware installed in the terminal device or the server device, and the software may be a block chain platform. The server side can comprise an independent server, and can also comprise a cloud server which provides basic cloud computing services such as cloud service, a cloud database, cloud computing, cloud functions, cloud storage, Network service, cloud communication, middleware service, domain name service, security service, Content Delivery Network (CDN), big data and an artificial intelligence platform.
Referring to a flowchart of a message interaction method provided in an embodiment of the present invention shown in fig. 1, in the embodiment of the present invention, the message interaction method includes the following steps S1-S6:
s1, obtaining the subscription and publication relation between the producer and the consumer, and configuring a subscription configuration table and a publication configuration table according to the subscription and publication relation and the consumer subscription information, wherein the subscription configuration table is connected with the publication configuration table through a related main key.
In the embodiment of the present invention, the producer may be a source of message data in the message queue, and is generally a platform service end, for example, when a bank promotes a financial product, and issues the financial product message to a user, the service terminal of the bank is the producer. The consumer may be a destination of message data in a message queue, and is generally a platform client, for example, a client account of a user who receives financial product information issued by a bank. The subscription-publishing relationships may be relationships of which producers are subscribed to by which consumers and relationships of which producers the consumers receive published messages. The subscription configuration table includes fields such as a primary key, a consumer ID, a configuration message, and a control switch. The release configuration table comprises fields such as a main key, an associated main key, a producer ID, a configuration message, a control switch and the like.
In an optional embodiment of the invention, the subscription and publication relation between a producer who publishes message data and a consumer who subscribes to the producer is confirmed by calling the background data of the server, so that the condition of message sending errors caused by disorder of the relation is prevented, and the accuracy of message sending in message interaction is improved.
The embodiment of the invention configures the subscription configuration table and the release configuration table according to the subscription and release relationship, and defines the message transmission path between a producer and a consumer so as to find the problem during message interaction in time.
Further, as an optional embodiment of the present invention, before configuring the subscription configuration table and the publication configuration table according to the subscription and publication relationship, the method further includes:
and acquiring the ID of the consumer, the ID of the producer and configuration information, and constructing an initial subscription configuration table and an initial release configuration table.
In this embodiment of the present invention, the configuration information may be attribute information corresponding to the consumer and the producer. The initial subscription configuration table includes fields such as a primary key, a consumer ID field, a configuration message, and a control switch. The release configuration table comprises fields such as a main key, an associated main key, a producer ID, a configuration message, a control switch and the like.
In addition, the configuring the subscription configuration table and the publishing configuration table according to the subscription and publishing relationship and the consumer subscription information includes:
according to the subscription and release relationship, respectively filling the consumer ID and the producer ID into a consumer ID field and a producer ID field in the initial subscription configuration table and the initial release configuration table;
and correspondingly filling switch fields in the initial subscription configuration table and the initial release configuration table according to the consumer subscription information to obtain a subscription configuration table and a release configuration table.
In the optional embodiment of the invention, in order to conveniently and intuitively acquire the condition of the consumer subscription message, the subscription configuration table and the release configuration table can be visually processed, and the message interaction process is simplified, so that the message interaction efficiency is improved.
And S2, when the message interaction instruction is received, reading the consumer ID contained in the message interaction instruction.
In this embodiment of the present invention, the message interaction instruction may be an instruction for a producer to request to send message data to a consumer who subscribes to the producer correspondingly. The consumer ID may be a uniquely identifiable tag such as an account number and an IP address of a platform where the consumer is located.
According to the embodiment of the invention, the sending direction of the message data produced by the producer is confirmed by reading the consumer ID contained in the message interaction instruction, so that the accuracy of message interaction is improved.
Further, as an optional embodiment of the present invention, the reading the consumer ID included in the message interaction instruction includes:
identifying an operation code in the message interaction instruction;
confirming the consumer address according to the operation code;
and inquiring the ID of the consumer in a preset consumer address matching database according to the consumer address.
In the embodiment of the invention, the operation code is responsible for telling the computer what operation to execute, for example, the operation code in the message interaction instruction is responsible for telling the computer to search for the address of the consumer. The consumer address may be a platform or terminal where the consumer account is located. The preset consumer address ID matching database can be a consumer ID corresponding to a platform or a terminal where a consumer account is located.
According to the embodiment of the invention, the consumer ID is determined through the information interaction instruction, so that the sending direction of the message data produced by the producer is confirmed, and the accuracy of message interaction is improved.
S3, inquiring the consumer configuration information with the switch field being on in the subscription configuration table according to the consumer ID.
In this embodiment of the present invention, the switch field may be one of fields in the subscription configuration table, and the selected item is only on and off. The consumer configuration message may be information about the consumer, including the type of message the consumer subscribes to, the producer the consumer subscribes to, and the like.
According to the embodiment of the invention, the consumer configuration information with the switch field being on in the subscription configuration table is inquired according to the consumer ID, and the switch field in the subscription configuration table can be used for controlling a single data source and accurately corresponding to different message queues in message interaction, so that the migration and conversion progress of different message queues in the message exchange process can be free from being unified, and joint debugging is more convenient.
Further, as an optional embodiment of the present invention, the querying consumer configuration information with an on switch field in the subscription configuration table according to the consumer ID includes:
reading consumer configuration information consistent with the consumer ID in the subscription configuration table according to the consumer ID;
finding a switch field in the subscription configuration table which is consistent with the consumer ID by using a find instruction;
and according to the switch field, screening out the consumer configuration information with the switch field on from the consumer configuration information.
In this embodiment of the present invention, the find instruction may be an instruction for looking up a switch field, i.e., a status field.
S4, determining the primary key field in the subscription configuration table according to the consumer configuration information.
In this embodiment of the present invention, the primary key field is one or more fields in the subscription configuration table, and its value is used to uniquely identify a record in the subscription configuration table.
According to the position of the corresponding field of the consumer configuration information, the optional embodiment of the invention searches the main key field corresponding to the consumer in the subscription configuration table, thereby determining the associated main key associated with the main key field in the release configuration table, facilitating the search of the release corresponding to the consumer, and further realizing the issuing of the message on different platforms.
S5, according to the main key field in the subscription configuration table, using the associated main key in the subscription configuration table and the release configuration table to inquire the producer ID with the switch field in the release configuration table being on.
In an embodiment of the present invention, the associated primary key may be used to refer to a specific record from one table to another table, for example, refer to a system corresponding to a consumer from a subscription configuration table in a publication configuration table.
According to the embodiment of the invention, according to the main key field in the subscription configuration table, the producer ID with the switch field being on in the release configuration table is inquired by using the associated main keys in the subscription configuration table and the release configuration table, and the switch field in the release configuration table can control a single data source and accurately correspond to different message queues in message interaction, so that the migration and conversion progress of different message queues in the message exchange process can be unified without unification, and joint debugging is more convenient.
Further, as an optional embodiment of the present invention, the querying, according to the primary key field in the subscription configuration table, the producer ID whose switch field is on in the release configuration table by using the associated primary key in the subscription configuration table and the release configuration table includes:
according to the main key field in the subscription configuration table, determining a system corresponding to the consumer by using the associated main keys in the subscription configuration table and the release configuration table;
inquiring a publisher contained in the system;
screening out producers with open switch fields from the publishers;
and looking up the issuer ID of the producer with the switch field being on in the issuing configuration table. The embodiment of the invention confirms the producer subscribed by the consumer through a matching method, and reduces the constraint of the platform, thereby ensuring that the message interaction between cross-platforms is smoother, and improving the message interaction efficiency.
S6, receiving the message sent by the producer corresponding to the producer ID, and sending the message to the consumer of the platform subscribing the producer to publish the message.
In this embodiment of the present invention, the platform may be a platform that subscribes to the producer topic.
The information sent by the producer corresponding to the producer ID is received, sent to the consumers of the platforms subscribing the producer to publish the information, and sent to the consumers of a plurality of different platforms, so that the information interaction of the multiple platforms is realized, and the efficiency of the information interaction of the multiple platforms is improved.
Further, as an optional embodiment of the present invention, the sending the message to a consumer subscribing to the platform for the producer to publish a message includes:
looking up the configuration information of the producer corresponding to the producer ID in the release configuration table;
determining the message subject of the producer according to the configuration information;
querying a platform subscribing to the message topic and a consumer in the platform;
sending the message to a consumer in the platform.
In the embodiment of the present invention, the preset rule may be mapping the message data to a payload of a certain encapsulation protocol, and then filling a packet header of a corresponding protocol to form a data packet of the encapsulation protocol, thereby completing encapsulation and packaging of the message data.
In an optional embodiment of the present invention, the message data of the message data receiving interface is read to obtain the message sent by the producer corresponding to the producer ID, so as to ensure smooth implementation of message interaction.
The embodiment of the invention ensures that the message data can be smoothly transmitted in the link without problems by packaging and packing the message according to the preset rule, and ensures the safety of message interaction.
Further, as an optional embodiment of the present invention, the encapsulating and packaging the message according to a preset rule includes:
appl is added to the header of the message to obtain a primary packaging message;
TCP addition is carried out on the header of the primary packaging message to obtain a secondary packaging message;
performing IP addition on the header of the secondary packaging message to obtain a tertiary packaging message;
and adding Ethernet to the header of the three-time encapsulated message to obtain a target encapsulated message, and completing the encapsulation and packaging of the message.
The embodiment of the invention ensures the safety of the message data by adding a series of protocol codes, address codes and the like in the message data header, thereby improving the safety of message interaction.
The embodiment of the invention prevents the wrong relation and message sending caused by disorder by acquiring the subscription and publishing relation and the subscription information of the consumer between a producer and a consumer, further configures a subscription configuration table and a publishing configuration table according to the subscription and publishing relation and the subscription information of the consumer, wherein the subscription configuration table is connected with the publishing configuration table through a related main key to define the message transmission path between the producer and the consumer, next, when receiving a message interaction instruction, reads the consumer ID of the consumer contained in the message interaction instruction to determine the message sending direction and improve the accuracy of message interaction, further, inquires the consumer configuration information with a switch field opened in the subscription configuration table according to the consumer ID, determines the message type consumed by the consumer according to the configuration information, inquiring the producer ID with the switch field being on in the release configuration table by using the associated main keys in the subscription configuration table and the release configuration table according to the message type, controlling a single data source by using the switch fields in the subscription configuration table and the release configuration table, accurately corresponding to different message queues in message interaction, thereby the migration and conversion progress of different message queues in the message exchange process can be not required to be unified, the joint debugging is more convenient, the difficulty of the migration and conversion of message data is reduced, thereby improving the efficiency of data migration and conversion, and finally, receiving the message sent by the producer corresponding to the producer ID, and the message is sent to the consumer who subscribes the platform for the producer to publish the message, so that the message transmission is completed, the message interaction efficiency is improved, and the difficulty of message data migration and conversion is reduced. Therefore, the multi-platform message interaction method, device, equipment and storage medium provided by the embodiment of the invention can improve the message interaction efficiency.
Fig. 2 is a functional block diagram of the message interaction device according to the present invention.
The message interaction device 100 of the present invention can be installed in an electronic device. According to the implemented functions, the message interaction apparatus 100 may include a configuration table configuration module 101, a consumer configuration information obtaining module 102, and a message sending module 103, which may also be referred to as a unit in the present invention, and refer to a series of computer program segments that can be executed by a processor of an electronic device and can perform fixed functions, and are stored in a memory of the electronic device.
In the present embodiment, the functions regarding the respective modules/units are as follows:
the configuration table configuration module 101 is configured to obtain a subscription and publication relationship between a producer and a consumer, and configure a subscription configuration table and a publication configuration table according to the subscription and publication relationship and the consumer subscription information, where the subscription configuration table and the publication configuration table are connected by an associated main key.
In the embodiment of the present invention, the producer may be a source of message data in the message queue, and is generally a platform service end, for example, when a bank promotes a financial product, and issues the financial product message to a user, the service terminal of the bank is the producer. The consumer may be a destination of message data in a message queue, and is generally a platform client, for example, a client account of a user who receives financial product information issued by a bank. The subscription-publishing relationships may be relationships of which producers are subscribed to by which consumers and relationships of which producers the consumers receive published messages. The subscription configuration table includes fields such as a primary key, a consumer ID, a configuration message, and a control switch. The release configuration table comprises fields such as a main key, an associated main key, a producer ID, a configuration message, a control switch and the like.
In an optional embodiment of the invention, the subscription and publication relation between a producer who publishes message data and a consumer who subscribes to the producer is confirmed by calling the background data of the server, so that the condition of message sending errors caused by disorder of the relation is prevented, and the accuracy of message sending in message interaction is improved.
The embodiment of the invention configures the subscription configuration table and the release configuration table according to the subscription and release relationship, and defines the message transmission path between a producer and a consumer so as to find the problem during message interaction in time.
Further, as an optional embodiment of the present invention, before configuring the subscription configuration table and the publication configuration table according to the subscription and publication relationship, the method further includes:
and acquiring the ID of the consumer, the ID of the producer and configuration information, and constructing an initial subscription configuration table and an initial release configuration table.
In this embodiment of the present invention, the configuration information may be attribute information corresponding to the consumer and the producer. The initial subscription configuration table includes fields such as a primary key, a consumer ID field, a configuration message, and a control switch. The release configuration table comprises fields such as a main key, an associated main key, a producer ID, a configuration message, a control switch and the like.
In addition, the configuring the subscription configuration table and the publishing configuration table according to the subscription and publishing relationship and the consumer subscription information includes:
according to the subscription and release relationship, respectively filling the consumer ID and the producer ID into a consumer ID field and a producer ID field in the initial subscription configuration table and the initial release configuration table;
and correspondingly filling switch fields in the initial subscription configuration table and the initial release configuration table according to the consumer subscription information to obtain a subscription configuration table and a release configuration table.
In the optional embodiment of the invention, in order to conveniently and intuitively acquire the condition of the consumer subscription message, the subscription configuration table and the release configuration table can be subjected to visualization processing, and the message interaction process is simplified, so that the message interaction efficiency is improved.
The consumer configuration information obtaining module 102 is configured to, when receiving the message interaction instruction, read a consumer ID included in the message interaction instruction, and query, according to the consumer ID, consumer configuration information in which a switch field in the subscription configuration table is on.
In this embodiment of the present invention, the message interaction instruction may be an instruction for a producer to request to send message data to a consumer who subscribes to the producer correspondingly. The consumer ID may be a uniquely identifiable tag such as an account number and an IP address of a platform where the consumer is located.
According to the embodiment of the invention, the sending direction of the message data produced by the producer is confirmed by reading the consumer ID contained in the message interaction instruction, so that the accuracy of message interaction is improved.
Further, as an optional embodiment of the present invention, the reading the consumer ID included in the message interaction instruction includes:
identifying an operation code in the message interaction instruction;
confirming the consumer address according to the operation code;
and inquiring the ID of the consumer in a preset consumer address matching database according to the consumer address.
In the embodiment of the invention, the operation code is responsible for telling the computer what operation to execute, for example, the operation code in the message interaction instruction is responsible for telling the computer to search for the address of the consumer. The consumer address may be a platform or terminal where the consumer account is located. The preset consumer address ID matching database can be a consumer ID corresponding to a platform or a terminal where a consumer account is located.
According to the embodiment of the invention, the consumer ID is determined through the information interaction instruction, so that the sending direction of the message data produced by the producer is confirmed, and the accuracy of message interaction is improved.
In this embodiment of the present invention, the switch field may be one of fields in the subscription configuration table, and the selected item is only on and off. The consumer configuration message may be information about the consumer, including the type of message the consumer subscribes to, the producer the consumer subscribes to, and the like.
According to the embodiment of the invention, the consumer configuration information with the switch field being on in the subscription configuration table is inquired according to the consumer ID, and the switch field in the subscription configuration table can be used for controlling a single data source and accurately corresponding to different message queues in message interaction, so that the migration and conversion progress of different message queues in the message exchange process can be free from being unified, and joint debugging is more convenient.
Further, as an optional embodiment of the present invention, the querying consumer configuration information with an on switch field in the subscription configuration table according to the consumer ID includes:
reading consumer configuration information consistent with the consumer ID in the subscription configuration table according to the consumer ID;
finding a switch field in the subscription configuration table which is consistent with the consumer ID by using a find instruction;
and according to the switch field, screening out the consumer configuration information with the switch field on from the consumer configuration information.
In this embodiment of the present invention, the find instruction may be an instruction for looking up a switch field, i.e., a status field.
The message sending module 103 is configured to determine a primary key field in the subscription configuration table according to the consumer configuration information, query, according to the primary key field in the subscription configuration table, a producer ID with an on switch field in the publication configuration table by using an associated primary key in the subscription configuration table and the publication configuration table, receive a message sent by a producer corresponding to the producer ID, and send the message to a consumer subscribing to a platform on which the producer publishes the message.
In this embodiment of the present invention, the primary key field is one or more fields in the subscription configuration table, and its value is used to uniquely identify a record in the subscription configuration table.
According to the position of the corresponding field of the consumer configuration information, the optional embodiment of the invention searches the main key field corresponding to the consumer in the subscription configuration table, thereby determining the associated main key associated with the main key field in the release configuration table, facilitating the search of the release corresponding to the consumer, and further realizing the issuing of the message on different platforms.
In an embodiment of the present invention, the associated primary key may be used to refer to a specific record from one table to another table, for example, refer to a system corresponding to a consumer from a subscription configuration table in a publication configuration table.
According to the embodiment of the invention, according to the main key field in the subscription configuration table, the producer ID with the switch field being on in the release configuration table is inquired by using the associated main keys in the subscription configuration table and the release configuration table, and the switch field in the release configuration table can control a single data source and accurately correspond to different message queues in message interaction, so that the migration and conversion progress of different message queues in the message exchange process can be unified without unification, and joint debugging is more convenient.
Further, as an optional embodiment of the present invention, the querying, according to the primary key field in the subscription configuration table, the producer ID whose switch field is on in the release configuration table by using the associated primary key in the subscription configuration table and the release configuration table includes:
according to the main key field in the subscription configuration table, determining a system corresponding to the consumer by using the associated main keys in the subscription configuration table and the release configuration table;
inquiring a publisher contained in the system;
screening out producers with open switch fields from the publishers;
and looking up the issuer ID of the producer with the switch field being on in the issuing configuration table. The embodiment of the invention confirms the producer subscribed by the consumer through a matching method, and reduces the constraint of the platform, thereby ensuring that the message interaction between cross-platforms is smoother and improving the message interaction efficiency.
In the embodiment of the present invention, the platform may be a platform that subscribes to the producer topic.
The information sent by the producer corresponding to the producer ID is received, sent to the consumers of the platforms subscribing the producer to publish the information, and sent to the consumers of a plurality of different platforms, so that the information interaction of the multiple platforms is realized, and the efficiency of the information interaction of the multiple platforms is improved.
Further, as an optional embodiment of the present invention, the sending the message to a consumer subscribing to the platform for the producer to publish a message includes:
looking up the configuration information of the producer corresponding to the producer ID in the release configuration table;
determining the message subject of the producer according to the configuration information;
querying a platform subscribing to the message topic and consumers in the platform;
sending the message to a consumer in the platform.
In the embodiment of the present invention, the preset rule may be mapping the message data to a payload of a certain encapsulation protocol, and then filling a packet header of a corresponding protocol to form a data packet of the encapsulation protocol, thereby completing encapsulation and packaging of the message data.
In an optional embodiment of the present invention, the message data of the message data receiving interface is read to obtain the message sent by the producer corresponding to the producer ID, so as to ensure smooth implementation of message interaction.
The embodiment of the invention ensures that the message data can be smoothly transmitted in the link without problems by packaging and packing the message according to the preset rule, and ensures the safety of message interaction.
Further, as an optional embodiment of the present invention, the encapsulating and packaging the message according to a preset rule includes:
appl adding is carried out on the header of the message to obtain a primary packaged message;
TCP addition is carried out on the header of the primary packaging message to obtain a secondary packaging message;
performing IP addition on the header of the secondary packaging message to obtain a tertiary packaging message;
and adding Ethernet to the header of the three-time encapsulated message to obtain a target encapsulated message, and completing the encapsulation and packaging of the message.
The embodiment of the invention ensures the safety of the message data by adding a series of protocol codes, address codes and the like in the message data header, thereby improving the safety of message interaction.
Fig. 3 is a schematic structural diagram of an electronic device implementing the message interaction method according to the present invention.
The electronic device may comprise a processor 10, a memory 11, a communication bus 12 and a communication interface 13, and may further comprise a computer program, such as a messenger program, stored in the memory 11 and executable on the processor 10.
The memory 11 includes at least one type of readable storage medium, which includes flash memory, removable hard disk, multimedia card, card-type memory (e.g., SD or DX memory, etc.), magnetic memory, magnetic disk, optical disk, etc. The memory 11 may in some embodiments be an internal storage unit of the electronic device, for example a removable hard disk of the electronic device. The memory 11 may also be an external storage device of the electronic device in other embodiments, such as a plug-in mobile hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the electronic device. Further, the memory 11 may also include both an internal storage unit and an external storage device of the electronic device. The memory 11 may be used not only to store application software installed in the electronic device and various types of data, such as codes of a message exchange program, etc., but also to temporarily store data that has been output or will be output.
The processor 10 may be composed of an integrated circuit in some embodiments, for example, a single packaged integrated circuit, or may be composed of a plurality of integrated circuits packaged with the same or different functions, including one or more Central Processing Units (CPUs), microprocessors, digital Processing chips, graphics processors, and combinations of various control chips. The processor 10 is a Control Unit (Control Unit) of the electronic device, connects various components of the whole electronic device by using various interfaces and lines, and executes various functions and processes data of the electronic device by running or executing programs or modules (e.g., a messenger program, etc.) stored in the memory 11 and calling data stored in the memory 11.
The communication bus 12 may be a PerIPheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. The communication bus 12 is arranged to enable connection communication between the memory 11 and at least one processor 10 or the like. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
Fig. 3 shows only an electronic device having components, and those skilled in the art will appreciate that the structure shown in fig. 3 does not constitute a limitation of the electronic device, and may include fewer or more components than those shown, or some components may be combined, or a different arrangement of components.
For example, although not shown, the electronic device may further include a power supply (such as a battery) for supplying power to each component, and preferably, the power supply may be logically connected to the at least one processor 10 through a power management device, so that functions of charge management, discharge management, power consumption management and the like are realized through the power management device. The power supply may also include any component of one or more dc or ac power sources, recharging devices, power failure detection circuitry, power converters or inverters, power status indicators, and the like. The electronic device may further include various sensors, a bluetooth module, a Wi-Fi module, and the like, which are not described herein again.
Optionally, the communication interface 13 may include a wired interface and/or a wireless interface (e.g., WI-FI interface, bluetooth interface, etc.), which is generally used to establish a communication connection between the electronic device and other electronic devices.
Optionally, the communication interface 13 may further include a user interface, which may be a Display (Display), an input unit (such as a Keyboard (Keyboard)), and optionally, a standard wired interface, or a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, or the like. The display, which may also be referred to as a display screen or display unit, is suitable, among other things, for displaying information processed in the electronic device and for displaying a visualized user interface.
It is to be understood that the described embodiments are for purposes of illustration only and that the scope of the appended claims is not limited to such structures.
The memory 11 in the electronic device stores a messaging program that is a combination of computer programs that, when executed in the processor 10, enable:
acquiring a subscription and release relationship between a producer and a consumer, and configuring a subscription configuration table and a release configuration table according to the subscription and release relationship and the consumer subscription information, wherein the subscription configuration table is connected with the release configuration table through an associated main key;
when a message interaction instruction is received, reading a consumer ID contained in the message interaction instruction;
inquiring the consumer configuration information with the switch field on in the subscription configuration table according to the consumer ID;
determining a primary key field in the subscription configuration table according to the consumer configuration information;
inquiring the producer ID with the switch field being on in the release configuration table by using the associated main keys in the subscription configuration table and the release configuration table according to the main key field in the subscription configuration table;
and receiving a message sent by a producer corresponding to the producer ID, and sending the message to a consumer of a platform subscribing the producer to publish the message.
Specifically, the processor 10 may refer to the description of the relevant steps in the embodiment corresponding to fig. 1 for a specific implementation method of the computer program, which is not described herein again.
Further, the electronic device integrated module/unit, if implemented in the form of a software functional unit and sold or used as a separate product, may be stored in a computer readable storage medium. The computer readable medium may be non-volatile or volatile. The computer-readable medium may include: any entity or device capable of carrying said computer program code, recording medium, U-disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM).
Embodiments of the present invention may also provide a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor of an electronic device, the computer program may implement:
acquiring a subscription and release relationship between a producer and a consumer, and configuring a subscription configuration table and a release configuration table according to the subscription and release relationship and the consumer subscription information, wherein the subscription configuration table is connected with the release configuration table through an associated main key;
when a message interaction instruction is received, reading a consumer ID contained in the message interaction instruction;
inquiring consumer configuration information with an open switch field in the subscription configuration table according to the consumer ID;
determining a primary key field in the subscription configuration table according to the consumer configuration information;
inquiring the producer ID with the switch field being on in the release configuration table by using the associated main keys in the subscription configuration table and the release configuration table according to the main key field in the subscription configuration table;
and receiving a message sent by a producer corresponding to the producer ID, and sending the message to a consumer of a platform subscribing the producer to publish the message.
Further, the computer usable storage medium may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function, and the like; the storage data area may store data created according to the use of the blockchain node, and the like.
In the embodiments provided in the present invention, it should be understood that the disclosed electronic device, apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is only one logical functional division, and other divisions may be realized in practice.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, functional modules in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional module.
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 signs in the claims shall not be construed as limiting the claim concerned.
The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
Furthermore, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. A plurality of units or means recited in the system claims may also be implemented by one unit or means in software or hardware. The terms second, etc. are used to denote names, but not any particular order.
Finally, it should be noted that the above embodiments are only for illustrating the technical solutions of the present invention and not for limiting, and although the present invention is described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications or equivalent substitutions may be made on the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.