CN111600790B - Block chain based message processing method, device, equipment and storage medium - Google Patents

Block chain based message processing method, device, equipment and storage medium Download PDF

Info

Publication number
CN111600790B
CN111600790B CN202010696590.1A CN202010696590A CN111600790B CN 111600790 B CN111600790 B CN 111600790B CN 202010696590 A CN202010696590 A CN 202010696590A CN 111600790 B CN111600790 B CN 111600790B
Authority
CN
China
Prior art keywords
message
message data
intelligent contract
message queue
queue
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.)
Active
Application number
CN202010696590.1A
Other languages
Chinese (zh)
Other versions
CN111600790A (en
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.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and 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 Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN202010696590.1A priority Critical patent/CN111600790B/en
Publication of CN111600790A publication Critical patent/CN111600790A/en
Application granted granted Critical
Publication of CN111600790B publication Critical patent/CN111600790B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/20Network architectures or network communication protocols for network security for managing network security; network security policies in general
    • 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/14Session management
    • H04L67/141Setup of application sessions

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Hardware Design (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The application discloses a block chain-based message processing method, a block chain-based message processing device, block chain-based message processing equipment and a block chain-based storage medium, relates to the technical field of block chains, and can be used for cloud computing and cloud services. The specific implementation scheme is as follows: writing the message data into a message queue intelligent contract; the message data is obtained from a message uplink transaction request initiated by a producer node based on the message queue intelligent contract; and calling the intelligent contract of the message queue and sending the message data to the consumer node. The method and the device can improve the reliability and the safety of the message data.

Description

Block chain based message processing method, device, equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method, an apparatus, a device, and a storage medium for processing a message based on a blockchain.
Background
The blockchain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism and an encryption algorithm. The block chain has the characteristics of decentralization, no tampering, trace remaining in the whole process, traceability, collective maintenance, openness and transparency and the like. The characteristics ensure the honesty and the transparency of the block chain and lay a foundation for creating trust for the block chain.
Disclosure of Invention
The disclosure provides a method, an apparatus, a device and a storage medium for block chain based message processing.
According to an aspect of the present disclosure, a method for processing a message based on a block chain is provided, including:
writing the message data into a message queue intelligent contract; the message data is obtained from a message uplink transaction request initiated by a producer node based on the message queue intelligent contract;
and calling the intelligent contract of the message queue and sending the message data to the consumer node.
According to another aspect of the present disclosure, a method for processing a message based on a block chain is provided, including:
establishing connection with the block link points;
receiving message data sent by the intelligent contract of message queue called by the block chain node;
wherein the message data is received from a producer node in advance and written into the message queue intelligent contract.
According to another aspect of the present disclosure, a method for processing a message based on a block chain is provided, including:
generating a message uplink transaction request comprising message data based on the message queue intelligent contract;
sending the uplink transaction request to a block node for instructing the block node to perform the following: writing the message data into the message queue intelligent contract; and sending the message data to the consumer node.
According to still another aspect of the present disclosure, there is provided a block chain-based message processing apparatus, including:
the message writing module is used for writing message data into the message queue intelligent contract; the message data is obtained from a message uplink transaction request initiated by a producer node based on the message queue intelligent contract;
and the message sending module is used for calling the message queue intelligent contract and sending the message data to the consumer node.
According to still another aspect of the present disclosure, there is provided a block chain-based message processing apparatus, including:
the connection establishing module is used for establishing connection with the block link points;
the message receiving module is used for receiving message data sent by the intelligent contract of the message queue called by the block chain node;
wherein the message data is received from a producer node in advance and written into the message queue intelligent contract.
According to still another aspect of the present disclosure, there is provided a block chain-based message processing apparatus, including:
the request generating module is used for generating a message uplink transaction request comprising message data based on the message queue intelligent contract;
a request sending module, configured to send the uplink transaction request to the block node, and instruct the block node to perform the following steps: writing the message data into the message queue intelligent contract; and sending the message data to the consumer node.
According to a seventh aspect, there is provided an electronic device comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform a blockchain based message processing method according to any one of the embodiments of the present application.
According to an eighth aspect, there is provided a non-transitory computer readable storage medium having stored thereon computer instructions for causing a computer to execute the blockchain based message processing method according to any one of the embodiments of the present application.
According to the technology of the application, the reliability and the safety of the message data can be improved.
It should be understood that the statements in this section do not necessarily identify key or critical features of the embodiments of the present disclosure, nor do they limit the scope of the present disclosure. Other features of the present disclosure will become apparent from the following description.
Drawings
The drawings are included to provide a better understanding of the present solution and are not intended to limit the present application. Wherein:
fig. 1a is a schematic flowchart of a method for processing a message based on a blockchain according to an embodiment of the present application;
fig. 1b is a schematic structural diagram of a block chain based message processing system according to an embodiment of the present application;
fig. 2 is a schematic flowchart of another block chain-based message processing method according to an embodiment of the present application;
fig. 3 is a schematic flowchart of another method for processing a message based on a blockchain according to an embodiment of the present application;
fig. 4 is a schematic flowchart of another method for processing a message based on a blockchain according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of a block chain-based message processing apparatus according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of another block chain based message processing apparatus provided in an embodiment of the present application;
fig. 7 is a schematic structural diagram of another block chain-based message processing apparatus according to an embodiment of the present application;
fig. 8 is a block diagram of an electronic device for implementing a block chain based message processing method according to an embodiment of the present application.
Detailed Description
The following description of the exemplary embodiments of the present application, taken in conjunction with the accompanying drawings, includes various details of the embodiments of the application for the understanding of the same, which are to be considered exemplary only. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present application. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Fig. 1a is a schematic flowchart of a block chain-based message processing method according to an embodiment of the present application. The present embodiment is applicable to the case where message data is provided to different parties. The method for processing a message based on a blockchain disclosed in this embodiment may be executed by an electronic device, and specifically may be executed by a device for processing a message based on a blockchain, where the device may be implemented by software and/or hardware, and is configured in an electronic device, and the electronic device may be a blockchain node. Referring to fig. 1a, the method for processing a message based on a block chain according to this embodiment includes:
s110, writing message data into a message queue intelligent contract; wherein the message data is obtained from a message uplink transaction request initiated by a producer node based on the message queue intelligent contract.
In the embodiment of the application, the message queue logic can be realized by a message queue intelligent contract deployed in a block chain network. Producer and consumer interfaces of a message queue may be implemented via a message queue intelligence contract, and a blockchain used to store original message data and a write set of the message queue intelligence contract used to store index information for the message data may be mated as a container of messages (i.e., the message queue). The decentralized message queue is realized through a block chain, the bottom message queue is stored by adopting the block chain, the message storage mode can be a transaction description field or an intelligent contract, and the reliability and the safety of the message queue data under the condition that a plurality of participants exist can be ensured.
The producer node initiates a message uplink transaction request carrying message data based on a producer interface provided by the message queue intelligent contract, the block chain link node writes the message data into a block chain in response to the message uplink transaction request, invokes the message queue intelligent contract to sequence the message data, constructs index information of the message data, and writes the index information of the message data into a write set of the message queue intelligent contract according to a sequencing result of the message data. Successful message data uplink indicates successful message distribution. Long or short connections may be maintained between the producer nodes and the blockchain nodes.
In an alternative embodiment, S110 includes: sequencing the message data according to a fixed field or the receiving time of the uplink transaction request of the message; and writing the message data into the message queue of the message queue intelligent contract according to the sequencing result.
The fixed field may be an Identification (ID) field of the producer, and the message data may be sorted in ascending order of the ID of the producer. The fixed fields may be predetermined by the message queue intelligent contract producer. The fixed field can be adjusted through intelligent contract upgrading, it needs to be stated that consensus needs to be achieved for intelligent contract upgrading, for example, if the fixed field needs to be adjusted, an intelligent contract voting proposal can be initiated, and whether upgrading is successful or not is determined according to the voting result of the block chain network. The message queue intelligence contract may also order message data according to the time of receipt of the uplink transaction request in the message. The intelligent contract of the message queue can support the multidimensional message organization, and improves the universality of the message queue, namely the application range of the message queue.
And S120, calling the intelligent contract of the message queue, and sending the message data to the consumer node.
Wherein the consumer node subscribes to messages from the blockchain. The message queue intelligence contract may send message data to the consumer node in either a push mode or a pull mode.
Fig. 1b is a schematic structural diagram of a block chain-based message processing system according to an embodiment of the present application, and referring to fig. 1b, a producer writes message data into a message queue intelligent contract of a block chain by a transaction request, that is, the producer publishes a message to a topic, and a consumer subscribes to the topic in advance, so that a message of the topic can be received. It should be noted that the producer node and the consumer node may establish a connection with a block link point through a message queue SDK (Software Development Kit) or a message queue HTTP (hypertext Transfer Protocol) interface, and may select a long connection or a short connection. It should be noted that the blockchain network may further include a third-party monitoring node, which is used to further enhance the reliability of the message data in the blockchain.
According to the technical scheme of the embodiment of the application, the realized message queue has a decentralized characteristic, and data passing through the message queue middleware under the condition of multiple participants can be guaranteed to be safe and credible and not controlled by a centralized node through block chain consensus. Moreover, the non-tampering property of the block chain can ensure that the message is permanently effective and traceable once issued. Compared with a centralized message queue, the method has better safety and credibility.
Fig. 2 is a schematic flowchart of a method for processing a message based on a blockchain according to an embodiment of the present disclosure. The present embodiment is an alternative proposed on the basis of the above-described embodiments. Referring to fig. 2, the method for processing a message based on a block chain according to this embodiment includes:
s210, writing message data into a message queue intelligent contract; wherein the message data is obtained from a message uplink transaction request initiated by a producer node based on the message queue intelligent contract.
The problem of multi-party participation in the message queue can be solved by adopting a Byzantine type consensus algorithm.
And S220, calling the intelligent contract of the message queue to acquire the message filtering condition specified by the consumer.
The message queue intelligent contract is registered with a filter, and the consumer node can specify a message filtering condition, that is, specify a logical relationship that a relevant field needs to satisfy, for example, a value of the relevant field is equal to, greater than or less than a certain value, or the relevant field includes fixed information. Taking the second killing activity realized by the message queue as an example, the consumer can specify that the number of times of the historical second killing participation of the message producer is less than 3, or can specify that the region information of the message producer is a certain fixed city.
And S230, determining the message data meeting the message filtering condition.
And filtering the message data in the message queue through a filter according to the message filtering condition to obtain the message data meeting the filtering condition. That is, message filtering is implemented by message queue services running on block link points.
S240, sending the determined message data to the consumer node.
Specifically, the message data satisfying the filtering condition is sequentially sent to the consumers according to the message primary sorting information, such as the message primary sorting ID.
The message queue intelligent contract filters the message data by providing a filter support, thereby providing the message data meeting the filtering condition for the consumer and further enriching the functions of the message queue.
In an alternative embodiment, the message data is sent to the consumer node by: calling the intelligent contract of the message queue to obtain a subject subscribed by a consumer; determining message data belonging to the topic; sending the determined message data to the consumer node. Specifically, the consumer may also specify a topic, and the message queue intelligence contract pushes message data of the specified topic to the consumer, that is, the message queue intelligence contract also supports a publish/subscribe topic messaging model in which a message producer publishes a message to a specific message topic, and only message subscribers interested in the message topic and in an active state or message subscribers establishing a persistent subscription may receive the published message.
In an alternative embodiment, the message data is sent to the consumer node by: calling the intelligent contract of the message queue to acquire message main sequencing information specified by a consumer; and sending the message data to the consumer node according to the message main sequencing information.
The message master sequencing may refer to a master key (key) of the message sequencing, the message master sequencing information may be a message master sequencing ID, the message master sequencing ID and the message may be in one-to-one correspondence, that is, one message master sequencing ID corresponds to unique message data, and one message data has a unique message master sequencing ID. The master message sort ID may be associated with a block ID and a transaction ID (transaction ID), i.e., the height of the block to which the message belongs and the transaction order of the message in the block (i.e., transaction offset value).
Specifically, in the push mode, the consumer may specify the initial message master ordering information, that is, push from the message data associated with the initial message master ordering information, if no specified message master ordering information is able to push from the latest block, the block nodes traverse the messages in all the transaction requests after the initial transaction request starts, and send the eligible messages to the consumer. In pull mode, the consumer actively pulls messages from the block chain nodes, and the consumer needs to specify the master ordering information to be sent. It should be noted that the pull mode supports the consumer to obtain multiple messages in batch. By the consumer specifying the message master sequencing information, messages can be sent to the consumer according to the consumer's needs.
In an optional embodiment, after sending the message data to the consumer node, the method further comprises: and if the message data is in the message pushing mode, writing the pushing state of the message data into a block chain for keeping the global consistency of message data pushing.
Specifically, after the blockchain node pushes the message data to the consumer node in the push mode, the method further includes: and writing the pushing state of the message data into the blockchain, so that the nodes in the blockchain network can synchronize the pushing state of the message data based on consensus, thereby maintaining the global consistency of message data pushing. In addition, the consumer can also inquire the pushing state of the message from the block chain, and determine the subsequent message main sequencing information according to the inquiry result.
According to the technical scheme of the embodiment of the application, the decentralized message queue is realized based on the block chain, the message filtering function and the topic message delivery publishing/subscribing model can be supported, the message can be pushed according to the requirement of a consumer through the message main sequencing information, the global consistency of the message pushing state can be kept, and the reliability of the message queue is further improved.
Fig. 3 is a flowchart illustrating a block chain based message processing method according to an embodiment of the present application. The present embodiment is applicable to the case where message data is provided to different parties. The method for processing a message based on a blockchain disclosed in this embodiment may be executed by an electronic device, and specifically may be executed by a device for processing a message based on a blockchain, where the device may be implemented by software and/or hardware, and is configured in an electronic device, and the electronic device may be a consumer node. Referring to fig. 3, the method for processing a message based on a block chain according to this embodiment includes:
and S310, establishing connection with the block link points.
The consumer node may establish a connection with the block link point through a message queue SDK (Software Development Kit) or a message queue HTTP (Hyper Text Transfer Protocol) interface, and may select a long connection or a short connection.
And S320, receiving message data sent by the intelligent contract of the message queue called by the block chain node.
Wherein the message data is received from a producer node in advance and written into the message queue intelligent contract. The block chain network is maintained with a message queue in advance based on a message queue intelligent contract, and the message queue intelligent contract responds to a message uplink transaction request initiated by a producer and writes message data into the intelligent contract. And the block chain node also calls a message queue intelligent contract and sends message data to the consumer node according to the demand of the consumer. Because the message data is written into the intelligent contract, the reliability of the message data is ensured.
In an alternative embodiment, S320 further includes, before: and sending a topic subscribed by a consumer to the blockchain node for instructing the blockchain node to determine the message data belonging to the topic.
Specifically, a consumer may specify a topic and a message queue smart contract pushes message data specifying the topic to the consumer, i.e., a message queue smart contract supports a publish/subscribe topic messaging model in which a message producer publishes a message to a specific message topic, and only message subscribers interested in the message topic and in an active state or message subscribers establishing a persistent subscription may receive the published message.
In an alternative embodiment, S320 further includes, before: sending a consumer specified message filtering condition to the blockchain node for instructing the blockchain node to determine message data satisfying the message filtering condition.
The intelligent contract of the message queue filters the message data in the message queue according to the message filtering condition specified by the consumer by providing a filter to obtain the message data meeting the filtering condition.
In an alternative embodiment, S320 further includes, before: and sending message main sequencing information appointed by a consumer to the blockchain node, wherein the message main sequencing information is used for indicating the blockchain node to send message data to the consumer node according to the message main sequencing information.
Specifically, in the push mode, the consumer may specify the initial message master ordering information, that is, push from the message data associated with the initial message master ordering information, and may start to push from the newest tile if no message master ordering information is specified. In pull mode, the consumer needs to specify the main ordering information to be sent. By the consumer specifying the message master sequencing information, messages can be sent to the consumer according to the consumer's needs.
According to the technical scheme of the embodiment of the application, the realized message queue has a decentralized characteristic, and data passing through the message queue middleware under the condition of multiple participants can be guaranteed to be safe and credible and not controlled by a centralized node through block chain consensus. Moreover, the non-tampering property of the block chain can ensure that the message is permanently effective and traceable once issued. Compared with a centralized message queue, the method has better safety and credibility.
Fig. 4 is a flowchart illustrating a block chain based message processing method according to an embodiment of the present application. The present embodiment is applicable to the case where message data is provided to different parties. The blockchain-based message processing method disclosed in this embodiment may be executed by an electronic device, and in particular, may be executed by a blockchain-based message processing apparatus, where the apparatus may be implemented by software and/or hardware, and is configured in the electronic device, and the electronic device may be a producer node. Referring to fig. 4, the method for processing a message based on a block chain according to this embodiment includes:
s410, based on the intelligent contract of the message queue, a message uplink transaction request comprising message data is generated.
Specifically, the producer node initiates a message uplink transaction request carrying message data based on a producer interface provided by a message queue intelligent contract.
S420, sending the uplink transaction request to the block node, for instructing the block node to execute the following steps: writing the message data into the message queue intelligent contract; and sending the message data to the consumer node.
And the block chain link point writes the message data into the block chain in response to the message uplink transaction request, invokes a message queue intelligent contract to sequence the message data, constructs index information of the message data, and writes the index information of the message data into a write set of the message queue intelligent contract according to a sequencing result of the message data. Successful message data uplink indicates successful message distribution. Long or short connections may be maintained between the producer nodes and the blockchain nodes. The message queue intelligence contract can also send message data to the consumer after the message is published successfully.
According to the technical scheme of the embodiment of the application, the producer node releases the message through the decentralized message queue realized by the block chain, and the message released through the message queue under the condition of multiple participants can be ensured to be safe and credible based on the block chain consensus. And the message queue realized based on the block chain can ensure that the message is permanently effective and traceable once issued.
Fig. 5 is a schematic structural diagram of a message processing apparatus based on a block chain according to an embodiment of the present application. Referring to fig. 5, a block chain based message processing apparatus 500 provided in an embodiment of the present application may include:
a message writing module 501, configured to write message data into a message queue intelligent contract; the message data is obtained from a message uplink transaction request initiated by a producer node based on the message queue intelligent contract;
and the message sending module 502 is configured to invoke the message queue intelligent contract and send the message data to the consumer node.
In an optional implementation, the message writing module 501 includes:
a message ordering unit, configured to order the message data according to a fixed field or a receiving time of the uplink transaction request;
and the message writing unit is used for writing the message data into the message queue of the message queue intelligent contract according to the sequencing result.
In an optional implementation, the message sending module 503 includes:
the theme obtaining unit is used for calling the message queue intelligent contract and obtaining a theme subscribed by a consumer;
a message determining unit for determining message data belonging to the subject;
a first message sending unit, configured to send the determined message data to the consumer node.
In an optional implementation, the message sending module 503 includes:
the filtering condition unit is used for calling the message queue intelligent contract and acquiring a message filtering condition specified by a consumer;
the message filtering unit is used for determining message data meeting the message filtering condition;
a second message sending unit, configured to send the determined message data to the consumer node.
In an optional implementation, the message sending module 503 includes:
the main ordering obtaining unit is used for calling the message queue intelligent contract and obtaining message main ordering information appointed by a consumer;
and the third message sending unit is used for sending the message data to the consumer node according to the message main sequencing information.
In an alternative embodiment, the apparatus further comprises:
and the pushing state synchronization module is used for writing the pushing state of the message data into a block chain if the message data is in a message pushing mode, and is used for keeping the global consistency of message data pushing.
According to the technical scheme of the embodiment of the application, the realized message queue has a decentralized characteristic, and data passing through the message queue middleware under the condition of multiple participants can be guaranteed to be safe and credible and not controlled by a centralized node through block chain consensus. Moreover, the non-tampering property of the block chain can ensure that the message is permanently effective and traceable once issued. Compared with a centralized message queue, the method has better safety and credibility.
Fig. 6 is a schematic structural diagram of a message processing apparatus based on a block chain according to an embodiment of the present application. Referring to fig. 6, a block chain based message processing apparatus 600 provided in an embodiment of the present application may include:
a connection establishing module 601, configured to establish a connection with a block link point;
a message receiving module 602, configured to receive message data sent by the block chain node invoking a message queue intelligent contract;
wherein the message data is received from a producer node in advance and written into the message queue intelligent contract.
In an alternative embodiment, the apparatus further comprises:
and the theme sending module is used for sending a theme subscribed by a consumer to the blockchain node and indicating the blockchain node to determine the message data belonging to the theme.
In an alternative embodiment, the apparatus further comprises:
and the filtering condition sending module is used for sending a message filtering condition specified by a consumer to the block chain node and indicating the block chain node to determine the message data meeting the message filtering condition.
In an alternative embodiment, the apparatus further comprises:
and the master sequencing sending module is used for sending message master sequencing information appointed by a consumer to the block chain nodes and indicating the block chain nodes to send message data to the consumer nodes according to the message master sequencing information.
According to the technical scheme of the embodiment of the application, the realized message queue has a decentralized characteristic, and data passing through the message queue middleware under the condition of multiple participants can be guaranteed to be safe and credible and not controlled by a centralized node through block chain consensus. Moreover, the non-tampering property of the block chain can ensure that the message is permanently effective and traceable once issued. Compared with a centralized message queue, the method has better safety and credibility.
Fig. 7 is a schematic structural diagram of a message processing apparatus based on a block chain according to an embodiment of the present application. Referring to fig. 7, a block chain based message processing apparatus 700 provided in an embodiment of the present application may include:
a request generating module 701, configured to generate a message uplink transaction request including message data based on a message queue intelligent contract;
a request sending module 702, configured to send the uplink transaction request to a block node, and instruct the block node to perform the following steps: writing the message data into the message queue intelligent contract; and sending the message data to the consumer node.
According to the technical scheme of the embodiment of the application, the realized message queue has a decentralized characteristic, and data passing through the message queue middleware under the condition of multiple participants can be guaranteed to be safe and credible and not controlled by a centralized node through block chain consensus. Moreover, the non-tampering property of the block chain can ensure that the message is permanently effective and traceable once issued. Compared with a centralized message queue, the method has better safety and credibility.
Fig. 8 is a block diagram of an electronic device according to an embodiment of the present application, illustrating a method for processing a message based on a block chain. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the present application that are described and/or claimed herein.
As shown in fig. 8, the electronic apparatus includes: one or more processors 801, memory 802, and interfaces for connecting the various components, including a high speed interface and a low speed interface. The various components are interconnected using different buses and may be mounted on a common motherboard or in other manners as desired. The processor may process instructions for execution within the electronic device, including instructions stored in or on the memory to display graphical information of a GUI on an external input/output apparatus (such as a display device coupled to the interface). In other embodiments, multiple processors and/or multiple buses may be used, along with multiple memories and multiple memories, as desired. Also, multiple electronic devices may be connected, with each device providing portions of the necessary operations (e.g., as a server array, a group of blade servers, or a multi-processor system). Fig. 8 illustrates an example of a processor 801.
The memory 802 is a non-transitory computer readable storage medium as provided herein. Wherein the memory stores instructions executable by at least one processor to cause the at least one processor to perform the method for blockchain based message processing provided herein. The non-transitory computer readable storage medium of the present application stores computer instructions for causing a computer to perform the method of blockchain based message processing provided herein.
The memory 802 is a non-transitory computer readable storage medium, and can be used to store non-transitory software programs, non-transitory computer executable programs, and modules, such as program instructions/modules corresponding to the method for processing a blockchain-based message in the embodiments of the present application (for example, the message writing module 501 and the message sending module 502 shown in fig. 5, the connection establishing module 601 and the message receiving module 602 shown in fig. 6, and the request generating module 701 and the request sending module 702 shown in fig. 7). The processor 801 executes various functional applications of the server and blockchain-based message processing, i.e., a method of implementing blockchain-based message processing in the above-described method embodiments, by running non-transitory software programs, instructions, and modules stored in the memory 802.
The memory 802 may 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; the storage data area may store data created from use of the electronic device based on message processing of the block chain, and the like. Further, the memory 802 may include high-speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid state storage device. In some embodiments, the memory 802 optionally includes memory located remotely from the processor 801, which may be connected to blockchain based message processing electronics over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The electronic device of the method for processing a message based on a blockchain may further include: an input device 803 and an output device 804. The processor 801, the memory 802, the input device 803, and the output device 804 may be connected by a bus or other means, and are exemplified by a bus in fig. 8.
The input device 803 may receive input numeric or character information and generate key signal inputs related to user settings and function control of the electronic device based on the blockchain message processing, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, a pointer, one or more mouse buttons, a track ball, a joystick, or other input devices. The output devices 804 may include a display device, auxiliary lighting devices (e.g., LEDs), and haptic feedback devices (e.g., vibrating motors), among others. The display device may include, but is not limited to, a Liquid Crystal Display (LCD), a Light Emitting Diode (LED) display, and a plasma display. In some implementations, the display device can be a touch screen.
Various implementations of the systems and techniques described here can be realized in digital electronic circuitry, integrated circuitry, application specific ASICs (application specific integrated circuits), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
These computer programs (also known as programs, software applications, or code) include machine instructions for a programmable processor, and may be implemented using high-level procedural and/or object-oriented programming languages, and/or assembly/machine languages. As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, apparatus, and/or device (e.g., magnetic discs, optical disks, memory, Programmable Logic Devices (PLDs)) used to provide machine instructions and/or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal used to provide machine instructions and/or data to a programmable processor.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), Wide Area Networks (WANs), blockchain networks, and the internet.
The computer system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other.
According to the technical scheme of the embodiment of the application, the realized message queue has a decentralized characteristic, and data passing through the message queue middleware under the condition of multiple participants can be guaranteed to be safe and credible and not controlled by a centralized node through block chain consensus. Moreover, the non-tampering property of the block chain can ensure that the message is permanently effective and traceable once issued. Compared with a centralized message queue, the method has better safety and credibility.
The above-described embodiments should not be construed as limiting the scope of the present application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims (22)

1. The message processing method based on the block chain comprises the following steps:
writing the message data into a message queue intelligent contract; the message data is obtained from a message uplink transaction request initiated by a producer node based on the message queue intelligent contract;
calling the intelligent contract of the message queue, and sending message data in the message queue to the consumer node;
if the message data is in the message pushing mode, writing the pushing state of the message data into a block chain for keeping the global consistency of message data pushing;
the intelligent contract of the message queue realizes a producer interface and a consumer interface of the message queue, and a block chain is matched with a writing set of the intelligent contract of the message queue to be used as the message queue.
2. The method of claim 1, wherein the writing message data into a message queue intelligence contract comprises:
sequencing the message data according to a fixed field or the receiving time of the uplink transaction request of the message;
and writing the message data into the message queue of the message queue intelligent contract according to the sequencing result.
3. The method of claim 1, wherein said invoking the message queue smart contract to send the message data to a consumer node comprises:
calling the intelligent contract of the message queue to obtain a subject subscribed by a consumer;
determining message data belonging to the topic;
sending the determined message data to the consumer node.
4. The method of claim 1, wherein said invoking the message queue smart contract to send the message data to a consumer node comprises:
calling the intelligent contract of the message queue to obtain a message filtering condition specified by a consumer;
determining message data meeting the message filtering condition;
sending the determined message data to the consumer node.
5. The method of claim 1, wherein said invoking the message queue smart contract to send the message data to a consumer node comprises:
calling the intelligent contract of the message queue to acquire message main sequencing information specified by a consumer;
and sending the message data to the consumer node according to the message main sequencing information.
6. The message processing method based on the block chain comprises the following steps:
establishing connection with the block link points;
receiving message data in a message queue sent by the intelligent contract for calling the message queue by the block chain node; the intelligent contract of the message queue realizes a producer interface and a consumer interface of the message queue, and a block chain is matched with a writing set of the intelligent contract of the message queue to be used as the message queue;
if the message data is in the message pushing mode, determining the pushing state of the message data, writing the pushing state of the message data into a block chain, and keeping the global consistency of message data pushing;
wherein the message data is received from a producer node in advance and written into the message queue intelligent contract.
7. The method of claim 6, receiving the blockchain node invoking a message queue intelligence contract, and prior to the transmitted message data, further comprising:
and sending a topic subscribed by a consumer to the blockchain node for instructing the blockchain node to determine the message data belonging to the topic.
8. The method of claim 6, receiving the blockchain node invoking a message queue intelligence contract, and prior to the transmitted message data, further comprising:
sending a consumer specified message filtering condition to the blockchain node for instructing the blockchain node to determine message data satisfying the message filtering condition.
9. The method of claim 6, receiving the blockchain node invoking a message queue intelligence contract, and prior to the transmitted message data, further comprising:
and sending message main sequencing information appointed by a consumer to the blockchain node, wherein the message main sequencing information is used for indicating the blockchain node to send message data to the consumer node according to the message main sequencing information.
10. The message processing method based on the block chain comprises the following steps:
generating a message uplink transaction request comprising message data based on the message queue intelligent contract;
sending the uplink transaction request to a block node for instructing the block node to perform the following: writing the message data into the message queue intelligent contract; and sending the message data in the message queue to the consumer node; if the message data is in the message pushing mode, writing the pushing state of the message data into a block chain for keeping the global consistency of message data pushing;
the intelligent contract of the message queue realizes a producer interface and a consumer interface of the message queue, and a block chain is matched with a writing set of the intelligent contract of the message queue to be used as the message queue.
11. A blockchain-based message processing apparatus, comprising:
the message writing module is used for writing message data into the message queue intelligent contract; the message data is obtained from a message uplink transaction request initiated by a producer node based on the message queue intelligent contract;
the message sending module is used for calling the message queue intelligent contract and sending message data in the message queue to the consumer node;
the push state synchronization module is used for writing the push state of the message data into a block chain if the message data is in a message push mode, and is used for keeping the global consistency of message data push;
the intelligent contract of the message queue realizes a producer interface and a consumer interface of the message queue, and a block chain is matched with a writing set of the intelligent contract of the message queue to be used as the message queue.
12. The apparatus of claim 11, wherein the message write module comprises:
a message ordering unit, configured to order the message data according to a fixed field or a receiving time of the uplink transaction request;
and the message writing unit is used for writing the message data into the message queue of the message queue intelligent contract according to the sequencing result.
13. The apparatus of claim 11, wherein the messaging module comprises:
the theme obtaining unit is used for calling the message queue intelligent contract and obtaining a theme subscribed by a consumer;
a message determining unit for determining message data belonging to the subject;
a first message sending unit, configured to send the determined message data to the consumer node.
14. The apparatus of claim 11, wherein the messaging module comprises:
the filtering condition unit is used for calling the message queue intelligent contract and acquiring a message filtering condition specified by a consumer;
the message filtering unit is used for determining message data meeting the message filtering condition;
a second message sending unit, configured to send the determined message data to the consumer node.
15. The apparatus of claim 11, wherein the messaging module comprises:
the main ordering obtaining unit is used for calling the message queue intelligent contract and obtaining message main ordering information appointed by a consumer;
and the third message sending unit is used for sending the message data to the consumer node according to the message main sequencing information.
16. A blockchain-based message processing apparatus, comprising:
the connection establishing module is used for establishing connection with the block link points;
the message receiving module is used for receiving message data in a message queue sent by the intelligent contract of the message queue called by the block chain node; the intelligent contract of the message queue realizes a producer interface and a consumer interface of the message queue, and a block chain is matched with a writing set of the intelligent contract of the message queue to be used as the message queue;
the push state module is used for determining the push state of the message data if the message data is in a message push mode, writing the push state of the message data into a block chain and keeping the global consistency of message data push;
wherein the message data is received from a producer node in advance and written into the message queue intelligent contract.
17. The apparatus of claim 16, the apparatus further comprising:
and the theme sending module is used for sending a theme subscribed by a consumer to the blockchain node and indicating the blockchain node to determine the message data belonging to the theme.
18. The apparatus of claim 16, the apparatus further comprising:
and the filtering condition sending module is used for sending a message filtering condition specified by a consumer to the block chain node and indicating the block chain node to determine the message data meeting the message filtering condition.
19. The apparatus of claim 16, the apparatus further comprising:
and the master sequencing sending module is used for sending message master sequencing information appointed by a consumer to the block chain nodes and indicating the block chain nodes to send message data to the consumer nodes according to the message master sequencing information.
20. A blockchain-based message processing apparatus, comprising:
the request generating module is used for generating a message uplink transaction request comprising message data based on the message queue intelligent contract;
a request sending module, configured to send the uplink transaction request to the block node, and instruct the block node to perform the following steps: writing the message data into the message queue intelligent contract; and sending the message data in the message queue to the consumer node; if the message data is in the message pushing mode, writing the pushing state of the message data into a block chain for keeping the global consistency of message data pushing;
the intelligent contract of the message queue realizes a producer interface and a consumer interface of the message queue, and a block chain is matched with a writing set of the intelligent contract of the message queue to be used as the message queue.
21. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-10.
22. A non-transitory computer readable storage medium having stored thereon computer instructions for causing the computer to perform the method of any one of claims 1-10.
CN202010696590.1A 2020-07-20 2020-07-20 Block chain based message processing method, device, equipment and storage medium Active CN111600790B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010696590.1A CN111600790B (en) 2020-07-20 2020-07-20 Block chain based message processing method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010696590.1A CN111600790B (en) 2020-07-20 2020-07-20 Block chain based message processing method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111600790A CN111600790A (en) 2020-08-28
CN111600790B true CN111600790B (en) 2021-08-17

Family

ID=72190245

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010696590.1A Active CN111600790B (en) 2020-07-20 2020-07-20 Block chain based message processing method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111600790B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112565173B (en) * 2020-09-04 2023-04-07 北京京东振世信息技术有限公司 Method and apparatus for message processing
CN113837880A (en) * 2021-09-14 2021-12-24 杭州链城数字科技有限公司 Data transaction method and device and electronic equipment
CN114390097A (en) * 2022-01-10 2022-04-22 北京新华夏信息技术有限公司 Block chain operation method and system based on message queue and application thereof

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109005208A (en) * 2018-06-11 2018-12-14 北京京东尚科信息技术有限公司 Method and apparatus for pushed information
CN110602125A (en) * 2019-09-23 2019-12-20 腾讯科技(深圳)有限公司 Data processing method, device, terminal and storage medium
CN110827042A (en) * 2019-11-12 2020-02-21 北京芯际科技有限公司 Wine source tracing and evidence storing solution system and method based on block chain
CN110852765A (en) * 2019-11-20 2020-02-28 山东爱城市网信息技术有限公司 Cross-border e-commerce imported food tracing method and system based on block chain
CN110910148A (en) * 2019-10-11 2020-03-24 北京海益同展信息科技有限公司 Block chain-based article authentication method and device and storage medium
CN111008844A (en) * 2019-11-21 2020-04-14 山东爱城市网信息技术有限公司 Block chain-based drug tracing method, device and medium
CN111159300A (en) * 2019-12-31 2020-05-15 中国银行股份有限公司 Data processing method and device based on block chain

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11362805B2 (en) * 2018-11-01 2022-06-14 International Business Machines Corporation Database encryption layer
US11178151B2 (en) * 2018-12-19 2021-11-16 International Business Machines Corporation Decentralized database identity management system

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109005208A (en) * 2018-06-11 2018-12-14 北京京东尚科信息技术有限公司 Method and apparatus for pushed information
CN110602125A (en) * 2019-09-23 2019-12-20 腾讯科技(深圳)有限公司 Data processing method, device, terminal and storage medium
CN110910148A (en) * 2019-10-11 2020-03-24 北京海益同展信息科技有限公司 Block chain-based article authentication method and device and storage medium
CN110827042A (en) * 2019-11-12 2020-02-21 北京芯际科技有限公司 Wine source tracing and evidence storing solution system and method based on block chain
CN110852765A (en) * 2019-11-20 2020-02-28 山东爱城市网信息技术有限公司 Cross-border e-commerce imported food tracing method and system based on block chain
CN111008844A (en) * 2019-11-21 2020-04-14 山东爱城市网信息技术有限公司 Block chain-based drug tracing method, device and medium
CN111159300A (en) * 2019-12-31 2020-05-15 中国银行股份有限公司 Data processing method and device based on block chain

Also Published As

Publication number Publication date
CN111600790A (en) 2020-08-28

Similar Documents

Publication Publication Date Title
CN111600790B (en) Block chain based message processing method, device, equipment and storage medium
CN109815028B (en) System, method, apparatus and computer storage medium for data synchronization
US9344395B2 (en) Subscription groups in publish-subscribe system
US20210092195A1 (en) Information push method and device
CN111711663A (en) Processing method and device for publishing and subscribing services and electronic equipment
CN111669438B (en) Live broadcast message transmission method and device, electronic equipment and medium
CN111694646A (en) Resource scheduling method and device, electronic equipment and computer readable storage medium
CN109245908B (en) Method and device for switching master cluster and slave cluster
CN111090691B (en) Data processing method and device, electronic equipment and storage medium
CN111782365A (en) Timed task processing method, device, equipment and storage medium
CN111510480B (en) Request sending method and device and first server
EP3816802A2 (en) Method and device for processing mini program data
CN102981911A (en) Distributed message handling system and device and method thereof
JP7114772B2 (en) Certificate sending method, certificate receiving method, cloud and terminal equipment
CN111610972A (en) Page generation method, device, equipment and storage medium
CN112069137B (en) Method, device, electronic equipment and computer readable storage medium for generating information
US10841363B2 (en) Streaming API subscription without loss of events
CN105187935A (en) Method and device for displaying application information
CN115658656A (en) Information processing method, device, electronic equipment and storage medium
CN111273950B (en) Application awakening method and device, electronic equipment and computer readable storage medium
CN113051511A (en) Page message distribution method, device, equipment and storage medium
US10305824B2 (en) Dynamic hierarchy based message distribution
CN111787131A (en) ID generation method and electronic device
CN118041887A (en) Message processing method and device, storage medium and electronic equipment
CN116610652A (en) Information migration method, information generation method, information migration program, and information migration program apparatus, device and readable 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
GR01 Patent grant
GR01 Patent grant