WO2020207445A1 - Blockchain-based event subscription method and apparatus - Google Patents

Blockchain-based event subscription method and apparatus Download PDF

Info

Publication number
WO2020207445A1
WO2020207445A1 PCT/CN2020/084028 CN2020084028W WO2020207445A1 WO 2020207445 A1 WO2020207445 A1 WO 2020207445A1 CN 2020084028 W CN2020084028 W CN 2020084028W WO 2020207445 A1 WO2020207445 A1 WO 2020207445A1
Authority
WO
WIPO (PCT)
Prior art keywords
role
sequence
client
key event
event
Prior art date
Application number
PCT/CN2020/084028
Other languages
French (fr)
Chinese (zh)
Inventor
梅芬
苏小康
张开翔
范瑞彬
Original Assignee
深圳前海微众银行股份有限公司
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 深圳前海微众银行股份有限公司 filed Critical 深圳前海微众银行股份有限公司
Publication of WO2020207445A1 publication Critical patent/WO2020207445A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24552Database cache management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2457Query processing with adaptation to user needs
    • G06F16/24578Query processing with adaptation to user needs using ranking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2458Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
    • G06F16/2462Approximate or statistical queries
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2458Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
    • G06F16/2474Sequence data queries, e.g. querying versioned data
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking

Definitions

  • the embodiment of the present invention relates to the field of technology and finance technology, and in particular to a method and device for event subscription based on blockchain.
  • a blockchain is a chain composed of a series of blocks. In addition to recording the data of this block, each block also records the Hash value of the previous block. In this way, a chain is formed.
  • cryptography and the other is decentralization. Based on these two concepts, the historical information on the blockchain cannot be tampered with.
  • a block is composed of a block header and a block body. The block header definition includes important fields such as the block height h and the hash value of the previous block.
  • the block body mainly stores transaction data.
  • the producer publishes a topic through the publishing interface, the topic includes the entire sequence of events, and the successfully published events will be permanently stored on the blockchain.
  • consumers subscribe to the topic, they will receive the entire sequence of events on the topic. Perhaps not every event in this topic is of concern to consumers, so some information that consumers do not pay attention to will be returned, which will waste bandwidth and affect service speed.
  • the embodiment of the present invention provides a blockchain-based event subscription. Method and device.
  • an embodiment of the present invention provides a blockchain-based event subscription method, including:
  • the key event sequence is determined by counting historical business information of different roles, including:
  • For each role acquiring historical business information of the role, where the historical business information includes historical subscription events and the sequence between historical subscription events;
  • it also includes:
  • it also includes:
  • an embodiment of the present invention provides a blockchain-based event subscription device, including:
  • the receiving module is used to receive the subscription request sent by the client;
  • the processing module is used to determine the target theme according to the subscription request, and determine all the key event sequences corresponding to the target theme and the role corresponding to each key event sequence, the key event sequence is based on statistics of historical business information of different roles definite;
  • a query module configured to determine the target event sequence corresponding to the client from all key event sequences corresponding to the target theme according to the role corresponding to the client;
  • the sending module is used to send the target event sequence to the client.
  • processing module is specifically configured to:
  • For each role acquiring historical business information of the role, where the historical business information includes historical subscription events and the sequence between historical subscription events;
  • processing module is further used for:
  • processing module is further used for:
  • an embodiment of the present invention provides a computer device, including a memory, a processor, and a computer program stored in the memory and capable of running on the processor.
  • a computer program stored in the memory and capable of running on the processor.
  • the processor executes the program, a blockchain-based The steps of the event subscription method.
  • an embodiment of the present invention provides a computer-readable storage medium that stores a computer program executable by a computer device.
  • the program runs on the computer device, the computer device executes a blockchain-based The steps of the event subscription method.
  • an embodiment of the present invention provides a computer program product containing instructions.
  • the computer program product includes a computing program stored on a non-transitory computer-readable storage medium.
  • the computer program includes program instructions. When the instructions are executed by the computer, the computer executes the steps of the blockchain-based event subscription method.
  • each target topic can include key event sequences corresponding to multiple roles.
  • the client in the target topic can be determined according to the role of the client Corresponding key event sequence, and then send the key event sequence to the client, instead of sending the entire event sequence of the target topic to the client, so as to avoid returning some information that consumers don’t care about. This saves bandwidth and saves bandwidth. The speed of service can also be guaranteed during a surge.
  • FIG. 1 is a schematic diagram of an application scenario provided by an embodiment of the present invention.
  • FIG. 2 is a schematic flowchart of a blockchain-based event subscription method provided by an embodiment of the present invention
  • FIG. 3 is a schematic flowchart of a method for determining a sequence of key events provided by an embodiment of the present invention
  • FIG. 4 is a schematic flowchart of another blockchain-based event subscription method provided by an embodiment of the present invention.
  • FIG. 5 is a schematic structural diagram of a blockchain-based event subscription device provided by an embodiment of the present invention.
  • Fig. 6 is a schematic diagram of a computer-based structure provided by an embodiment of the present invention.
  • Event A change in the state of an object. For example, opening a door is an event, and closing a door is also an event.
  • Topic The same type of event is a topic, and the topics are independent of each other.
  • Subscribe to events Receive events from a specific topic.
  • Producer The main body of the publishing event.
  • Smart contract A piece of open and transparent code that runs on the blockchain.
  • Event ID After each event is successfully published, there will be a unique ID within the subject area.
  • Block chain is a chain composed of a series of blocks. In addition to recording the data of this block, each block also records the hash value of the previous block. In this way, a chain is formed.
  • a block is composed of a block header and a block body.
  • the block header definition includes important fields such as the block height h and the hash value of the previous block.
  • the block body mainly stores transaction data.
  • Node Each participant in the network is a node, and the node participates in network formation and data exchange.
  • a node refers to a participant with a unique identity.
  • the node has a complete copy of the ledger and has the ability to participate in the consensus and maintenance of the blockchain network.
  • the blockchain-based event subscription method in the embodiment of the present invention can be applied to a blockchain scenario.
  • the scenario includes a client 101, an intermediate server 102, a blockchain 103, and
  • the client 104 and the client 101 may be a producer or a consumer.
  • the client 101 When the client 101 is a producer, it can publish a topic to the intermediate server 102 through the Publish interface, or publish an event on a certain topic.
  • the intermediate server 102 will verify whether the topic or event published by the client 101 is legal, and if it is legal, save the topic or event published by the client 101 in the blockchain 103.
  • the client 101 is a consumer, it can subscribe to a topic from the intermediate server 102 through the Subscribe interface.
  • the intermediate server 102 obtains the event on the topic from the blockchain 103 and sends the event on the topic happensed to client 101.
  • the intermediate server 102 sends the new event to the client 101.
  • the client 101 can provide users with corresponding services. For example, when the user needs to query an event, the client 104 sends a query request to the client 101.
  • the query request carries the event ID, and the client 101 obtains the corresponding event according to the event ID.
  • the intermediate server 102 can obtain the historical service information of the client 101, that is, the events that the client 104 inquired from the client 101 and the sequence of the inquired events.
  • the intermediate server 102 obtains the role of the client 101 and the corresponding key event sequence by performing statistics on the historical business information of the client 101.
  • the intermediate server 102 may be a server or a server cluster composed of several servers or a cloud computing center.
  • the user terminal 104 is an electronic device with network communication capabilities, and the electronic device may be a smart phone, a tablet computer, or a portable personal computer.
  • the client 101 is connected to the intermediate server 102 through a wireless network.
  • the embodiment of the present invention provides a process of a blockchain-based event subscription method.
  • the process of the method can be executed by a blockchain-based event subscription device.
  • the event subscription device may be the intermediate server 102 shown in FIG. 1.
  • Step 201 Receive a subscription request sent by the client.
  • Step 202 Determine the target topic according to the subscription request, and determine all key event sequences corresponding to the target topic and the role corresponding to each key event sequence.
  • the key event sequence is determined by counting historical business information of different roles. Different roles correspond to different businesses, so the events of concern will not be the same.
  • the operator of the set airport publishes a theme M
  • the theme M includes 6 events, namely:
  • Event 1 check-in: passengers go through the check-in procedures and check their luggage.
  • Event 2 security check: passengers enter/leave the security check area.
  • Event 3 baggage handling: scan baggage at the security checkpoint and load the baggage into the container.
  • Event 4 cabin door operation: the cabin door is opened, boarded, finally boarded, and closed.
  • Event 5 flight operations: boarding gate, loading container, departure, takeoff.
  • Event 6 customer service: review baggage for new flights.
  • the role can be defined as a passenger, and the corresponding business is to provide passengers with information related to taking an airplane. Therefore, the events of greater concern are event 1, event 2, and event 3 in theme M.
  • the role can be defined as an airline, and the corresponding business is to provide flight information for the airline. Therefore, the more concerned events are event 4, event 5 and event 6 in theme M.
  • Step 203 Determine the target event sequence corresponding to the client from all the key event sequences corresponding to the target theme according to the role corresponding to the client.
  • the role corresponding to the client can be determined first, and then all the key event sequences corresponding to the target topic are queried according to the role, and then the key event sequence matching the role is regarded as the target event sequence.
  • the target theme includes two key event sequences, sequence 1 and sequence 2, where the role corresponding to sequence 1 is role A, and the role corresponding to sequence 2 is role B. If the role of the client is role A, then sequence 1 is used as the client's target event sequence.
  • Step 204 Send the target event sequence to the client.
  • each target topic can include key event sequences corresponding to multiple roles.
  • the client in the target topic can be determined according to the role of the client Corresponding key event sequence, and then send the key event sequence to the client, instead of sending the entire event sequence of the target topic to the client, so as to avoid returning some information that consumers don’t care about. This saves bandwidth and saves bandwidth. The speed of service can also be guaranteed during a surge.
  • Step 301 For each role, obtain historical business information of the role.
  • the historical service information includes historical subscription events and the sequence between historical subscription events.
  • the background role of the passenger APP is set to passengers, and the corresponding business is to provide passengers with information related to taking the plane. Therefore, historical business information includes at least the passenger's inquiries on ticketing, security, baggage handling and other events and queries on the passenger APP The sequence of events such as check-in, security check and baggage handling.
  • set the role of the airline system to airlines, and the corresponding business is to provide airlines with flight information. Therefore, historical business information includes at least the airline's inquiries about cabin operations, flight operations, and customer services on the airline system. Events and query the sequence of events such as cabin door operations, flight operations, and customer service.
  • Step 302 Perform frequency statistics on the sequence of historical subscription events to determine the key event sequence of the role.
  • frequency statistics are performed on the order between historical subscription events, that is, the number of times the user first queries event 1 and then queries event 2.
  • the frequency statistics of candidate order A and candidate order B are performed.
  • candidate order A and candidate order B include corresponding historical subscription events. It should be noted that the specific implementation is not only for the above two The order for frequency statistics can also include other candidate orders.
  • the statistical value of the frequency of passengers from query event 1 to query event 2 is 5, and the statistical value of the frequency of passengers from query event 2 to query event 3 is 3. Then, by calculating the sum of the statistical values of all orders, the total frequency statistical value of candidate order A is 8.
  • the statistical value of the frequency of passengers from query event 4 to query event 5 is 1, and the statistical value of the frequency of passengers from query event 5 to query event 6 is 0. Then, by calculating the sum of the statistical values of all orders, the total frequency statistical value of candidate order B is 1.
  • candidate sequence A can be determined as the key event sequence of the role (passenger), and then candidate sequence A and role (passenger) Save accordingly.
  • frequency statistics are performed on candidate order A and candidate order B, specifically, for candidate order A: event 1 ⁇ event 2 ⁇ event 3.
  • the statistical value of the frequency from query event 1 to query event 2 of the airline is 1, and the statistical value of frequency from query event 2 to query event 3 of the airline is 1. Then, by calculating the sum of the statistical values of all orders, the total frequency statistical value of candidate order A is 2.
  • the statistical value of the frequency from query event 4 to query event 5 of the airline is 6, and the statistical value of frequency from query event 5 to query event 6 of the airline is 4. Then, by calculating the sum of the statistical values of all orders, the total frequency statistical value of candidate order B is 10.
  • candidate sequence B can be determined as the key event sequence of the role (airline), and then candidate sequence B and role ( Airlines) corresponding to save.
  • the key event sequence corresponding to each type of role is obtained. Therefore, when the client's subscription request is received, the key event sequence of the client is returned according to the role of the client, so as to achieve rapid response to the client And the effect of increasing the throughput of the entire system.
  • the intermediate server may cache the key event sequence of each role. For example, for the theme M, when the intermediate server determines that the key event sequence of the role (passenger) is the candidate sequence A, it caches the candidate sequence A and the role (passenger) correspondingly. When the intermediate server determines that the key event sequence of the role (airline) is the candidate sequence B, it caches the candidate sequence B and the role (airline) correspondingly, and the topic M includes two cached key event sequences.
  • the intermediate server When receiving the subscription request sent by the client, the intermediate server obtains the target event sequence corresponding to the client from all the key event sequences corresponding to the cached target topic according to the role of the client.
  • the role of the client is a passenger, from the two key event sequences corresponding to the theme M in the cache, the key event sequence corresponding to the role (passenger) is determined to be the candidate sequence A.
  • the role of the client is an airline, from the two key event sequences corresponding to the topic M in the cache, the key event sequence corresponding to the role (airline) is determined to be the candidate order B.
  • the key event sequence corresponding to the role is cached locally, so when subsequent subscription requests sent by the client are received, you can directly The cached key event sequence is returned to the client, so that in the case of a surge in business, business pressure can be relieved in time and the normal and stable operation of the business can be guaranteed.
  • the intermediate server may save the key event sequence of each role in the blockchain. For example, for theme M, when the intermediate server determines that the key event sequence of the role (passenger) is the candidate sequence A, the candidate sequence A and the role (passenger) are correspondingly saved in the blockchain. When the intermediate server determines that the key event sequence of the role (airline) is the candidate sequence B, the candidate sequence B and the role (airline) are correspondingly saved in the blockchain.
  • the intermediate server When receiving the subscription request sent by the client, the intermediate server obtains the target event sequence corresponding to the client from all the key event sequences corresponding to the target topic stored in the blockchain according to the role of the client.
  • the role of the client is a passenger
  • the key event sequence corresponding to the role (passenger) is obtained from the blockchain, that is, candidate sequence A
  • candidate sequence A is sent to the client as the target event sequence.
  • the role of the client is an airline
  • the key event sequence corresponding to the role (airline) is obtained from the blockchain, that is, candidate sequence B, and then candidate sequence B is sent to the client as the target event sequence.
  • the roles and corresponding key event sequences saved in the blockchain can be shared with other institutions, so that other institutions do not need to re-analyze the roles and the events that the role focuses on, but directly pull them from the blockchain according to the role of the client. Take the corresponding key event sequence to bring convenience to other institutions.
  • the method consists of client 1, server 1, blockchain, and server 2. Perform interactively with client 2. As shown in Figure 4, the method includes the following steps:
  • the server 1 obtains historical service information of each role.
  • the historical service information includes historical subscription events and the sequence between historical subscription events.
  • the roles of consumers who subscribe to the topic can be defined.
  • the roles of consumers who subscribe to topic N include role A and role B. If the service provided by the role A for the user is the service P, the historical service information when the role A provides the service P for the user is acquired. If the service provided by role B for the user is service Q, then obtain the historical service information when role B provides the user with service Q.
  • the events corresponding to service P and service Q are different. Therefore, the historical subscription events and history of role A The order between subscription events is also different from the historical subscription events of role B and the order between historical subscription events.
  • step 402 the server 1 performs frequency statistics on the sequence of historical subscription events, and determines the key event sequence of each role.
  • the set theme N includes event 1, event 2, event 3, event 4, event 5, and event 6.
  • the statistical value of the frequency of the user from query event 1 to query event 2 is 1, and the statistical value of the frequency of the user from query event 2 to query event 4 is 1.
  • the statistical value of frequency from 4 to 6 is 0.
  • the total frequency statistical value of sequence 2 is 2.
  • sequence 1 can be determined as the key event sequence of character A.
  • key event sequence of character B can be determined, assuming that the statistical result is that sequence 2 is the key event sequence of character B.
  • step 403 the server 1 caches the role and the corresponding key event sequence.
  • step 404 the server 1 saves the role and the corresponding key event sequence in the blockchain.
  • the role A and sequence 1 are correspondingly saved in the blockchain, and the role B and sequence 2 are correspondingly saved in the blockchain.
  • Step 405 The client 1 sends a first subscription request to the server 1.
  • step 406 the server 1 determines all key event sequences corresponding to topic N and the role corresponding to each key event sequence from the cached data.
  • the server 1 determines that the target topic is topic N according to the first subscription request, all key event sequences corresponding to topic N are sequence 1 and sequence 2, the role corresponding to sequence 1 is role A, and the role corresponding to sequence 2 is role B.
  • step 407 the server 1 determines the target event sequence corresponding to the client 1 from all the key event sequences corresponding to the topic N according to the role corresponding to the client 1.
  • sequence 1 is acquired as the target event sequence. If the role of client 1 is role B, sequence 2 is acquired as the target event sequence.
  • Step 408 The server 1 sends the target event sequence corresponding to the client 1 to the client 1.
  • Step 409 The client 2 sends a second subscription request to the server 2.
  • step 410 the server 2 obtains the target event sequence corresponding to the client 2 from all the key event sequences corresponding to the target theme stored in the blockchain according to the role of the client 2.
  • step 411 the blockchain returns the target event sequence corresponding to the client 2 to the server 2.
  • sequence 1 is acquired as the target event sequence. If the role of client 2 is role B, sequence 2 is acquired as the target event sequence.
  • step 412 the server 2 sends the target event sequence corresponding to the client 2 to the client 2.
  • each target topic can include key event sequences corresponding to multiple roles.
  • the client in the target topic can be determined according to the role of the client Corresponding key event sequence, and then send the key event sequence to the client, instead of sending the entire event sequence of the target topic to the client, so as to avoid returning some information that consumers don’t care about. This saves bandwidth and saves bandwidth. The speed of service can also be guaranteed during a surge.
  • an embodiment of the present invention provides a blockchain-based event subscription device.
  • the blockchain-based event subscription device 500 includes:
  • the receiving module 501 is configured to receive a subscription request sent by the client;
  • the processing module 502 is configured to determine the target topic according to the subscription request, and determine all the key event sequences corresponding to the target topic and the role corresponding to each key event sequence, the key event sequence is based on statistics of historical business of different roles Information confirmed;
  • the query module 503 is configured to determine the target event sequence corresponding to the client from all the key event sequences corresponding to the target theme according to the role corresponding to the client;
  • the sending module 504 is configured to send the target event sequence to the client.
  • processing module 502 is specifically configured to:
  • For each role acquiring historical business information of the role, where the historical business information includes historical subscription events and the sequence between historical subscription events;
  • processing module 502 is further configured to:
  • processing module 502 is further configured to:
  • an embodiment of the present invention provides a computer device. As shown in FIG. 6, it includes at least one processor 601 and a memory 602 connected to the at least one processor.
  • the embodiment of the present invention does not limit the processor.
  • the connection between the processor 601 and the memory 602 in FIG. 6 is taken as an example.
  • the bus can be divided into address bus, data bus, control bus, etc.
  • the memory 602 stores instructions that can be executed by at least one processor 601. By executing the instructions stored in the memory 602, the at least one processor 601 can execute the aforementioned blockchain-based event subscription method. A step of.
  • the processor 601 is the control center of the terminal device, which can use various interfaces and lines to connect to various parts of the terminal device, and subscribe to events by running or executing instructions stored in the memory 602 and calling data stored in the memory 602 .
  • the processor 601 may include one or more processing units, and the processor 601 may integrate an application processor and a modem processor.
  • the application processor mainly processes the operating system, user interface, and application programs, etc.
  • the adjustment processor mainly deals with wireless communication. It can be understood that the foregoing modem processor may not be integrated into the processor 601.
  • the processor 601 and the memory 602 may be implemented on the same chip, and in some embodiments, they may also be implemented on separate chips.
  • the processor 601 may be a general-purpose processor, such as a central processing unit (CPU), a digital signal processor, an application specific integrated circuit (ASIC), a field programmable gate array or other programmable logic devices, discrete gates or transistors Logic devices and discrete hardware components can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of the present invention.
  • the general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the embodiments of the present invention may be directly embodied as being executed and completed by a hardware processor, or executed and completed by a combination of hardware and software modules in the processor.
  • the memory 602 as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules.
  • the memory 602 may include at least one type of storage medium, for example, may include flash memory, hard disk, multimedia card, card type memory, random access memory (Random Access Memory, RAM), static random access memory (Static Random Access Memory, SRAM), Programmable Read Only Memory (PROM), Read Only Memory (ROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), magnetic memory, disk , CD, etc.
  • the memory 602 is any other medium that can be used to carry or store desired program codes in the form of instructions or data structures and that can be accessed by a computer, but is not limited thereto.
  • the memory 602 in the embodiment of the present invention may also be a circuit or any other device capable of realizing a storage function, for storing program instructions and/or data.
  • the embodiments of the present invention provide a computer-readable storage medium that stores a computer program executable by a computer device.
  • the program runs on the computer device, the computer device executes a region-based The steps of the event subscription method of the blockchain.
  • the embodiments of the present application provide a computer program product containing instructions
  • the embodiments of the present invention provide a computer program product containing instructions.
  • the computer program product includes storage on a non-transitory computer-readable storage medium
  • the computer program includes program instructions that, when executed by a computer, cause the computer to execute the steps of the blockchain-based event subscription method.
  • the embodiments of the present invention may be provided as methods or computer program products. Therefore, the present invention may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
  • a computer-usable storage media including but not limited to disk storage, CD-ROM, optical storage, etc.
  • These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing equipment to work in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including the instruction device.
  • the device implements the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.
  • These computer program instructions can also be loaded on a computer or other programmable data processing equipment, so that a series of operation steps are executed on the computer or other programmable equipment to produce computer-implemented processing, so as to execute on the computer or other programmable equipment.
  • the instructions provide steps for implementing functions specified in a flow or multiple flows in the flowchart and/or a block or multiple blocks in the block diagram.

Abstract

A blockchain-based event subscription method and apparatus, relating to the technical field of scientific and technological finance. The method comprises: an intermediate server receives a subscription request sent by a client; determine all key event sequences corresponding to a target theme and roles corresponding to all the key event sequences according to the subscription request, the key event sequences being determined by collecting statistics about historical service information of different roles; determine a target event sequence from all the key event sequences corresponding to the target theme according to the role corresponding to the client, and send the target event sequence to the client. The key event sequence is determined by collecting statistics about the historical service information of different roles. Therefore, when the subscription request is received, the key event sequence corresponding to the client can be determined according to the role of the client and sent to the client, instead of sending the whole event sequence to the client, so that information which is not concerned by some consumers is prevented from being returned, the bandwidth is saved, and the service speed can be ensured when the subscription is violently increased.

Description

一种基于区块链的事件订阅方法及装置Method and device for event subscription based on blockchain
相关申请的交叉引用Cross references to related applications
本申请要求在2019年04月09日提交中国专利局、申请号为201910280096.4、申请名称为“一种基于区块链的事件订阅方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of a Chinese patent application filed with the Chinese Patent Office, the application number is 201910280096.4, and the application name is "a blockchain-based event subscription method and device" on April 9, 2019, the entire content of which is by reference Incorporated in this application.
技术领域Technical field
本发明实施例涉及科技金融技术领域,尤其涉及一种基于区块链的事件订阅方法及装置。The embodiment of the present invention relates to the field of technology and finance technology, and in particular to a method and device for event subscription based on blockchain.
背景技术Background technique
随着计算机技术的发展,越来越多的技术应用在金融领域,传统金融业正在逐步向金融科技(Finteh)转变,区块链技术也不例外,但由于金融行业的安全性、实时性要求,也对技术提出的更高的要求。区块链是由一系列区块组成的一条链,每个块上除了记录本块的数据还会记录上一块的Hash值,通过这种方式组成一条链。区块链的核心理念有两个,一个是密码学技术,另一个是去中心化思想,基于这两个理念做到区块链上的历史信息无法被篡改。一个区块由块头和块体组成,其中块头定义包括该区块高度h,上一个区块的Hash值等重要字段,而块体主要存储交易数据。生产者通过发布接口发布一个主题,主题中包括整个序列事件,发布成功的事件将永久存储在区块链上。消费者订阅了该主题时,将收到该主题整个序列事件。可能该主题中并不是每个事件都是消费者关注的,因此会返回一些消费者不关注的信息,从而既浪费带宽,又影响服务速度。With the development of computer technology, more and more technologies are applied in the financial field. The traditional financial industry is gradually changing to Finteh. Blockchain technology is no exception, but due to the security and real-time requirements of the financial industry , But also higher requirements for technology. A blockchain is a chain composed of a series of blocks. In addition to recording the data of this block, each block also records the Hash value of the previous block. In this way, a chain is formed. There are two core concepts of the blockchain, one is cryptography and the other is decentralization. Based on these two concepts, the historical information on the blockchain cannot be tampered with. A block is composed of a block header and a block body. The block header definition includes important fields such as the block height h and the hash value of the previous block. The block body mainly stores transaction data. The producer publishes a topic through the publishing interface, the topic includes the entire sequence of events, and the successfully published events will be permanently stored on the blockchain. When consumers subscribe to the topic, they will receive the entire sequence of events on the topic. Perhaps not every event in this topic is of concern to consumers, so some information that consumers do not pay attention to will be returned, which will waste bandwidth and affect service speed.
发明内容Summary of the invention
由于消费者订阅主题时将收到主题整个的序列事件,导致消费者收到不 关注的信息,既浪费带宽又影响服务速度的问题,本发明实施例提供了一种基于区块链的事件订阅方法及装置。Since consumers will receive the entire sequence of events on the topic when subscribing to a topic, the consumer will receive unconcerned information, which will waste bandwidth and affect service speed. The embodiment of the present invention provides a blockchain-based event subscription. Method and device.
一方面,本发明实施例提供了一种基于区块链的事件订阅方法,包括:On the one hand, an embodiment of the present invention provides a blockchain-based event subscription method, including:
接收客户端发送的订阅请求;Receive the subscription request sent by the client;
根据所述订阅请求确定目标主题,并确定所述目标主题对应的所有关键事件序列和每个关键事件序列对应的角色,所述关键事件序列是通过统计不同角色的历史业务信息确定的;Determine the target theme according to the subscription request, and determine all the key event sequences corresponding to the target theme and the roles corresponding to each key event sequence, the key event sequences are determined by counting historical business information of different roles;
根据所述客户端对应的角色从所述目标主题对应的所有关键事件序列中确定所述客户端对应的目标事件序列;Determine the target event sequence corresponding to the client from all key event sequences corresponding to the target theme according to the role corresponding to the client;
将所述目标事件序列发送至所述客户端。Sending the target event sequence to the client.
可选地,所述关键事件序列是通过统计不同角色的历史业务信息确定的,包括:Optionally, the key event sequence is determined by counting historical business information of different roles, including:
针对每个角色,获取所述角色的历史业务信息,所述历史业务信息包括历史订阅事件以及历史订阅事件之间的次序;For each role, acquiring historical business information of the role, where the historical business information includes historical subscription events and the sequence between historical subscription events;
对所述历史订阅事件之间的次序进行频率统计,确定所述角色的关键事件序列。Perform frequency statistics on the sequence between the historical subscription events to determine the key event sequence of the role.
可选地,还包括:Optionally, it also includes:
将每个角色的关键事件序列保存至区块链中。Save the key event sequence of each role to the blockchain.
可选地,还包括:Optionally, it also includes:
将每个角色的关键事件序列进行缓存。Cache the key event sequence of each role.
一方面,本发明实施例提供了一种基于区块链的事件订阅装置,包括:On the one hand, an embodiment of the present invention provides a blockchain-based event subscription device, including:
接收模块,用于接收客户端发送的订阅请求;The receiving module is used to receive the subscription request sent by the client;
处理模块,用于根据所述订阅请求确定目标主题,并确定所述目标主题对应的所有关键事件序列和每个关键事件序列对应的角色,所述关键事件序列是通过统计不同角色的历史业务信息确定的;The processing module is used to determine the target theme according to the subscription request, and determine all the key event sequences corresponding to the target theme and the role corresponding to each key event sequence, the key event sequence is based on statistics of historical business information of different roles definite;
查询模块,用于根据所述客户端对应的角色从所述目标主题对应的所有关键事件序列中确定所述客户端对应的目标事件序列;A query module, configured to determine the target event sequence corresponding to the client from all key event sequences corresponding to the target theme according to the role corresponding to the client;
发送模块,用于将所述目标事件序列发送至所述客户端。The sending module is used to send the target event sequence to the client.
可选地,所述处理模块具体用于:Optionally, the processing module is specifically configured to:
针对每个角色,获取所述角色的历史业务信息,所述历史业务信息包括历史订阅事件以及历史订阅事件之间的次序;For each role, acquiring historical business information of the role, where the historical business information includes historical subscription events and the sequence between historical subscription events;
对所述历史订阅事件之间的次序进行频率统计,确定所述角色的关键事件序列。Perform frequency statistics on the sequence between the historical subscription events to determine the key event sequence of the role.
可选地,所述处理模块还用于:Optionally, the processing module is further used for:
将每个角色的关键事件序列保存至区块链中。Save the key event sequence of each role to the blockchain.
可选地,所述处理模块还用于:Optionally, the processing module is further used for:
将每个角色的关键事件序列进行缓存。Cache the key event sequence of each role.
一方面,本发明实施例提供了一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行所述程序时实现基于区块链的事件订阅方法的步骤。On the one hand, an embodiment of the present invention provides a computer device, including a memory, a processor, and a computer program stored in the memory and capable of running on the processor. When the processor executes the program, a blockchain-based The steps of the event subscription method.
一方面,本发明实施例提供了一种计算机可读存储介质,其存储有可由计算机设备执行的计算机程序,当所述程序在计算机设备上运行时,使得所述计算机设备执行基于区块链的事件订阅方法的步骤。On the one hand, an embodiment of the present invention provides a computer-readable storage medium that stores a computer program executable by a computer device. When the program runs on the computer device, the computer device executes a blockchain-based The steps of the event subscription method.
一方面,本发明实施例提供一种包含指令的计算机程序产品,所述计算机程序产品包括存储在非暂态计算机可读存储介质上的计算程序,所述计算机程序包括程序指令,当所述程序指令被计算机执行时,使得计算机执行基于区块链的事件订阅方法的步骤。In one aspect, an embodiment of the present invention provides a computer program product containing instructions. The computer program product includes a computing program stored on a non-transitory computer-readable storage medium. The computer program includes program instructions. When the instructions are executed by the computer, the computer executes the steps of the blockchain-based event subscription method.
由于预先统计不同角色的历史业务信息确定关键事件序列,故每个目标主题可以包括多个角色对应的关键事件序列,当接收到客户端的订阅请求时,可以根据客户端的角色确定目标主题中客户端对应的关键事件序列,然后将关键事件序列发送至客户端,而不需要将目标主题的整个事件序列发送至客户端,从而避免返回一些消费者不关注的信息,这样既节约了带宽,在订阅暴增时也可以保证服务速度。Since the historical business information of different roles is calculated in advance to determine the key event sequence, each target topic can include key event sequences corresponding to multiple roles. When a client's subscription request is received, the client in the target topic can be determined according to the role of the client Corresponding key event sequence, and then send the key event sequence to the client, instead of sending the entire event sequence of the target topic to the client, so as to avoid returning some information that consumers don’t care about. This saves bandwidth and saves bandwidth. The speed of service can also be guaranteed during a surge.
附图说明Description of the drawings
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简要介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域的普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly describe the technical solutions in the embodiments of the present invention, the following will briefly introduce the drawings needed in the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings may be obtained from these drawings without creative labor.
图1为本发明实施例提供的一种应用场景示意图;FIG. 1 is a schematic diagram of an application scenario provided by an embodiment of the present invention;
图2为本发明实施例提供的一种基于区块链的事件订阅方法的流程示意图;2 is a schematic flowchart of a blockchain-based event subscription method provided by an embodiment of the present invention;
图3为本发明实施例提供的一种确定关键事件序列的方法的流程示意图;3 is a schematic flowchart of a method for determining a sequence of key events provided by an embodiment of the present invention;
图4为本发明实施例提供的另一种基于区块链的事件订阅方法的流程示意图;4 is a schematic flowchart of another blockchain-based event subscription method provided by an embodiment of the present invention;
图5为本发明实施例提供的一种基于区块链的事件订阅装置的结构示意图;5 is a schematic structural diagram of a blockchain-based event subscription device provided by an embodiment of the present invention;
图6为本发明实施例提供的一种基于计算机设备的结构示意图。Fig. 6 is a schematic diagram of a computer-based structure provided by an embodiment of the present invention.
具体实施方式detailed description
为了使本发明的目的、技术方案及有益效果更加清楚明白,以下结合附图及实施例,对本发明进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。In order to make the objectives, technical solutions and beneficial effects of the present invention clearer, the following further describes the present invention in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the present invention, but not to limit the present invention.
为了方便理解,下面对本发明实施例中涉及的名词进行解释。To facilitate understanding, the terms involved in the embodiments of the present invention are explained below.
事件(Event):物体状态的一个变化,比如开门是一个事件,关门也是一个事件。Event: A change in the state of an object. For example, opening a door is an event, and closing a door is also an event.
主题(Topic):同一类事件是一个主题,主题之间互相独立。Topic: The same type of event is a topic, and the topics are independent of each other.
发布事件(Publish):将事件发送到特定的主题上。Publish events (Publish): send events to specific topics.
订阅事件(Subscribe):从特定的主题上接收事件。Subscribe to events (Subscribe): Receive events from a specific topic.
生产者(Producer):发布事件的主体。Producer (Producer): The main body of the publishing event.
消费者(Consumer):订阅事件的主体。Consumer: The subject of the subscription event.
智能合约(Smart contract):在区块链上运行的一段公开,透明的代码。Smart contract: A piece of open and transparent code that runs on the blockchain.
事件ID(Event ID):每一个事件发布成功后会有一个在主题范围内的唯一ID。Event ID (Event ID): After each event is successfully published, there will be a unique ID within the subject area.
区块链:区块链是由一系列区块组成的一条链,每个块上除了记录本块的数据还会记录上一块的Hash值,通过这种方式组成一条链。区块链的核心理念有两个,一个是密码学技术,另一个是去中心化思想,基于这两个理念做到区块链上的历史信息无法被篡改。一个区块由块头和块体组成,其中块头定义包括该区块高度h,上一个区块的Hash值等重要字段,而块体主要存储交易数据。Block chain: A block chain is a chain composed of a series of blocks. In addition to recording the data of this block, each block also records the hash value of the previous block. In this way, a chain is formed. There are two core concepts of the blockchain, one is cryptography and the other is decentralization. Based on these two concepts, the historical information on the blockchain cannot be tampered with. A block is composed of a block header and a block body. The block header definition includes important fields such as the block height h and the hash value of the previous block. The block body mainly stores transaction data.
节点:网络中的每一个参与者就是一个节点,节点参与网络组建和数据交换。在区块链网络中,一个节点是指一个具有唯一身份的参与者,该节点具有一份完整的账本拷贝,具有参与区块链网络共识和账本维护的能力。Node: Each participant in the network is a node, and the node participates in network formation and data exchange. In the blockchain network, a node refers to a participant with a unique identity. The node has a complete copy of the ledger and has the ability to participate in the consensus and maintenance of the blockchain network.
本发明实施例中的基于区块链的事件订阅方法可以应用于区块链场景中,示例性地,如图1所示,该场景中包括客户端101、中间服务器102、区块链103以及用户端104,客户端101可以是生产者,也可以是消费者。当客户端101为生产者时,可以通过Publish接口往中间服务器102中发布一个主题,或者在某个主题上发布一个事件。中间服务器102将校验客户端101发布的主题或事件是否合法,如果合法,将客户端101发布的主题或事件保存在区块链103中。当客户端101为消费者时,可以通过Subscribe接口从中间服务器102中订阅一个主题,当订阅成功时,中间服务器102从区块链103中获取该主题上的事件,并将该主题上的事件发生至客户端101。当生产者往该主题上发布一个新的事件时,中间服务器102将新的事件发送至客户端101。客户端101可以为用户提供对应的业务,比如用户在需要查询某个事件时,用户端104向客户端101发送查询请求,查询请求中携带事件ID,客户端101根据事件ID获取对应的事件并发送至用户端104。中间服务器102可以获取客户端101的历史业务信息,即用户端104向客户端101查询的事件以及查询事件的次序。中间服务器102通过对客户端101的历史业务信息进行统计, 获得客户端101的角色以及对应的关键事件序列。中间服务器102可以是一台服务器或若干台服务器组成的服务器集群或云计算中心等。用户端104是具备网络通信能力的电子设备,该电子设备可以是智能手机、平板电脑或便携式个人计算机等等。客户端101通过无线网络与中间服务器102连接。The blockchain-based event subscription method in the embodiment of the present invention can be applied to a blockchain scenario. For example, as shown in FIG. 1, the scenario includes a client 101, an intermediate server 102, a blockchain 103, and The client 104 and the client 101 may be a producer or a consumer. When the client 101 is a producer, it can publish a topic to the intermediate server 102 through the Publish interface, or publish an event on a certain topic. The intermediate server 102 will verify whether the topic or event published by the client 101 is legal, and if it is legal, save the topic or event published by the client 101 in the blockchain 103. When the client 101 is a consumer, it can subscribe to a topic from the intermediate server 102 through the Subscribe interface. When the subscription is successful, the intermediate server 102 obtains the event on the topic from the blockchain 103 and sends the event on the topic Happened to client 101. When the producer publishes a new event on the topic, the intermediate server 102 sends the new event to the client 101. The client 101 can provide users with corresponding services. For example, when the user needs to query an event, the client 104 sends a query request to the client 101. The query request carries the event ID, and the client 101 obtains the corresponding event according to the event ID. Send to the client 104. The intermediate server 102 can obtain the historical service information of the client 101, that is, the events that the client 104 inquired from the client 101 and the sequence of the inquired events. The intermediate server 102 obtains the role of the client 101 and the corresponding key event sequence by performing statistics on the historical business information of the client 101. The intermediate server 102 may be a server or a server cluster composed of several servers or a cloud computing center. The user terminal 104 is an electronic device with network communication capabilities, and the electronic device may be a smart phone, a tablet computer, or a portable personal computer. The client 101 is connected to the intermediate server 102 through a wireless network.
基于图1所示的应用场景图,本发明实施例提供了一种基于区块链的事件订阅方法的流程,该方法的流程可以由基于区块链的事件订阅装置执行,基于区块链的事件订阅装置可以是图1所示的中间服务器102。Based on the application scenario diagram shown in Figure 1, the embodiment of the present invention provides a process of a blockchain-based event subscription method. The process of the method can be executed by a blockchain-based event subscription device. The event subscription device may be the intermediate server 102 shown in FIG. 1.
如图2所示,包括以下步骤:As shown in Figure 2, it includes the following steps:
步骤201,接收客户端发送的订阅请求。Step 201: Receive a subscription request sent by the client.
步骤202,根据订阅请求确定目标主题,并确定目标主题对应的所有关键事件序列和每个关键事件序列对应的角色。Step 202: Determine the target topic according to the subscription request, and determine all key event sequences corresponding to the target topic and the role corresponding to each key event sequence.
具体地,关键事件序列是通过统计不同角色的历史业务信息确定的。不同角色对应的业务不同,故关注的事件也不会相同。Specifically, the key event sequence is determined by counting historical business information of different roles. Different roles correspond to different businesses, so the events of concern will not be the same.
示例性地,设定飞机场的运营商发布一个主题M,主题M中包括6个事件,分别为:Exemplarily, the operator of the set airport publishes a theme M, and the theme M includes 6 events, namely:
事件1,办票:乘客办理登记手续、检查行李。Event 1, check-in: passengers go through the check-in procedures and check their luggage.
事件2,安检:乘客进入/离开安检区。Event 2, security check: passengers enter/leave the security check area.
事件3,行李处理:在安检站扫描行李、行李装入集装箱。Event 3, baggage handling: scan baggage at the security checkpoint and load the baggage into the container.
事件4,舱门操作:舱门打开、登机、最后登机、关闭。Event 4, cabin door operation: the cabin door is opened, boarded, finally boarded, and closed.
事件5,航班操作:登机口、装载集装箱、出发、起飞。Event 5, flight operations: boarding gate, loading container, departure, takeoff.
事件6,客户服务:新航班复查行李。Event 6, customer service: review baggage for new flights.
对于乘客APP的后台来说,角色可以定义为乘客,对应的业务是为乘客提供乘坐飞机相关的信息,因此更关注的事件是主题M中的事件1、事件2和事件3。对于航空公司系统来说,角色可以定义为航空公司,对应的业务是为航空公司提供航班信息,因此更关注的事件是主题M中的事件4、事件5和事件6。For the backend of the passenger APP, the role can be defined as a passenger, and the corresponding business is to provide passengers with information related to taking an airplane. Therefore, the events of greater concern are event 1, event 2, and event 3 in theme M. For the airline system, the role can be defined as an airline, and the corresponding business is to provide flight information for the airline. Therefore, the more concerned events are event 4, event 5 and event 6 in theme M.
步骤203,根据客户端对应的角色从目标主题对应的所有关键事件序列中 确定客户端对应的目标事件序列。Step 203: Determine the target event sequence corresponding to the client from all the key event sequences corresponding to the target theme according to the role corresponding to the client.
当接收到客户端发送的订阅请求时,可以先确定客户端对应的角色,然后根据角色查询目标主题对应的所有关键事件序列,然后将与角色匹配的关键事件序列作为目标事件序列。比如,设定目标主题包括两个关键事件序列,分别为序列1和序列2,其中序列1对应的角色为角色A,序列2对应的角色为角色B。若客户端的角色为角色A,则将序列1作为客户端的目标事件序列。When a subscription request sent by the client is received, the role corresponding to the client can be determined first, and then all the key event sequences corresponding to the target topic are queried according to the role, and then the key event sequence matching the role is regarded as the target event sequence. For example, the target theme includes two key event sequences, sequence 1 and sequence 2, where the role corresponding to sequence 1 is role A, and the role corresponding to sequence 2 is role B. If the role of the client is role A, then sequence 1 is used as the client's target event sequence.
步骤204,将目标事件序列发送至客户端。Step 204: Send the target event sequence to the client.
由于预先统计不同角色的历史业务信息确定关键事件序列,故每个目标主题可以包括多个角色对应的关键事件序列,当接收到客户端的订阅请求时,可以根据客户端的角色确定目标主题中客户端对应的关键事件序列,然后将关键事件序列发送至客户端,而不需要将目标主题的整个事件序列发送至客户端,从而避免返回一些消费者不关注的信息,这样既节约了带宽,在订阅暴增时也可以保证服务速度。Since the historical business information of different roles is calculated in advance to determine the key event sequence, each target topic can include key event sequences corresponding to multiple roles. When a client's subscription request is received, the client in the target topic can be determined according to the role of the client Corresponding key event sequence, and then send the key event sequence to the client, instead of sending the entire event sequence of the target topic to the client, so as to avoid returning some information that consumers don’t care about. This saves bandwidth and saves bandwidth. The speed of service can also be guaranteed during a surge.
下面具体介绍通过统计不同角色的历史业务信息确定关键事件序列的具体过程,如图3所示,包括以下步骤:The following specifically introduces the specific process of determining the sequence of key events by counting historical business information of different roles, as shown in Figure 3, including the following steps:
步骤301,针对每个角色,获取角色的历史业务信息。Step 301: For each role, obtain historical business information of the role.
具体地,历史业务信息包括历史订阅事件以及历史订阅事件之间的次序。比如,设定乘客APP的后台的角色为乘客,对应的业务是为乘客提供乘坐飞机相关的信息,因此,历史业务信息至少包括乘客在乘客APP上查询办票、安检、行李处理等事件以及查询办票、安检、行李处理等事件的次序。又比如,设定航空公司系统的角色为航空公司,对应的业务是为航空公司提供航班信息,因此,历史业务信息至少包括航空公司在航空公司系统上查询舱门操作、航班操作、客户服务等事件以及查询舱门操作、航班操作、客户服务等事件的次序。Specifically, the historical service information includes historical subscription events and the sequence between historical subscription events. For example, the background role of the passenger APP is set to passengers, and the corresponding business is to provide passengers with information related to taking the plane. Therefore, historical business information includes at least the passenger's inquiries on ticketing, security, baggage handling and other events and queries on the passenger APP The sequence of events such as check-in, security check and baggage handling. For another example, set the role of the airline system to airlines, and the corresponding business is to provide airlines with flight information. Therefore, historical business information includes at least the airline's inquiries about cabin operations, flight operations, and customer services on the airline system. Events and query the sequence of events such as cabin door operations, flight operations, and customer service.
步骤302,对历史订阅事件之间的次序进行频率统计,确定角色的关键事件序列。Step 302: Perform frequency statistics on the sequence of historical subscription events to determine the key event sequence of the role.
具体地,对历史订阅事件之间的次序进行频率统计,即统计用户先查询 事件1,接着查询事件2的次数。示例性地,角色为乘客时,对候选次序A和候选次序B进行频率统计,候选次序A和候选次序B包括对应的历史订阅事件,需要说明的是,具体实施中并不只是针对上述两个次序进行频率统计,还可以包括其他的候选次序。Specifically, frequency statistics are performed on the order between historical subscription events, that is, the number of times the user first queries event 1 and then queries event 2. Exemplarily, when the role is a passenger, the frequency statistics of candidate order A and candidate order B are performed. Candidate order A and candidate order B include corresponding historical subscription events. It should be noted that the specific implementation is not only for the above two The order for frequency statistics can also include other candidate orders.
具体地,针对候选次序A:事件1→事件2→事件3。Specifically, for the candidate sequence A: event 1→event 2→event 3.
通过统计乘客在乘客APP上的历史查询记录可知,乘客从查询事件1到查询事件2的频率统计值为5,乘客从查询事件2到查询事件3的频率统计值为3。然后计算所有次序的统计值之和可得候选次序A的总频率统计值为8。By counting the historical query records of passengers on the passenger APP, the statistical value of the frequency of passengers from query event 1 to query event 2 is 5, and the statistical value of the frequency of passengers from query event 2 to query event 3 is 3. Then, by calculating the sum of the statistical values of all orders, the total frequency statistical value of candidate order A is 8.
针对候选次序B:事件4→事件5→事件6。For candidate order B: event 4→event 5→event 6.
通过统计乘客在乘客APP上的历史查询记录可知,乘客从查询事件4到查询事件5的频率统计值为1,乘客从查询事件5到查询事件6的频率统计值为0。然后计算所有次序的统计值之和可得候选次序B的总频率统计值为1。By counting the historical query records of passengers on the passenger APP, it can be seen that the statistical value of the frequency of passengers from query event 4 to query event 5 is 1, and the statistical value of the frequency of passengers from query event 5 to query event 6 is 0. Then, by calculating the sum of the statistical values of all orders, the total frequency statistical value of candidate order B is 1.
通过比较可知,对于角色为乘客的客户端来说,更关注的次序是候选次序A,因此可以将候选次序A确定为角色(乘客)的关键事件序列,然后将候选次序A以及角色(乘客)对应保存。Through comparison, it can be seen that for the client whose role is passenger, the more concerned sequence is candidate sequence A, so candidate sequence A can be determined as the key event sequence of the role (passenger), and then candidate sequence A and role (passenger) Save accordingly.
示例性地,角色为航空公司时,对候选次序A和候选次序B进行频率统计,具体地,针对候选次序A:事件1→事件2→事件3。Exemplarily, when the role is an airline, frequency statistics are performed on candidate order A and candidate order B, specifically, for candidate order A: event 1→event 2→event 3.
通过统计航空公司在航空公司系统中的历史查询记录可知,航空公司从查询事件1到查询事件2的频率统计值为1,航空公司从查询事件2到查询事件3的频率统计值为1。然后计算所有次序的统计值之和可得候选次序A的总频率统计值为2。By counting the historical query records of airlines in the airline system, the statistical value of the frequency from query event 1 to query event 2 of the airline is 1, and the statistical value of frequency from query event 2 to query event 3 of the airline is 1. Then, by calculating the sum of the statistical values of all orders, the total frequency statistical value of candidate order A is 2.
针对候选次序B:事件4→事件5→事件6。For candidate order B: event 4→event 5→event 6.
通过统计航空公司在航空公司系统中的历史查询记录可知,航空公司从查询事件4到查询事件5的频率统计值为6,航空公司从查询事件5到查询事件6的频率统计值为4。然后计算所有次序的统计值之和可得候选次序B的总频率统计值为10。By counting the historical query records of airlines in the airline system, the statistical value of the frequency from query event 4 to query event 5 of the airline is 6, and the statistical value of frequency from query event 5 to query event 6 of the airline is 4. Then, by calculating the sum of the statistical values of all orders, the total frequency statistical value of candidate order B is 10.
通过比较可知,对于角色为航空公司的客户端来说,更关注的次序是候 选次序B,因此可以将候选次序B确定为角色(航空公司)的关键事件序列,然后将候选次序B以及角色(航空公司)对应保存。Through comparison, it can be seen that for the client whose role is an airline, the more concerned sequence is candidate sequence B, so candidate sequence B can be determined as the key event sequence of the role (airline), and then candidate sequence B and role ( Airlines) corresponding to save.
通过对每类角色关注的事件序列进行统计分析,获得每类角色对应的关键事件序列,故在接收到客户端的订阅请求时,根据客户端的角色返回客户端的关键事件序列,从而达到快速响应客户端以及增加整个系统的吞吐量的效果。Through statistical analysis of the sequence of events concerned by each type of role, the key event sequence corresponding to each type of role is obtained. Therefore, when the client's subscription request is received, the key event sequence of the client is returned according to the role of the client, so as to achieve rapid response to the client And the effect of increasing the throughput of the entire system.
在一种可能的实施方式中,中间服务器在确定每个角色的关键事件序列后,可以将每个角色的关键事件序列进行缓存。比如,针对主题M,中间服务器在确定角色(乘客)的关键事件序列为候选次序A时,将候选次序A以及角色(乘客)对应缓存。中间服务器在确定角色(航空公司)的关键事件序列为候选次序B时,将候选次序B以及角色(航空公司)对应缓存,主题M包括两个缓存的关键事件序列。In a possible implementation manner, after determining the key event sequence of each role, the intermediate server may cache the key event sequence of each role. For example, for the theme M, when the intermediate server determines that the key event sequence of the role (passenger) is the candidate sequence A, it caches the candidate sequence A and the role (passenger) correspondingly. When the intermediate server determines that the key event sequence of the role (airline) is the candidate sequence B, it caches the candidate sequence B and the role (airline) correspondingly, and the topic M includes two cached key event sequences.
中间服务器在接收到客户端发送的订阅请求时,根据客户端的角色从缓存的目标主题对应的所有关键事件序列中,获得客户端对应的目标事件序列。示例性地,若客户端的角色为乘客,从缓存的主题M对应的两个关键事件序列中,确定角色(乘客)对应的关键事件序列为候选次序A。若客户端的角色为航空公司,从缓存的主题M对应的两个关键事件序列中,确定角色(航空公司)对应的关键事件序列为候选次序B。When receiving the subscription request sent by the client, the intermediate server obtains the target event sequence corresponding to the client from all the key event sequences corresponding to the cached target topic according to the role of the client. Exemplarily, if the role of the client is a passenger, from the two key event sequences corresponding to the theme M in the cache, the key event sequence corresponding to the role (passenger) is determined to be the candidate sequence A. If the role of the client is an airline, from the two key event sequences corresponding to the topic M in the cache, the key event sequence corresponding to the role (airline) is determined to be the candidate order B.
由于对每类角色关注的事件序列进行统计分析,获得每类角色对应的关键事件序列后,将角色对应的关键事件序列缓存在本地,故后续接收到客户端发送的订阅请求时,可以直接将缓存的关键事件序列返回客户端,从而在业务暴增的情况下,可以及时缓解业务压力,保证业务正常稳定的运行。Since the statistical analysis of the sequence of events concerned by each type of role is performed, after the key event sequence corresponding to each type of role is obtained, the key event sequence corresponding to the role is cached locally, so when subsequent subscription requests sent by the client are received, you can directly The cached key event sequence is returned to the client, so that in the case of a surge in business, business pressure can be relieved in time and the normal and stable operation of the business can be guaranteed.
在一种可能的实施方式中,中间服务器在确定每个角色的关键事件序列后,可以将每个角色的关键事件序列保存至区块链中。比如,针对主题M,中间服务器在确定角色(乘客)的关键事件序列为候选次序A时,将候选次序A以及角色(乘客)对应保存在区块链中。中间服务器在确定角色(航空公司)的关键事件序列为候选次序B时,将候选次序B以及角色(航空公司) 对应保存在区块链中。In a possible implementation manner, after determining the key event sequence of each role, the intermediate server may save the key event sequence of each role in the blockchain. For example, for theme M, when the intermediate server determines that the key event sequence of the role (passenger) is the candidate sequence A, the candidate sequence A and the role (passenger) are correspondingly saved in the blockchain. When the intermediate server determines that the key event sequence of the role (airline) is the candidate sequence B, the candidate sequence B and the role (airline) are correspondingly saved in the blockchain.
中间服务器在接收到客户端发送的订阅请求时,根据客户端的角色从区块链保存的目标主题对应的所有关键事件序列中,获得客户端对应的目标事件序列。示例性地,若客户端的角色为乘客,从区块链中获得角色(乘客)对应的关键事件序列,即候选次序A,然后将候选次序A作为目标事件序列发送至客户端。若客户端的角色为航空公司,从区块链中获得角色(航空公司)对应的关键事件序列,即候选次序B,然后将候选次序B作为目标事件序列发送至客户端。When receiving the subscription request sent by the client, the intermediate server obtains the target event sequence corresponding to the client from all the key event sequences corresponding to the target topic stored in the blockchain according to the role of the client. Exemplarily, if the role of the client is a passenger, the key event sequence corresponding to the role (passenger) is obtained from the blockchain, that is, candidate sequence A, and then candidate sequence A is sent to the client as the target event sequence. If the role of the client is an airline, the key event sequence corresponding to the role (airline) is obtained from the blockchain, that is, candidate sequence B, and then candidate sequence B is sent to the client as the target event sequence.
另外,区块链中保存的角色以及对应的关键事件序列可以共享给其他机构,使得其他机构不需要重新对角色以及角色关注的事件进行分析,而是直接按照客户端的角色从区块链中拉取对应的关键事件序列,从而为其他机构带来便利。In addition, the roles and corresponding key event sequences saved in the blockchain can be shared with other institutions, so that other institutions do not need to re-analyze the roles and the events that the role focuses on, but directly pull them from the blockchain according to the role of the client. Take the corresponding key event sequence to bring convenience to other institutions.
为了更好的解释本发明实施例,下面结合具体的实施场景描述本发明实施例提供的一种基于区块链的事件订阅方法,该方法由客户端1、服务器1、区块链、服务器2和客户端2交互执行,如图4所示,该方法包括以下步骤:In order to better explain the embodiments of the present invention, the following describes a blockchain-based event subscription method provided by the embodiments of the present invention in combination with specific implementation scenarios. The method consists of client 1, server 1, blockchain, and server 2. Perform interactively with client 2. As shown in Figure 4, the method includes the following steps:
步骤401,服务器1获取每个角色的历史业务信息,历史业务信息包括历史订阅事件以及历史订阅事件之间的次序。In step 401, the server 1 obtains historical service information of each role. The historical service information includes historical subscription events and the sequence between historical subscription events.
具体地,针对任意一个主题,可以定义订阅该主题的消费者的角色,比如,将订阅主题N的消费者的角色包括角色A和角色B。若角色A为用户提供的业务为业务P,则获取角色A为用户提供业务P时的历史业务信息。若角色B为用户提供的业务为业务Q,则获取角色B为用户提供业务Q时的历史业务信息,业务P和业务Q对应的事件是不相同的,因此,角色A的历史订阅事件以及历史订阅事件之间的次序与角色B的历史订阅事件以及历史订阅事件之间的次序也是不同的。Specifically, for any topic, the roles of consumers who subscribe to the topic can be defined. For example, the roles of consumers who subscribe to topic N include role A and role B. If the service provided by the role A for the user is the service P, the historical service information when the role A provides the service P for the user is acquired. If the service provided by role B for the user is service Q, then obtain the historical service information when role B provides the user with service Q. The events corresponding to service P and service Q are different. Therefore, the historical subscription events and history of role A The order between subscription events is also different from the historical subscription events of role B and the order between historical subscription events.
步骤402,服务器1对历史订阅事件之间的次序进行频率统计,确定每个角色的关键事件序列。In step 402, the server 1 performs frequency statistics on the sequence of historical subscription events, and determines the key event sequence of each role.
示例性地,设定主题N中包括事件1、事件2、事件3、事件4、事件5、 事件6。采用角色A的历史业务信息对序列1和序列2进行频率统计。Exemplarily, the set theme N includes event 1, event 2, event 3, event 4, event 5, and event 6. Use the historical business information of role A to perform frequency statistics on sequence 1 and sequence 2.
针对序列1:事件1→事件3→事件5→事件6。For sequence 1: event 1→event 3→event 5→event 6.
通过统计角色A为用户提供业务P的历史记录可知,用户从查询事件1到查询事件3的频率统计值为5,用户从查询事件3到查询事件5的频率统计值为3,用户从查询事件5到查询事件6的频率统计值为1。然后计算所有次序的统计值之和可得序列1的总频率统计值为9。Through the statistical role A to provide the user with the historical record of the service P, it can be seen that the user’s frequency from query event 1 to query event 3 is 5, and the user’s frequency from query event 3 to query event 5 is 3. The frequency statistic value from 5 to query event 6 is 1. Then, by calculating the sum of the statistical values of all orders, the total frequency statistical value of sequence 1 is 9.
针对序列2:事件1→事件2→事件4→事件6。For sequence 2: event 1→event 2→event 4→event 6.
通过统计角色A为用户提供业务P的历史记录可知,用户从查询事件1到查询事件2的频率统计值为1,用户从查询事件2到查询事件4的频率统计值为1,用户从查询事件4到查询事件6的频率统计值为0。然后计算所有次序的统计值之和可得序列2的总频率统计值为2。Through the statistical role A to provide the user with the historical record of the service P, it can be seen that the statistical value of the frequency of the user from query event 1 to query event 2 is 1, and the statistical value of the frequency of the user from query event 2 to query event 4 is 1. The statistical value of frequency from 4 to 6 is 0. Then, by calculating the sum of the statistical values of all orders, the total frequency statistical value of sequence 2 is 2.
通过比较可知,对于角色A来说,更关注的次序是序列1,因此可以将序列1确定为角色A的关键事件序列。基于上述同样的方法可以确定角色B的关键事件序列,假设统计结果为序列2为角色B的关键事件序列。Through comparison, it can be seen that for character A, the more concerned sequence is sequence 1, so sequence 1 can be determined as the key event sequence of character A. Based on the same method described above, the key event sequence of character B can be determined, assuming that the statistical result is that sequence 2 is the key event sequence of character B.
步骤403,服务器1将角色以及对应的关键事件序列进行缓存。In step 403, the server 1 caches the role and the corresponding key event sequence.
将角色A和序列1对应缓存,将角色B和序列2对应缓存。Cache role A and sequence 1 correspondingly, and cache role B and sequence 2.
步骤404,服务器1将角色以及对应的关键事件序列保存至区块链中。In step 404, the server 1 saves the role and the corresponding key event sequence in the blockchain.
将角色A和序列1对应保存在区块链中,将角色B和序列2对应保存的区块链中。The role A and sequence 1 are correspondingly saved in the blockchain, and the role B and sequence 2 are correspondingly saved in the blockchain.
步骤405,客户端1发送第一订阅请求至服务器1。Step 405: The client 1 sends a first subscription request to the server 1.
步骤406,服务器1从缓存的数据中,确定主题N对应的所有关键事件序列和每个关键事件序列对应的角色。In step 406, the server 1 determines all key event sequences corresponding to topic N and the role corresponding to each key event sequence from the cached data.
具体地,服务器1根据第一订阅请求确定目标主题为主题N,主题N对应的所有关键事件序列为序列1和序列2,序列1对应的角色为角色A,序列2对应的角色为角色B。Specifically, the server 1 determines that the target topic is topic N according to the first subscription request, all key event sequences corresponding to topic N are sequence 1 and sequence 2, the role corresponding to sequence 1 is role A, and the role corresponding to sequence 2 is role B.
步骤407,服务器1根据客户端1对应的角色,从主题N对应的所有关键事件序列中确定客户端1对应的目标事件序列。In step 407, the server 1 determines the target event sequence corresponding to the client 1 from all the key event sequences corresponding to the topic N according to the role corresponding to the client 1.
若客户端1的角色为角色A时,获取序列1作为目标事件序列。若客户端1的角色为角色B时,获取序列2作为目标事件序列。If the role of client 1 is role A, sequence 1 is acquired as the target event sequence. If the role of client 1 is role B, sequence 2 is acquired as the target event sequence.
步骤408,服务器1将客户端1对应的目标事件序列发送至客户端1。Step 408: The server 1 sends the target event sequence corresponding to the client 1 to the client 1.
步骤409,客户端2发送第二订阅请求至服务器2。Step 409: The client 2 sends a second subscription request to the server 2.
步骤410,服务器2根据客户端2的角色,从区块链保存的目标主题对应的所有关键事件序列中,获得客户端2对应的目标事件序列。In step 410, the server 2 obtains the target event sequence corresponding to the client 2 from all the key event sequences corresponding to the target theme stored in the blockchain according to the role of the client 2.
步骤411,区块链返回客户端2对应的目标事件序列至服务器2。In step 411, the blockchain returns the target event sequence corresponding to the client 2 to the server 2.
若客户端2的角色为角色A时,获取序列1作为目标事件序列。若客户端2的角色为角色B时,获取序列2作为目标事件序列。If the role of client 2 is role A, sequence 1 is acquired as the target event sequence. If the role of client 2 is role B, sequence 2 is acquired as the target event sequence.
步骤412,服务器2将客户端2对应的目标事件序列发送至客户端2。In step 412, the server 2 sends the target event sequence corresponding to the client 2 to the client 2.
由于预先统计不同角色的历史业务信息确定关键事件序列,故每个目标主题可以包括多个角色对应的关键事件序列,当接收到客户端的订阅请求时,可以根据客户端的角色确定目标主题中客户端对应的关键事件序列,然后将关键事件序列发送至客户端,而不需要将目标主题的整个事件序列发送至客户端,从而避免返回一些消费者不关注的信息,这样既节约了带宽,在订阅暴增时也可以保证服务速度。Since the historical business information of different roles is calculated in advance to determine the key event sequence, each target topic can include key event sequences corresponding to multiple roles. When a client's subscription request is received, the client in the target topic can be determined according to the role of the client Corresponding key event sequence, and then send the key event sequence to the client, instead of sending the entire event sequence of the target topic to the client, so as to avoid returning some information that consumers don’t care about. This saves bandwidth and saves bandwidth. The speed of service can also be guaranteed during a surge.
基于相同的技术构思,本发明实施例提供了一种基于区块链的事件订阅装置,如图5所示,基于区块链的事件订阅装置500包括:Based on the same technical concept, an embodiment of the present invention provides a blockchain-based event subscription device. As shown in FIG. 5, the blockchain-based event subscription device 500 includes:
接收模块501,用于接收客户端发送的订阅请求;The receiving module 501 is configured to receive a subscription request sent by the client;
处理模块502,用于根据所述订阅请求确定目标主题,并确定所述目标主题对应的所有关键事件序列和每个关键事件序列对应的角色,所述关键事件序列是通过统计不同角色的历史业务信息确定的;The processing module 502 is configured to determine the target topic according to the subscription request, and determine all the key event sequences corresponding to the target topic and the role corresponding to each key event sequence, the key event sequence is based on statistics of historical business of different roles Information confirmed;
查询模块503,用于根据所述客户端对应的角色从所述目标主题对应的所有关键事件序列中确定所述客户端对应的目标事件序列;The query module 503 is configured to determine the target event sequence corresponding to the client from all the key event sequences corresponding to the target theme according to the role corresponding to the client;
发送模块504,用于将所述目标事件序列发送至所述客户端。The sending module 504 is configured to send the target event sequence to the client.
可选地,所述处理模块502具体用于:Optionally, the processing module 502 is specifically configured to:
针对每个角色,获取所述角色的历史业务信息,所述历史业务信息包括 历史订阅事件以及历史订阅事件之间的次序;For each role, acquiring historical business information of the role, where the historical business information includes historical subscription events and the sequence between historical subscription events;
对所述历史订阅事件之间的次序进行频率统计,确定所述角色的关键事件序列。Perform frequency statistics on the sequence between the historical subscription events to determine the key event sequence of the role.
可选地,所述处理模块502还用于:Optionally, the processing module 502 is further configured to:
将每个角色的关键事件序列保存至区块链中。Save the key event sequence of each role to the blockchain.
可选地,所述处理模块502还用于:Optionally, the processing module 502 is further configured to:
将每个角色的关键事件序列进行缓存。Cache the key event sequence of each role.
基于相同的技术构思,本发明实施例提供了一种计算机设备,如图6所示,包括至少一个处理器601,以及与至少一个处理器连接的存储器602,本发明实施例中不限定处理器601与存储器602之间的具体连接介质,图6中处理器601和存储器602之间通过总线连接为例。总线可以分为地址总线、数据总线、控制总线等。Based on the same technical concept, an embodiment of the present invention provides a computer device. As shown in FIG. 6, it includes at least one processor 601 and a memory 602 connected to the at least one processor. The embodiment of the present invention does not limit the processor. For the specific connection medium between the 601 and the memory 602, the connection between the processor 601 and the memory 602 in FIG. 6 is taken as an example. The bus can be divided into address bus, data bus, control bus, etc.
在本发明实施例中,存储器602存储有可被至少一个处理器601执行的指令,至少一个处理器601通过执行存储器602存储的指令,可以执行前述的基于区块链的事件订阅方法中所包括的步骤。In the embodiment of the present invention, the memory 602 stores instructions that can be executed by at least one processor 601. By executing the instructions stored in the memory 602, the at least one processor 601 can execute the aforementioned blockchain-based event subscription method. A step of.
其中,处理器601是终端设备的控制中心,可以利用各种接口和线路连接终端设备的各个部分,通过运行或执行存储在存储器602内的指令以及调用存储在存储器602内的数据,从而订阅事件。可选的,处理器601可包括一个或多个处理单元,处理器601可集成应用处理器和调制解调处理器,其中,应用处理器主要处理操作系统、用户界面和应用程序等,调制解调处理器主要处理无线通信。可以理解的是,上述调制解调处理器也可以不集成到处理器601中。在一些实施例中,处理器601和存储器602可以在同一芯片上实现,在一些实施例中,它们也可以在独立的芯片上分别实现。Among them, the processor 601 is the control center of the terminal device, which can use various interfaces and lines to connect to various parts of the terminal device, and subscribe to events by running or executing instructions stored in the memory 602 and calling data stored in the memory 602 . Optionally, the processor 601 may include one or more processing units, and the processor 601 may integrate an application processor and a modem processor. The application processor mainly processes the operating system, user interface, and application programs, etc. The adjustment processor mainly deals with wireless communication. It can be understood that the foregoing modem processor may not be integrated into the processor 601. In some embodiments, the processor 601 and the memory 602 may be implemented on the same chip, and in some embodiments, they may also be implemented on separate chips.
处理器601可以是通用处理器,例如中央处理器(CPU)、数字信号处理器、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件,可以实现或者执行本发明实施例中公开的各方法、步骤及逻辑框图。 通用处理器可以是微处理器或者任何常规的处理器等。结合本发明实施例所公开的方法的步骤可以直接体现为硬件处理器执行完成,或者用处理器中的硬件及软件模块组合执行完成。The processor 601 may be a general-purpose processor, such as a central processing unit (CPU), a digital signal processor, an application specific integrated circuit (ASIC), a field programmable gate array or other programmable logic devices, discrete gates or transistors Logic devices and discrete hardware components can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of the present invention. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the embodiments of the present invention may be directly embodied as being executed and completed by a hardware processor, or executed and completed by a combination of hardware and software modules in the processor.
存储器602作为一种非易失性计算机可读存储介质,可用于存储非易失性软件程序、非易失性计算机可执行程序以及模块。存储器602可以包括至少一种类型的存储介质,例如可以包括闪存、硬盘、多媒体卡、卡型存储器、随机访问存储器(Random Access Memory,RAM)、静态随机访问存储器(Static Random Access Memory,SRAM)、可编程只读存储器(Programmable Read Only Memory,PROM)、只读存储器(Read Only Memory,ROM)、带电可擦除可编程只读存储器(Electrically Erasable Programmable Read-Only Memory,EEPROM)、磁性存储器、磁盘、光盘等等。存储器602是能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其他介质,但不限于此。本发明实施例中的存储器602还可以是电路或者其它任意能够实现存储功能的装置,用于存储程序指令和/或数据。The memory 602, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. The memory 602 may include at least one type of storage medium, for example, may include flash memory, hard disk, multimedia card, card type memory, random access memory (Random Access Memory, RAM), static random access memory (Static Random Access Memory, SRAM), Programmable Read Only Memory (PROM), Read Only Memory (ROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), magnetic memory, disk , CD, etc. The memory 602 is any other medium that can be used to carry or store desired program codes in the form of instructions or data structures and that can be accessed by a computer, but is not limited thereto. The memory 602 in the embodiment of the present invention may also be a circuit or any other device capable of realizing a storage function, for storing program instructions and/or data.
基于相同的技术构思,本发明实施例提供了一种计算机可读存储介质,其存储有可由计算机设备执行的计算机程序,当所述程序在计算机设备上运行时,使得所述计算机设备执行基于区块链的事件订阅方法的步骤。Based on the same technical concept, the embodiments of the present invention provide a computer-readable storage medium that stores a computer program executable by a computer device. When the program runs on the computer device, the computer device executes a region-based The steps of the event subscription method of the blockchain.
基于同一发明构思,本申请实施例提供一种包含指令的计算机程序产品,本发明实施例提供一种包含指令的计算机程序产品,所述计算机程序产品包括存储在非暂态计算机可读存储介质上的计算程序,所述计算机程序包括程序指令,当所述程序指令被计算机执行时,使得计算机执行基于区块链的事件订阅方法的步骤。Based on the same inventive concept, the embodiments of the present application provide a computer program product containing instructions, and the embodiments of the present invention provide a computer program product containing instructions. The computer program product includes storage on a non-transitory computer-readable storage medium The computer program includes program instructions that, when executed by a computer, cause the computer to execute the steps of the blockchain-based event subscription method.
本领域内的技术人员应明白,本发明的实施例可提供为方法、或计算机程序产品。因此,本发明可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art should understand that the embodiments of the present invention may be provided as methods or computer program products. Therefore, the present invention may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
本发明是参照根据本发明实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present invention is described with reference to flowcharts and/or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and/or block in the flowchart and/or block diagram, and the combination of processes and/or blocks in the flowchart and/or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing equipment to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing equipment are generated It is a device that realizes the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing equipment to work in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including the instruction device. The device implements the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded on a computer or other programmable data processing equipment, so that a series of operation steps are executed on the computer or other programmable equipment to produce computer-implemented processing, so as to execute on the computer or other programmable equipment. The instructions provide steps for implementing functions specified in a flow or multiple flows in the flowchart and/or a block or multiple blocks in the block diagram.
尽管已描述了本发明的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例作出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本发明范围的所有变更和修改。Although the preferred embodiments of the present invention have been described, those skilled in the art can make additional changes and modifications to these embodiments once they learn the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present invention.
显然,本领域的技术人员可以对本发明进行各种改动和变型而不脱离本发明的精神和范围。这样,倘若本发明的这些修改和变型属于本发明权利要求及其等同技术的范围之内,则本发明也意图包含这些改动和变型在内。Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. In this way, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalent technologies, the present invention is also intended to include these modifications and variations.

Claims (11)

  1. 一种基于区块链的事件订阅方法,其特征在于,包括:A blockchain-based event subscription method, which is characterized in that it includes:
    接收客户端发送的订阅请求;Receive the subscription request sent by the client;
    根据所述订阅请求确定目标主题,并确定所述目标主题对应的所有关键事件序列和每个关键事件序列对应的角色,所述关键事件序列是通过统计不同角色的历史业务信息确定的;Determine the target theme according to the subscription request, and determine all the key event sequences corresponding to the target theme and the roles corresponding to each key event sequence, the key event sequences are determined by counting historical business information of different roles;
    根据所述客户端对应的角色从所述目标主题对应的所有关键事件序列中确定所述客户端对应的目标事件序列;Determine the target event sequence corresponding to the client from all key event sequences corresponding to the target theme according to the role corresponding to the client;
    将所述目标事件序列发送至所述客户端。Sending the target event sequence to the client.
  2. 如权利要求1所述的方法,其特征在于,所述关键事件序列是通过统计不同角色的历史业务信息确定的,包括:The method according to claim 1, wherein the key event sequence is determined by counting historical business information of different roles, and comprises:
    针对每个角色,获取所述角色的历史业务信息,所述历史业务信息包括历史订阅事件以及历史订阅事件之间的次序;For each role, acquiring historical business information of the role, where the historical business information includes historical subscription events and the sequence between historical subscription events;
    对所述历史订阅事件之间的次序进行频率统计,确定所述角色的关键事件序列。Perform frequency statistics on the sequence between the historical subscription events to determine the key event sequence of the role.
  3. 如权利要求2所述的方法,其特征在于,还包括:The method of claim 2, further comprising:
    将每个角色的关键事件序列保存至区块链中。Save the key event sequence of each role to the blockchain.
  4. 如权利要求2所述的方法,其特征在于,还包括:The method of claim 2, further comprising:
    将每个角色的关键事件序列进行缓存。Cache the key event sequence of each role.
  5. 一种基于区块链的事件订阅装置,其特征在于,包括:A blockchain-based event subscription device, which is characterized in that it includes:
    接收模块,用于接收客户端发送的订阅请求;The receiving module is used to receive the subscription request sent by the client;
    处理模块,用于根据所述订阅请求确定目标主题,并确定所述目标主题对应的所有关键事件序列和每个关键事件序列对应的角色,所述关键事件序列是通过统计不同角色的历史业务信息确定的;The processing module is used to determine the target theme according to the subscription request, and determine all the key event sequences corresponding to the target theme and the role corresponding to each key event sequence, the key event sequence is based on statistics of historical business information of different roles definite;
    查询模块,用于根据所述客户端对应的角色从所述目标主题对应的所有关键事件序列中确定所述客户端对应的目标事件序列;A query module, configured to determine the target event sequence corresponding to the client from all key event sequences corresponding to the target theme according to the role corresponding to the client;
    发送模块,用于将所述目标事件序列发送至所述客户端。The sending module is used to send the target event sequence to the client.
  6. 如权利要求5所述的装置,其特征在于,所述处理模块具体用于:The device according to claim 5, wherein the processing module is specifically configured to:
    针对每个角色,获取所述角色的历史业务信息,所述历史业务信息包括历史订阅事件以及历史订阅事件之间的次序;For each role, acquiring historical business information of the role, where the historical business information includes historical subscription events and the sequence between historical subscription events;
    对所述历史订阅事件之间的次序进行频率统计,确定所述角色的关键事件序列。Perform frequency statistics on the sequence between the historical subscription events to determine the key event sequence of the role.
  7. 如权利要求6所述的装置,其特征在于,所述处理模块还用于:The device of claim 6, wherein the processing module is further configured to:
    将每个角色的关键事件序列保存至区块链中。Save the key event sequence of each role to the blockchain.
  8. 如权利要求6所述的装置,其特征在于,所述处理模块还用于:The device of claim 6, wherein the processing module is further configured to:
    将每个角色的关键事件序列进行缓存。Cache the key event sequence of each role.
  9. 一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,其特征在于,所述处理器执行所述程序时实现权利要求1~4任一权利要求所述方法的步骤。A computer device, comprising a memory, a processor, and a computer program stored on the memory and running on the processor, wherein the processor executes the program when the program is executed by any one of claims 1 to 4 The steps of the method.
  10. 一种计算机可读存储介质,其特征在于,其存储有可由计算机设备执行的计算机程序,当所述程序在计算机设备上运行时,使得所述计算机设备执行权利要求1~4任一所述方法的步骤。A computer-readable storage medium, characterized in that it stores a computer program that can be executed by a computer device, and when the program runs on a computer device, the computer device executes the method described in any one of claims 1 to 4 A step of.
  11. 一种计算机程序产品,其特征在于,所述计算机程序产品包括存储在非暂态计算机可读存储介质上的计算程序,所述计算机程序包括程序指令,当所述程序指令被计算机执行时,使所述计算机执行权利要求1~4任一所述方法。A computer program product, characterized in that, the computer program product includes a calculation program stored on a non-transitory computer-readable storage medium, the computer program includes program instructions, and when the program instructions are executed by a computer, The computer executes the method described in any one of claims 1 to 4.
PCT/CN2020/084028 2019-04-09 2020-04-09 Blockchain-based event subscription method and apparatus WO2020207445A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910280096.4 2019-04-09
CN201910280096.4A CN110110269B (en) 2019-04-09 2019-04-09 Event subscription method and device based on block chain

Publications (1)

Publication Number Publication Date
WO2020207445A1 true WO2020207445A1 (en) 2020-10-15

Family

ID=67483979

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/084028 WO2020207445A1 (en) 2019-04-09 2020-04-09 Blockchain-based event subscription method and apparatus

Country Status (2)

Country Link
CN (1) CN110110269B (en)
WO (1) WO2020207445A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113032704A (en) * 2021-02-24 2021-06-25 广州虎牙科技有限公司 Data processing method, device, electronic equipment and medium
CN113297178A (en) * 2021-05-31 2021-08-24 中国民航信息网络股份有限公司 Aviation product data processing method and related equipment

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110110269B (en) * 2019-04-09 2023-04-18 深圳前海微众银行股份有限公司 Event subscription method and device based on block chain
CN112765514A (en) * 2019-11-06 2021-05-07 腾讯科技(深圳)有限公司 Method, device and storage medium for monitoring network public sentiment
CN113573282B (en) * 2020-04-29 2022-09-16 中国电信股份有限公司 Subscription data providing/acquiring method, providing/acquiring device and interactive system
CN112016115B (en) * 2020-11-02 2021-02-05 中航信移动科技有限公司 Event subscription system based on block chain
CN113220795B (en) * 2021-02-19 2022-06-24 腾讯科技(深圳)有限公司 Data processing method, device, equipment and medium based on distributed storage

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107017992A (en) * 2017-03-29 2017-08-04 杭州秘猿科技有限公司 A kind of high-performance alliance block chain based on duplex structure
CN108932250A (en) * 2017-05-24 2018-12-04 北京京东尚科信息技术有限公司 For the method for data processing, equipment, system and computer readable storage medium
WO2019042754A1 (en) * 2017-09-04 2019-03-07 Siemens Aktiengesellschaft Filter unit based data communication system including a blockchain platform
CN110110269A (en) * 2019-04-09 2019-08-09 深圳前海微众银行股份有限公司 A kind of event subscription method and device based on block chain
CN110622488A (en) * 2019-03-27 2019-12-27 阿里巴巴集团控股有限公司 System and method for managing user interaction with blockchains

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101459908B (en) * 2007-12-13 2012-04-25 华为技术有限公司 Service subscribing method, system, server
US9402104B2 (en) * 2010-07-30 2016-07-26 Avaya Inc. System and method for subscribing to events based on tag words
US20140310365A1 (en) * 2012-01-31 2014-10-16 Global Relay Communications Inc. System and Method for Tracking Messages in a Messaging Service
CN103729461B (en) * 2014-01-12 2017-02-01 中国科学院软件研究所 Releasing and subscribing method based on history recorded data mining
US9674127B2 (en) * 2014-09-23 2017-06-06 International Business Machines Corporation Selective message republishing to subscriber subsets in a publish-subscribe model

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107017992A (en) * 2017-03-29 2017-08-04 杭州秘猿科技有限公司 A kind of high-performance alliance block chain based on duplex structure
CN108932250A (en) * 2017-05-24 2018-12-04 北京京东尚科信息技术有限公司 For the method for data processing, equipment, system and computer readable storage medium
WO2019042754A1 (en) * 2017-09-04 2019-03-07 Siemens Aktiengesellschaft Filter unit based data communication system including a blockchain platform
CN110622488A (en) * 2019-03-27 2019-12-27 阿里巴巴集团控股有限公司 System and method for managing user interaction with blockchains
CN110110269A (en) * 2019-04-09 2019-08-09 深圳前海微众银行股份有限公司 A kind of event subscription method and device based on block chain

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113032704A (en) * 2021-02-24 2021-06-25 广州虎牙科技有限公司 Data processing method, device, electronic equipment and medium
CN113297178A (en) * 2021-05-31 2021-08-24 中国民航信息网络股份有限公司 Aviation product data processing method and related equipment
CN113297178B (en) * 2021-05-31 2024-04-02 中国民航信息网络股份有限公司 Aviation product data processing method and related equipment

Also Published As

Publication number Publication date
CN110110269B (en) 2023-04-18
CN110110269A (en) 2019-08-09

Similar Documents

Publication Publication Date Title
WO2020207445A1 (en) Blockchain-based event subscription method and apparatus
US10691494B2 (en) Method and device for virtual resource allocation, modeling, and data prediction
KR101939554B1 (en) Determining a temporary transaction limit
US20200175403A1 (en) Systems and methods for expediting rule-based data processing
US20230325592A1 (en) Data management using topic modeling
CN113094434A (en) Database synchronization method, system, device, electronic equipment and medium
US10454779B2 (en) Adaptive learning system with a product configuration engine
US20220207606A1 (en) Prediction of future occurrences of events using adaptively trained artificial-intelligence processes
US11308562B1 (en) System and method for dimensionality reduction of vendor co-occurrence observations for improved transaction categorization
US11062224B2 (en) Prediction using fusion of heterogeneous unstructured data
US10872369B1 (en) Systems and methods for providing intelligent electronic communications
CN110930103A (en) Service ticket checking method and system, medium and computer system
CN113094595A (en) Object recognition method, device, computer system and readable storage medium
US20220230238A1 (en) System and method for assessing risk
CN112734352A (en) Document auditing method and device based on data dimensionality
CN111914065B (en) Short message content verification method, device, computer system and computer readable medium
US20240095598A1 (en) Data processing methods and computer systems for wavelakes signal intelligence
US20230237572A1 (en) Structuring a Multi-Segment Operation
US20230245230A1 (en) System and method for generating and controlling celebrity investment stock currency
US20220230165A1 (en) Blockchain-based outlet site selection method and apparatus, device and storage medium
US20230196317A1 (en) Intelligent distributed ledger consent optimizing apparatus for Asset Transfer
CN117151862A (en) Data processing method, device, system, equipment and storage medium
CN116776842A (en) Data processing method, device, computer equipment and readable storage medium
CN115757567A (en) Data processing method, system, equipment and storage medium based on heterogeneous database
CN116226240A (en) Business data display method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20786774

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205 DATED 21/01/2022)

122 Ep: pct application non-entry in european phase

Ref document number: 20786774

Country of ref document: EP

Kind code of ref document: A1