CN116016653A - Information pushing method and device of blockchain, electronic equipment and storage medium - Google Patents

Information pushing method and device of blockchain, electronic equipment and storage medium Download PDF

Info

Publication number
CN116016653A
CN116016653A CN202211551484.XA CN202211551484A CN116016653A CN 116016653 A CN116016653 A CN 116016653A CN 202211551484 A CN202211551484 A CN 202211551484A CN 116016653 A CN116016653 A CN 116016653A
Authority
CN
China
Prior art keywords
information
message queue
pushed
subscription
block
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211551484.XA
Other languages
Chinese (zh)
Inventor
黄方蕾
邱炜伟
刘明美
胡麦芳
尚璇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Qulian Technology Co Ltd
Original Assignee
Hangzhou Qulian 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 Hangzhou Qulian Technology Co Ltd filed Critical Hangzhou Qulian Technology Co Ltd
Priority to CN202211551484.XA priority Critical patent/CN116016653A/en
Publication of CN116016653A publication Critical patent/CN116016653A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application relates to the technical field of blockchain, and provides a blockchain information pushing method, a blockchain information pushing device, electronic equipment and a storage medium. The method comprises the following steps: when the generated new block is detected, reading all registered subscription information; determining message queues of information to be pushed according to the message queue names contained in each subscription information; determining information to be pushed according to the new area block; pushing the information to be pushed to each message queue. By means of the arrangement, the business system only needs to register subscription information to the blockchain node according to actual needs, when the blockchain node detects that the blockchain generates a new block, the blockchain node can find a corresponding message queue through the message queue name recorded in the subscription information, and then the block information is pushed to the business system through the message queue. Because the blockchain node can only carry out the information pushing operation when detecting the generation of a new block, useless requests can not be generated in the whole process, and the consumption of system resources can be reduced.

Description

Information pushing method and device of blockchain, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of blockchain technologies, and in particular, to a blockchain information pushing method, device, electronic apparatus, and storage medium.
Background
The blockchain has the characteristics of consistent data, difficulty in tampering, traceability of the data and the like, and is widely applied to various industries. At present, when a service system needs to acquire block information in a block chain, corresponding block information can be generally queried from a block chain link point in a middleware polling mode, the middleware can package the queried block information, then the packaged block information is put into a message queue, and finally the block information is pushed to the service system through the message queue. However, if the block chain length does not generate a block, most of the requests issued by the middleware polling process described above are useless requests, resulting in meaningless system resource consumption.
Disclosure of Invention
In view of this, the embodiments of the present application provide a method, an apparatus, an electronic device, and a storage medium for pushing information of a blockchain, which can avoid generating useless requests and reduce system resource consumption.
A first aspect of an embodiment of the present application provides a method for pushing information of a blockchain, including:
When the generated new block is detected, reading all registered subscription information; wherein, each subscription information contains a respective message queue name;
determining the message queue of each message to be pushed according to the message queue name contained in each subscription message;
determining information to be pushed according to the new area block;
pushing the information to be pushed to each message queue.
In the embodiment of the application, when detecting a generated new block, the blockchain node reads all registered subscription information, and then determines the message queue of each message to be pushed according to the message queue name contained in each subscription information; and then, the block chain link point determines information to be pushed according to the generated new block, and pushes the information to be pushed to each message queue. By means of the arrangement, the business system only needs to register subscription information to the blockchain node according to actual needs, when the blockchain node detects that the blockchain generates a new block, the blockchain node can find a corresponding message queue through the message queue name recorded in the subscription information, and then the block information is pushed to the business system through the message queue. Because the blockchain node can only carry out the information pushing operation when detecting the generation of a new block, useless requests can not be generated in the whole process, and the consumption of system resources can be reduced.
In an implementation manner of the embodiment of the present application, each subscription information further includes a respective information requirement condition; the determining the information to be pushed according to the new block may include:
according to the new block and the information requirement condition contained in each subscription information, respectively determining the information to be pushed corresponding to each message queue;
the pushing the information to be pushed to each message queue may include:
and pushing the corresponding information to be pushed to each message queue respectively.
Further, the information requirement condition comprises a subscribed information type; the step of enabling the first subscription information to be any one subscription information in all subscription information, and respectively determining to-be-pushed information corresponding to each message queue according to the new block and the information requirement condition contained in each subscription information, may include:
detecting whether the subscribed information type in the first information requirement condition contained in the first subscription information contains a block type or not;
if the block type is included, determining whether transaction information needs to be pushed or not according to the first information demand condition;
If transaction information needs to be pushed, generating first block information carrying the transaction information according to the new block, and determining the first block information as information to be pushed corresponding to a first message queue; the first message queues are message queues corresponding to first message queue names contained in the first subscription information in the message queues;
and if the transaction information does not need to be pushed, generating second block information which does not carry the transaction information according to the new block, and determining the second block information as information to be pushed corresponding to the first message queue.
Further, the determining, according to the new block and the information requirement condition included in each subscription information, to-be-pushed information corresponding to each message queue respectively may further include:
and screening target information matched with other information types and information screening conditions from the new area block according to other information types subscribed in the first information demand condition and the information screening conditions, and determining the target information as information to be pushed corresponding to the first message queue.
Further, the pushing the corresponding information to be pushed to each message queue respectively may include:
For any information to be pushed in the information to be pushed, detecting whether a target message queue corresponding to the any information to be pushed is deleted;
if the target message queue is not deleted, acquiring the connection of the target message queue according to the message queue name of the target message queue;
and pushing the information to be pushed to the target message queue through the connection.
In an implementation manner of the embodiment of the present application, the information pushing method may further include:
receiving a registration request sent by a client; the registration request carries second subscription information to be registered, wherein the second subscription information comprises a second message queue name and a second information requirement condition;
and if the second message queue name is not registered and the second information requirement condition passes the validity detection, finishing the registration and storage operation of the second subscription information and creating a second message queue corresponding to the second message queue name.
In an implementation manner of the embodiment of the present application, the information pushing method may further include:
receiving a de-registration request sent by a client; wherein, the de-registration request carries a third message queue name;
And if the third subscription information with the same message queue name as the third message queue name is contained in all the subscription information, deleting the third subscription information and a third message queue corresponding to the third message queue name.
A second aspect of the embodiments of the present application provides an information pushing device of a blockchain, including:
the subscription information reading module is used for reading all registered subscription information when the generated new block is detected; wherein, each subscription information contains a respective message queue name;
the message queue determining module is used for determining message queues of the information to be pushed according to the message queue names contained in each piece of subscription information;
the information determining module is used for determining information to be pushed according to the new area block;
and the information pushing module is used for pushing the information to be pushed to each message queue.
A third aspect of the embodiments of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the information pushing method as provided in the first aspect of the embodiments of the present application when the processor executes the computer program.
A fourth aspect of the embodiments of the present application provides a computer readable storage medium storing a computer program, which when executed by a processor implements an information push method as provided in the first aspect of the embodiments of the present application.
A fifth aspect of the embodiments of the present application provides a computer program product, which when run on an electronic device, causes the electronic device to perform the information pushing method as provided in the first aspect of the embodiments of the present application.
It will be appreciated that the advantages of the second to fifth aspects may be found in the relevant description of the first aspect, and are not described here again.
Drawings
FIG. 1 is a flowchart of a method for pushing information of a blockchain according to an embodiment of the present disclosure;
FIG. 2 is a schematic diagram of an operation flow for registering subscription information provided in an embodiment of the present application;
FIG. 3 is a schematic diagram of an operation flow of de-registering subscription information provided in an embodiment of the present application;
fig. 4 is a schematic operation flow diagram of generating information to be pushed according to an embodiment of the present application;
fig. 5 is a schematic operation flow diagram of pushing information according to an embodiment of the present application;
Fig. 6 is a schematic operation flow diagram of the blockchain information pushing method provided in the embodiment of the present application in an actual application scenario;
fig. 7 is a schematic structural diagram of a blockchain information pushing device according to an embodiment of the present disclosure;
fig. 8 is a schematic diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system configurations, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail. In addition, in the description of the present application and the appended claims, the terms "first," "second," "third," and the like are used merely to distinguish between descriptions and are not to be construed as indicating or implying relative importance.
In the prior art, the service system generally acquires the block information from the blockchain through a middleware polling mode, however, if the block chain length time does not generate a block, most polling requests are useless requests, which can cause higher system resource consumption. In view of this, the embodiments of the present application provide a method for pushing information of a blockchain, which can avoid generating useless requests and reduce system resource consumption. For more specific technical implementation details of the embodiments of the present application, please refer to the method embodiments described below.
Referring to fig. 1, a method for pushing information of a blockchain according to an embodiment of the present application is shown, including:
101. when the generated new block is detected, reading all registered subscription information; wherein, each subscription information contains a respective message queue name;
it should be appreciated that the subject of execution of the present method embodiments is any blockchain node in the blockchain.
Upon detecting a new block generated in the blockchain, the blockchain node reads all subscription information that has completed registration, wherein each subscription information includes a respective message queue name. The subscription information is requested by an external client (such as a service system) and registered and stored at the block link point. The message queue name in a certain subscription information is used for uniquely identifying a corresponding message queue, and the blockchain node can push the blockinformation to a client corresponding to the subscription information through the message queue. For example, if subscription information 1 registered by a certain service system a includes a message queue name 1, and subscription information 2 registered by another service system B includes a message queue name 2, then the blockchain node creates a message queue 1 corresponding to the message queue name 1 and a message queue 2 corresponding to the message queue name 2 in the stage of registering subscription information; the blockchain node can push the blockinformation to the service system A through the message queue 1, and can push the blockinformation to the service system B through the message queue 2.
In an implementation manner of the embodiment of the present application, the information pushing method may further include:
(1) Receiving a registration request sent by a client; the registration request carries second subscription information to be registered, wherein the second subscription information comprises a second message queue name and a second information requirement condition;
(2) And if the second message queue name is not registered and the second information requirement condition passes the validity detection, finishing the registration and storage operation of the second subscription information and creating a second message queue corresponding to the second message queue name.
The external client may initiate a registration request to the block link point for registering subscription information, the registration request carrying subscription information to be registered, here denoted by second subscription information. The second subscription information may include, but is not limited to, the following: message queue name (represented by a second message queue name), information demand condition (represented by a second information demand condition). Wherein the second message queue name is used to uniquely identify the corresponding message queue (represented by the second message queue). The second information requirement condition is used for describing information required by the external client, and may specifically include subscribed information types and other information filtering conditions. For example: the subscribed information type may include a block type or other information type, and when the subscribed information type includes a block type, it is required to specify whether detailed transaction information is required; when detailed transaction information is required, information such as whether or not the to address of the matching transaction is required, and whether or not log content of the matching transaction is required, and the like are required. In general terms, it is possible to determine which information is specifically required by the external client according to the second information requirement condition.
A schematic flow of the operation of registering subscription information is shown in fig. 2. After receiving the registration request, the blockchain node can determine whether the second message queue name is registered, that is, whether a certain registered subscription information uses the second message queue name currently; if the second message queue name is registered, the blockchain node may return a corresponding hint information to the external client, for example, may hint that the message queue name in the subscription information to be registered is registered, and request to modify the message queue name in the subscription information and resubmit the registration request. If the second message queue name is not registered, the blockchain node may continue to determine whether the second information requirement condition is legal (e.g., whether the subscribed information type is legal), that is, perform validity detection on the second information requirement condition through a preset rule. If the validity detection is not passed, the blockchain node may return a corresponding prompt message to the external client, for example, may prompt that the information requirement condition in the subscription information to be registered is not valid, and request to modify the information requirement condition in the subscription information and resubmit the registration request. If the validity detection is passed, the blockchain node completes the registration of the second subscription information, and at the moment, a message queue (represented by a second message queue) corresponding to the name of the second message queue is created, and a connection for sending information to the second message queue can be also created at the same time, so that the registered second subscription information is finally saved. After the registration of the second subscription information is completed, the blockchain node may return a prompt message to the external client that the subscription information registration is successful. And then, the external client can read the subscribed information from the message queue contained in the subscribed information, so that the information pushed by the block link point is obtained. In an implementation manner of the embodiment of the present application, the information pushing method may further include:
(1) Receiving a de-registration request sent by a client; wherein, the de-registration request carries a third message queue name;
(2) And if the third subscription information with the same message queue name as the third message queue name is contained in all the subscription information, deleting the third subscription information and a third message queue corresponding to the third message queue name.
In response to the registration request, the external client may also initiate a de-registration request for deleting subscription information to the block link point, where the de-registration request carries a message queue name (represented by a third message queue name) corresponding to subscription information (represented by a third subscription information) that needs to be deleted.
A schematic flow of the operation of de-registering subscription information is shown in fig. 3. The blockchain node may obtain a third message queue name recorded therein after receiving the de-registration request. Then, it is detected whether or not there is subscription information (represented by third subscription information) having the same message queue name as the third message queue name included in all the subscription information registered. If the third subscription information does not exist, the blockchain node may return a corresponding hint information to the external client, for example, may hint that the subscription information to be deleted does not exist, please modify the message queue name in the de-registration request and resubmit the de-registration request. If the third subscription information is present, the blockchain node may delete the third subscription information, simultaneously delete the message queue (represented by the third message queue) corresponding to the third message queue name, and disconnect the sending of information to the third message queue. Finally, the blockchain node can return prompt information of successful deletion of the subscription information to the external client. After the subscription information is deleted successfully, the blockchain node stops pushing the blockinformation to the external client.
102. Determining the message queue of each message to be pushed according to the message queue name contained in each subscription message;
after reading all the registered subscription information, the blockchain node determines the message queue of each message to be pushed according to the message queue name contained in each subscription information, and the message queues are created when the corresponding subscription information is registered. For example, assuming that all the registered subscription information includes subscription information 1, subscription information 2, and subscription information 3, where subscription information 1 includes message queue name 1, subscription information 2 includes message queue name 2, and subscription information 3 includes message queue name 3, it may be determined that message queue 1 corresponding to message queue name 1, message queue 2 corresponding to message queue name 2, and message queue 3 corresponding to message queue name 3 are message queues for information to be pushed. In addition, the message queue 1 is created during registration of the subscription information 1, the message queue 2 is created during registration of the subscription information 2, and the message queue 3 is created during registration of the subscription information 3.
103. Determining information to be pushed according to the new area block;
the blockchain node may determine information to be pushed, that is, information that needs to be pushed to each message queue, according to the generated new block.
In an implementation manner of the embodiment of the present application, each subscription information further includes a respective information requirement condition; the determining the information to be pushed according to the new block may include:
and respectively determining the information to be pushed corresponding to each message queue according to the new block and the information requirement condition contained in each subscription information.
As in the above-described operation procedure of subscription information registration, each subscription information may also carry a corresponding information requirement condition for determining which block information is specifically required by the corresponding external client. The blockchain node can respectively determine the information to be pushed corresponding to each message queue according to the information requirement condition contained in each subscription information, namely what specific information is pushed to each message queue. By the arrangement, corresponding block information can be pushed according to the actual requirement of the service system.
Further, the information requirement condition comprises a subscribed information type; the step of enabling the first subscription information to be any one subscription information in all subscription information, and respectively determining to-be-pushed information corresponding to each message queue according to the new block and the information requirement condition contained in each subscription information, may include:
(1) Detecting whether the subscribed information type in the first information requirement condition contained in the first subscription information contains a block type or not;
(2) If the block type is included, determining whether transaction information needs to be pushed or not according to the first information demand condition;
(3) If transaction information needs to be pushed, generating first block information carrying the transaction information according to the new block, and determining the first block information as information to be pushed corresponding to a first message queue; the first message queues are message queues corresponding to first message queue names contained in the first subscription information in the message queues;
(4) And if the transaction information does not need to be pushed, generating second block information which does not carry the transaction information according to the new block, and determining the second block information as information to be pushed corresponding to the first message queue.
Assume that certain subscription information that has been registered is first subscription information that includes a first message queue name (corresponding to a first message queue) and a first information requirement condition. The blockchain node detects whether the subscribed information type in the first information requirement condition contains a blocktype, and if so, the blockchain node further judges whether detailed transaction information is needed in the subscribed information, namely whether the transaction information needs to be pushed or not according to other conditions set in the first information requirement condition. If the transaction information needs to be pushed, block information (represented by first block information) carrying the transaction information is generated according to the new block, and the first block information is determined to be the information to be pushed corresponding to the first message queue. If the transaction information does not need pushing, generating block information (represented by second block information) which does not carry the transaction information according to the new block, and determining the second block information as information to be pushed corresponding to the first message queue. In addition, whether the information type subscribed in the first information requirement condition includes a block type or not, the blockchain node can screen out information (represented by target information) matched with other information types and information screening conditions from the new block according to other information types subscribed in the first information requirement condition and the information screening conditions, and then the target information is also determined to be the information to be pushed corresponding to the first message queue.
The operation flow diagram for generating the information to be pushed is shown in fig. 4. After receiving the information for generating the new block, the blockchain node reads all the registered subscription information, and then traverses each subscription information to execute the same operation as the first subscription information, thereby determining which message queues need to be pushed with information and what information needs to be respectively pushed with each message queue. It can be seen that when a new chunk is generated in the blockchain, it is determined which message queues need to be pushed with information and what the information pushed to each message queue is based on the registered subscription information. Subsequently, the blockchain node only needs to push the information to be pushed to the corresponding message queues respectively.
104. Pushing the information to be pushed to each message queue.
After determining the corresponding information to be pushed according to the new block, the blockchain node can push the information to be pushed to each message queue determined in step 102. Here, the information to be pushed to each message queue may be the same information or may be different information. For example, in step 103, the information to be pushed corresponding to each message queue may be determined according to the information requirement condition included in the new block and each subscription information, and then in step 104, the block chain node may push the information to be pushed corresponding to each message queue. After pushing the information to be pushed to the message queue, the corresponding external client (e.g. each service system) can obtain the corresponding information to be pushed through the message queue.
Further, the pushing the corresponding information to be pushed to each message queue respectively may include:
(1) For any information to be pushed in the information to be pushed, detecting whether a target message queue corresponding to the any information to be pushed is deleted;
(2) If the target message queue is not deleted, acquiring the connection of the target message queue according to the message queue name of the target message queue;
(3) And pushing the information to be pushed to the target message queue through the connection.
The operation flow diagram of pushing information is shown in fig. 5. The blockchain node reads all the information to be pushed, and then traverses each information to be pushed to execute the following same operations: for a certain message to be pushed, it is first detected whether a message queue (represented by a target message queue) corresponding to the message to be pushed has been deleted (deletion operation related to the message queue in the subscription information de-registration process described above). If the target message queue is deleted, not pushing the information to be pushed; if the target message queue is not deleted, a connection of the target message queue is obtained according to a message queue name of the target message queue (the creation of the message queue connection is involved in the subscription information registration procedure described above), and then the information to be pushed can be pushed to the target message queue through the connection.
In the embodiment of the application, when detecting a generated new block, the blockchain node reads all registered subscription information, and then determines the message queue of each message to be pushed according to the message queue name contained in each subscription information; and then, the block chain link point determines information to be pushed according to the generated new block, and pushes the information to be pushed to each message queue. By means of the arrangement, the business system only needs to register subscription information to the blockchain node according to actual needs, when the blockchain node detects that the blockchain generates a new block, the blockchain node can find a corresponding message queue through the message queue name recorded in the subscription information, and then the block information is pushed to the business system through the message queue. Because the blockchain node can only carry out the information pushing operation when detecting the generation of a new block, useless requests can not be generated in the whole process, and the consumption of system resources can be reduced.
In order to facilitate understanding of the information pushing method of the blockchain provided in the embodiments of the present application, the following lists practical application scenarios.
Fig. 6 is a schematic operation flow diagram of the blockchain information pushing method in an actual application scenario according to the embodiment of the present application. After generating the new block, the block link point can inform the MQ module that the new block is generated currently and inform the MQ module of the information of the new block generated by the MQ module, wherein the MQ module refers to a functional module for message queue management arranged in the block link node. The MQ module determines to which message queues the current block information needs to be pushed and what the specific information pushed to each message queue is according to all the registered subscription information, so as to generate the information pushed to each message queue. Finally, the MQ module pushes the generated information to the corresponding message queues respectively for the external clients to use. In addition, the blockchain node can receive a registration subscription request of an external client so as to complete registration of new subscription information; the blockchain node may also receive a de-registration request from an external client to delete the registered subscription information in order to stop the corresponding information push.
The following list a few examples of operations:
example one: the business system A based on the blockchain platform needs to monitor the blocking situation of the blockchain platform, namely, each new block needs to be sensed, but does not need to sense which transaction information exists in each block. Based on the actual requirement, the service system a can register subscription information through a registration interface provided by the connected blockchain node, the message queue name of the received information contained in the subscription information is a message queue 1, the type of the subscription information is a block type, and detailed transaction information is not needed. After the service system a registers subscription information through the blockchain node, the blockchain node pushes the blockinformation that does not include detailed transaction information to the message queue 1 every time the blockchain node generates a block. The business system A can obtain the block information through the message queue 1, so that the block outlet condition of the block chain platform can be timely obtained.
Example two: and the business system B based on the blockchain platform deploys an intelligent contract X on the blockchain platform, and the calling condition of the intelligent contract X is required, namely, each transaction calling the intelligent contract X and the information such as the corresponding generated log are required to be perceived. Based on the actual demand, the service system B may register subscription information through a registration interface provided by the connected blockchain node, where the type of information included in the subscription information is transaction information, and specifies a to address (corresponding to the intelligent contract X) of the transaction, and a message queue name of the received information is a message queue 2. After registering subscription information through the blockchain node, the service system B checks whether the transaction in the block has the call of the intelligent contract X every time the blockchain node generates a block, and if the transaction has the call of the intelligent contract X, the information of the transaction and corresponding other log information are pushed to the message queue 2. Through the message queue 2, the service system B can timely receive the calling condition of the intelligent contract X in the blockchain platform.
Example three: the business system C based on the blockchain platform deploys an intelligent contract Y on the blockchain platform, and the calling condition of the intelligent contract Y is required, namely, the transaction of each call of the intelligent contract Y, the corresponding generated log and other information are required to be perceived, and meanwhile, the blocking condition of the blockchain platform is required to be monitored, and detailed transaction information in a block is not required. Based on the actual demand, the service system C may register subscription information through a registration interface provided by the connected blockchain node, where the subscription information includes transaction information and blockinformation, and specifies the to address of the transaction (corresponding to the intelligent contract Y), and does not need detailed transaction information in the block, and the message queue name of the receiving information is the message queue 3. After the service system C registers subscription information through the blockchain node, each time the blockchain node generates a block, it checks whether the transaction in the block has the call of the intelligent contract Y, if yes, the transaction information and the corresponding other log information are pushed to the message queue 3. Through the message queue 3, the service system C can timely receive the calling condition of the intelligent contract Y in the blockchain platform, meanwhile, the block message which does not contain the detailed transaction content is pushed to the message queue 3, and through the message queue 3, the service system C can timely receive the block outlet condition of the blockchain platform.
In summary, the method for pushing the blockchain information provided by the embodiment of the invention can avoid generating useless requests, reduce the system resource consumption, and can also push corresponding information according to the actual needs of the service system.
It should be understood that the sequence numbers of the steps in the foregoing embodiments do not mean the order of execution, and the execution order of the processes should be determined by the functions and the internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
The above mainly describes a blockchain information pushing method, and a blockchain information pushing device will be described below.
Referring to fig. 7, an embodiment of a blockchain information pushing device in the embodiment of the present application includes:
a subscription information reading module 701, configured to read all registered subscription information when a generated new block is detected; wherein, each subscription information contains a respective message queue name;
a message queue determining module 702, configured to determine a message queue of each message to be pushed according to a message queue name included in each subscription information;
an information determining module 703, configured to determine information to be pushed according to the new block;
And the information pushing module 704 is configured to push the information to be pushed to each message queue.
In an implementation manner of the embodiment of the present application, each subscription information further includes a respective information requirement condition;
the information determining module may specifically be configured to: according to the new block and the information requirement condition contained in each subscription information, respectively determining the information to be pushed corresponding to each message queue;
the information pushing module may specifically be used for: and pushing the corresponding information to be pushed to each message queue respectively.
Further, the information requirement condition comprises a subscribed information type; let the first subscription information be any one of the subscription information, the information determining module may include:
the information type detection unit is used for detecting whether the information type subscribed in the first information requirement condition contained in the first subscription information contains a block type or not;
the transaction information determining unit is used for determining whether transaction information needs to be pushed or not according to the first information demand condition if the block type is included;
the first block information generation unit is used for generating first block information carrying transaction information according to the new block if transaction information needs to be pushed, and determining the first block information as information to be pushed corresponding to a first message queue; the first message queues are message queues corresponding to first message queue names contained in the first subscription information in the message queues;
And the second block information generating unit is used for generating second block information which does not carry transaction information according to the new block if the transaction information does not need to be pushed, and determining the second block information as information to be pushed corresponding to the first message queue.
Still further, the information determining module may further include:
and the target information generating unit is used for screening target information matched with other information types and information screening conditions from the new area block according to other information types subscribed in the first information demand condition and the information screening conditions, and determining the target information as information to be pushed corresponding to the first message queue.
In an implementation manner of the embodiment of the present application, the information pushing module may include:
the queue deletion detection unit is used for detecting whether a target message queue corresponding to any information to be pushed is deleted or not according to any information to be pushed in the information to be pushed;
a queue connection acquiring unit, configured to acquire a connection of the target message queue according to a message queue name of the target message queue if the target message queue is not deleted;
And the information pushing unit is used for pushing the information to be pushed to the target message queue through the connection.
In an implementation manner of the embodiment of the present application, the information pushing device may further include:
the registration request receiving module is used for receiving a registration request sent by a client; the registration request carries second subscription information to be registered, wherein the second subscription information comprises a second message queue name and a second information requirement condition;
and the subscription information registration module is used for completing registration and storage operation of the second subscription information and creating a second message queue corresponding to the second message queue name if the second message queue name is not registered and the second information requirement condition passes the validity detection.
In an implementation manner of the embodiment of the present application, the information pushing device may further include:
the de-registration request receiving module is used for receiving a de-registration request sent by the client; wherein, the de-registration request carries a third message queue name;
and the subscription information deleting module is used for deleting the third subscription information and the third message queue corresponding to the third message queue name if the third subscription information with the same message queue name as the third message queue name exists in all the subscription information.
The embodiment of the application also provides a computer readable storage medium, wherein the computer readable storage medium stores a computer program, and the computer program realizes any information pushing method shown in fig. 1 when being executed by a processor.
Embodiments of the present application also provide a computer program product that, when run on an electronic device, causes the electronic device to perform any one of the information pushing methods as represented in fig. 1.
Fig. 8 is a schematic diagram of an electronic device according to an embodiment of the present application. As shown in fig. 8, the electronic device 8 of this embodiment includes: a processor 80, a memory 81 and a computer program 82 stored in the memory 81 and executable on the processor 80. The processor 80, when executing the computer program 82, implements the steps of the embodiments of the respective information pushing methods described above, such as steps 101 to 104 shown in fig. 1. Alternatively, the processor 80 may perform the functions of the modules/units of the apparatus embodiments described above, such as the functions of the modules 701-704 shown in fig. 7, when executing the computer program 82.
The computer program 82 may be divided into one or more modules/units, which are stored in the memory 81 and executed by the processor 80 to complete the present application. The one or more modules/units may be a series of computer program instruction segments capable of performing the specified functions, which instruction segments are used to describe the execution of the computer program 82 in the electronic device 8.
The processor 80 may be a central processing unit (Central Processing Unit, CPU), other general purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), off-the-shelf programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 81 may be an internal storage unit of the electronic device 8, such as a hard disk or a memory of the electronic device 8. The memory 81 may also be an external storage device of the electronic device 8, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card) or the like, which are provided on the electronic device 8. Further, the memory 81 may also include both an internal storage unit and an external storage device of the electronic device 8. The memory 81 is used for storing the computer program and other programs and data required by the electronic device. The memory 81 may also be used to temporarily store data that has been output or is to be output.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional units and modules is illustrated, and in practical application, the above-described functional distribution may be performed by different functional units and modules according to needs, i.e. the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-described functions. The functional units and modules in the embodiment may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit, where the integrated units may be implemented in a form of hardware or a form of a software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working process of the units and modules in the above system may refer to the corresponding process in the foregoing method embodiment, which is not described herein again.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, which are not repeated herein.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and in part, not described or illustrated in any particular embodiment, reference is made to the related descriptions of other embodiments.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other manners. For example, the system embodiments described above are merely illustrative, e.g., the division of the modules or units is merely a logical functional division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection via interfaces, devices or units, which may be in electrical, mechanical or other forms.
The units described as separate units may or may not be physically separate, and units shown as units 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 units may be selected according to actual needs to achieve the purposes of the embodiments of the present application.
In addition, each functional unit in each embodiment of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the present application may implement all or part of the flow of the method of the above embodiment, or may be implemented by a computer program to instruct related hardware, where the computer program may be stored in a computer readable storage medium, and when the computer program is executed by a processor, the computer program may implement the steps of each method embodiment described above. Wherein the computer program comprises computer program code which may be in source code form, object code form, executable file or some intermediate form etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), an electrical carrier signal, a telecommunications signal, a software distribution medium, and so forth. It should be noted that the computer readable medium may include content that is subject to appropriate increases and decreases as required by jurisdictions in which such content is subject to legislation and patent practice, such as in certain jurisdictions in which such content is not included as electrical carrier signals and telecommunication signals.
The above embodiments are only for illustrating the technical solution of the present application, and are not limiting; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present application, and are intended to be included in the scope of the present application.

Claims (10)

1. The information pushing method of the block chain is characterized by comprising the following steps of:
when the generated new block is detected, reading all registered subscription information; wherein, each subscription information contains a respective message queue name;
determining the message queue of each message to be pushed according to the message queue name contained in each subscription message;
determining information to be pushed according to the new area block;
pushing the information to be pushed to each message queue.
2. The information pushing method as claimed in claim 1, wherein each of the subscription information further includes a respective information requirement condition; the determining the information to be pushed according to the new area block comprises the following steps:
According to the new block and the information requirement condition contained in each subscription information, respectively determining the information to be pushed corresponding to each message queue;
the pushing the information to be pushed to each message queue includes:
and pushing the corresponding information to be pushed to each message queue respectively.
3. The information pushing method of claim 2, wherein the information demand condition includes a subscribed information type; the first subscription information is made to be any one subscription information of all subscription information, and the information to be pushed corresponding to each message queue is respectively determined according to the new block and the information requirement condition contained in each subscription information, including:
detecting whether the subscribed information type in the first information requirement condition contained in the first subscription information contains a block type or not;
if the block type is included, determining whether transaction information needs to be pushed or not according to the first information demand condition;
if transaction information needs to be pushed, generating first block information carrying the transaction information according to the new block, and determining the first block information as information to be pushed corresponding to a first message queue; the first message queues are message queues corresponding to first message queue names contained in the first subscription information in the message queues;
And if the transaction information does not need to be pushed, generating second block information which does not carry the transaction information according to the new block, and determining the second block information as information to be pushed corresponding to the first message queue.
4. The information pushing method as claimed in claim 3, wherein said determining the information to be pushed corresponding to each message queue according to the information requirement condition contained in each new block and each subscription information, respectively, further comprises:
and screening target information matched with other information types and information screening conditions from the new area block according to other information types subscribed in the first information demand condition and the information screening conditions, and determining the target information as information to be pushed corresponding to the first message queue.
5. The method for pushing information according to claim 2, wherein the pushing information to be pushed to each message queue includes:
for any information to be pushed in the information to be pushed, detecting whether a target message queue corresponding to the any information to be pushed is deleted;
If the target message queue is not deleted, acquiring the connection of the target message queue according to the message queue name of the target message queue;
and pushing the information to be pushed to the target message queue through the connection.
6. The information pushing method as claimed in claim 1, further comprising:
receiving a registration request sent by a client; the registration request carries second subscription information to be registered, wherein the second subscription information comprises a second message queue name and a second information requirement condition;
and if the second message queue name is not registered and the second information requirement condition passes the validity detection, finishing the registration and storage operation of the second subscription information and creating a second message queue corresponding to the second message queue name.
7. The information pushing method according to any one of claims 1 to 6, further comprising:
receiving a de-registration request sent by a client; wherein, the de-registration request carries a third message queue name;
and if the third subscription information with the same message queue name as the third message queue name is contained in all the subscription information, deleting the third subscription information and a third message queue corresponding to the third message queue name.
8. An information pushing device of a blockchain, comprising:
the subscription information reading module is used for reading all registered subscription information when the generated new block is detected; wherein, each subscription information contains a respective message queue name;
the message queue determining module is used for determining message queues of the information to be pushed according to the message queue names contained in each piece of subscription information;
the information determining module is used for determining information to be pushed according to the new area block;
and the information pushing module is used for pushing the information to be pushed to each message queue.
9. An electronic device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the information pushing method according to any of claims 1 to 7 when executing the computer program.
10. A computer readable storage medium storing a computer program, wherein the computer program when executed by a processor implements the information push method according to any one of claims 1 to 7.
CN202211551484.XA 2022-12-05 2022-12-05 Information pushing method and device of blockchain, electronic equipment and storage medium Pending CN116016653A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211551484.XA CN116016653A (en) 2022-12-05 2022-12-05 Information pushing method and device of blockchain, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211551484.XA CN116016653A (en) 2022-12-05 2022-12-05 Information pushing method and device of blockchain, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116016653A true CN116016653A (en) 2023-04-25

Family

ID=86030765

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211551484.XA Pending CN116016653A (en) 2022-12-05 2022-12-05 Information pushing method and device of blockchain, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116016653A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116319650A (en) * 2023-05-22 2023-06-23 三一海洋重工有限公司 Port equipment data distribution method, device and system and container crane

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116319650A (en) * 2023-05-22 2023-06-23 三一海洋重工有限公司 Port equipment data distribution method, device and system and container crane
CN116319650B (en) * 2023-05-22 2024-01-30 三一海洋重工有限公司 Port equipment data distribution method, device and system and container crane

Similar Documents

Publication Publication Date Title
CN110401720B (en) Information processing method, device, system, application server and medium
CN107798617B (en) Insurance business processing method and device
CN110856126B (en) Information reporting and receiving method, terminal equipment and storage medium
CN111026367B (en) Micro-service arrangement method, device, terminal equipment and storage medium
CN109240802B (en) Request processing method and device
CN109348434B (en) Scene information sending method, sending device and terminal equipment
CN116016653A (en) Information pushing method and device of blockchain, electronic equipment and storage medium
CN111209060A (en) Capability development platform processing method and device
CN111338716A (en) Data processing method and device based on rule engine and terminal equipment
US20180039778A1 (en) Method and device for scanning virus
CN109218338B (en) Information processing system, method and device
CN111324645B (en) Block chain data processing method and device
CN111652681A (en) Receipt processing method, server and computer readable storage medium
CN113779021B (en) Data processing method, device, computer system and readable storage medium
CN112788551B (en) Message processing method and device, terminal equipment and storage medium
CN111369282B (en) Resource processing method and device
CN115170152A (en) Data distribution method, device, equipment and storage medium
CN109348053B (en) Telephone number mark processing method, server, terminal device and computer readable storage medium
CN111488236A (en) Order abnormity processing method, server, storage medium and processing device
CN113127847A (en) Data management method and device
CN107704557B (en) Processing method and device for operating mutually exclusive data, computer equipment and storage medium
CN111475807A (en) Detection method and device for movable storage equipment
CN110647757A (en) Data processing method based on intelligent contract and related device
CN113792014B (en) Nuclear power station file management method and device, terminal equipment and storage medium
CN109446166B (en) Method for detecting file directory, computer readable storage medium and terminal device

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