A dynamic publishing and subscribing method and device

Through the dynamic publishing and subscribing method, the partially ordered R tree and index structure are used to classify and store subscription conditions, which solves the low efficiency problem caused by the large matching bucket structure in the existing technology, and improves the event matching efficiency and system real-time performance.

CN114911808BActive Publication Date: 2024-09-24NORTHWESTERN POLYTECHNICAL UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210479174.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-05
Publication Date
2024-09-24
Estimated Expiration
2042-05-05

AI Technical Summary

Technical Problem

The existing event matching algorithm has low matching efficiency due to the large matching bucket structure, which affects the real-time and scalability of the system.

Method used

Adopt the dynamic publishing and subscription method, use the partially ordered R tree and index structure to classify and store subscription conditions, and update the partially ordered R tree and index structure according to the partial order relationship of the subscription conditions through matching units, storage units and update units to improve matching efficiency. .

Benefits of technology

It improves the efficiency of event matching, reduces the time complexity of the system and the complexity of dynamic update of the storage structure, and enhances the real-time and scalability of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114911808B
    Figure CN114911808B
Patent Text Reader

Abstract

The present invention discloses a dynamic publishing and subscription method and device, which relates to the field of computer technology and is used to solve the problem of low matching efficiency of existing event matching algorithms due to the overly large matching bucket structure. The method comprises: when monitoring a subscription to be received, obtaining the first condition included in the subscription to be received, matching the first condition with the second condition corresponding to multiple M-th subscriptions stored in a subscription condition list; if there is at least one different content between the first condition and any of the second conditions, storing the subscription to be received corresponding to the first condition in the subscription condition list; the partial order state currently corresponding to the subscription condition list is a stored state, and classifying each N-th subscription according to the partial order relationship corresponding to the stored state and the content of the first condition included in each N-th subscription stored in the subscription condition list, and updating the partial order relationship including the partial order R tree and the index structure according to the classification result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and more specifically to a dynamic publishing and subscribing method and device. Background Art

[0002] In the dynamic interaction of the virtual prototype resources of the high-altitude platform, the amount of information in the entire virtual environment is very large, and the association between the interaction nodes is complex. As the test process progresses, the interaction (subscription) relationship between the nodes changes frequently. This will not only affect the real-time performance of the system, but also restrict the scalability of the entire system, which may cause system congestion and network bottlenecks, resulting in system distortion and seriously affecting the practicality of the system.

[0003] Matching algorithms can find all subscriptions that match a given event in an efficient way, and are one of the key issues studied in content-based publish / subscribe systems. The goals of matching algorithm design mainly include the space efficiency, time efficiency, and subscription maintenance efficiency of matching. Among these aspects, the most important should be the time efficiency of the matching algorithm. The performance of a matching system mainly depends on the efficiency of the matching algorithm, so how to improve the matching efficiency of the algorithm has become an urgent problem for many researchers today.

[0004] Among the existing event matching algorithms, H-Tree constructs a hash table by evenly mapping subscriptions to different buckets using the median value of the region constraint specified on the index attribute in the subscription, and only matches subscriptions with a higher matching probability during the matching process; REIN adopts an index structure consisting of multiple bucket chains, and the number of bucket chains is twice the number of attributes in the event. In the matching process, a reverse search strategy is used to obtain successfully matched subscriptions by marking all subscriptions that do not match the event; DMM constructs a search tree by mapping events and subscriptions to a multidimensional space, thereby shortening the matching time; Chen Jiming et al. proposed a content-based effective event matching method (CEEM, content-based effective event matching) algorithm), this method uses a data structure with a predicate table as the core, divides the predicate family, and indexes each predicate family in a sorted or hash table manner. It does not need to construct a static matching network, and can dynamically update the ordering information, thereby speeding up the efficiency of event matching; HEMA introduces a subscription list and a predicate table, and stores the predicates with the same attributes and the same comparison operation in a row of the predicate table in an ordered sequence, and links the predicates belonging to the same subscription in the predicate table through a pointer. The subscription list not only stores the subscription numbers of all the subscriptions added to the predicate table, but also stores the position of the first predicate of the subscription in the predicate table. The introduction of the subscription list and the predicate table enables the matching process to be carried out in a certain predicate order.

[0005] Among the above methods, although the REIN method is not affected by the subscription selectivity, the efficiency of the algorithm is significantly reduced when the attributes in the event are less than the attributes in the subscription; the DMM method must split the multidimensional space multiple times, which takes a long time to build the tree structure; the CEEM method does not distinguish between equal value predicates and interval predicates, which will generate a large number of unnecessary traversals during matching. At the same time, the matching bucket structure is too large, which makes it extremely difficult to modify the predicate organization structure, thus affecting the efficiency.

[0006] In summary, the existing event matching algorithm has the problem of low matching efficiency due to the overly large matching bucket structure. Summary of the invention

[0007] The embodiment of the present invention provides a dynamic publishing and subscribing method and device, which are used to solve the problem of low matching efficiency caused by the overly large matching bucket structure of the existing event matching algorithm.

[0008] An embodiment of the present invention provides a dynamic publish-subscribe method, comprising:

[0009] When a subscription to be received is monitored, a first condition included in the subscription to be received is obtained, and the first condition is matched with second conditions corresponding to multiple M-th subscriptions stored in the subscription condition list; M is a positive integer greater than 0;

[0010] If the first condition and any one of the second conditions have at least one different content, the subscription to be received corresponding to the first condition is stored in a subscription condition list, and the multiple subscriptions to be received are named as the Nth subscription in the order of the subscription condition list, where N is a positive integer greater than M;

[0011] The partial order state currently corresponding to the subscription condition list is the stored state. According to the partial order relationship corresponding to the stored state and the content of the first condition included in each Nth subscription stored in the subscription condition list, each Nth subscription is classified, and the partial order relationship including the partial order R tree and index structure is updated according to the classification result.

[0012] Preferably, the first condition includes at least any one of a character string condition, a numerical range condition and an integer condition;

[0013] If the first condition and any of the second conditions have at least one different content, specifically includes:

[0014] The character string condition included in the first condition is inconsistent with the character string condition included in the second condition; and / or

[0015] The numerical range condition included in the first condition is inconsistent with the numerical range condition included in the second condition; and / or

[0016] The integer condition included in the first condition is inconsistent with the integer condition included in the second condition.

[0017] Preferably, before matching the first condition with a plurality of second conditions stored in the subscription condition list, the method further includes:

[0018] If the subscription condition list is empty, storing the multiple subscriptions to be received in the subscription condition list in sequence according to the timestamp order corresponding to the multiple subscriptions to be received, and naming the multiple subscriptions to be received stored in the subscription condition list as the Nth subscription;

[0019] The partial order state currently corresponding to the subscription condition list is an empty state. According to the content and partial order relationship of the first condition included in the multiple subscriptions to be received, the multiple subscriptions to be received are classified: the index information corresponding to the Nth subscription including the string condition is added to the index structure; and / or the tree information corresponding to the Nth subscription including the numerical range condition and satisfying {Ω|A∩B=Ω,Ω≠A,Ω≠B} is added to the root directory of the partial order R tree; and / or the tree information corresponding to the Mth subscription including the integer condition and satisfying {Ω|A∩B=Ω,Ω≠A,Ω≠B} is added to the root directory of the partial order R tree;

[0020] The classification result is written into the partial order state, the multiple subscriptions to be received stored in the subscription condition list are named as the Mth subscription, and the partial order state currently corresponding to the subscription condition list is updated to the stored state.

[0021] Preferably, the classifying each Nth subscription according to the partial order relationship corresponding to the stored states and the content of the first condition included in each Nth subscription stored in the subscription condition list specifically includes:

[0022] Compare the content of the first condition included in the Nth subscription with the partial order relationship corresponding to the stored state:

[0023] If the first condition included in the Nth subscription has a numerical range condition that overlaps with multiple Mth subscriptions that already exist in the partial order R-tree, the index information corresponding to the Nth subscription is added to the index structure; or if the first condition included in the Nth subscription has a numerical range condition that does not overlap with multiple Mth subscriptions that already exist in the partial order R-tree, the tree information corresponding to the Nth subscription is added to the root directory of the partial order R-tree; or if the first condition included in the Nth subscription has a numerical range condition that is completely covered by any Mth subscription that already exists in the partial order R-tree, the tree information corresponding to the Nth subscription is added to the directory of the Mth subscription that completely covers the Nth subscription;

[0024] Add the index information corresponding to the Nth subscription including the integer condition to the index structure;

[0025] The index information corresponding to the Nth subscription including the string condition is added to the index structure.

[0026] Preferably, after updating the partial order relationship including the partial order R-tree and the index structure according to the classification result, the method further includes:

[0027] When a request event is received, the event is searched in a partial order relationship including a partial order R-tree and an index structure, and if the request conditions included in the event are fully met, the event is published.

[0028] The embodiment of the present invention also provides a dynamic publishing and subscription device, including:

[0029] a matching unit, configured to, when monitoring a subscription to be received, obtain a first condition included in the subscription to be received, and match the first condition with a second condition corresponding to a plurality of Mth subscriptions stored in the subscription condition list; M is a positive integer greater than 0;

[0030] a storage unit, configured to, if the first condition and any one of the second conditions have at least one different content, sequentially store the multiple subscriptions to be received into a subscription condition list according to the order of timestamps corresponding to the multiple subscriptions to be received, and name the multiple subscriptions to be received as an Nth subscription according to the order of the subscription condition list, where N is a positive integer greater than M;

[0031] An updating unit is used to classify each Nth subscription according to the partial order relationship corresponding to the stored state and the content of the first condition included in each Nth subscription stored in the subscription condition list, and to update the partial order relationship including the partial order R tree and the index structure according to the classification result.

[0032] Preferably, the first condition includes at least any one of a character string condition, a numerical range condition and an integer condition;

[0033] The storage unit is specifically used for:

[0034] The character string condition included in the first condition is inconsistent with the character string condition included in the second condition; and / or

[0035] The numerical range condition included in the first condition is inconsistent with the numerical range condition included in the second condition; and / or

[0036] The integer condition included in the first condition is inconsistent with the integer condition included in the second condition;

[0037] Preferably, the matching unit is further used for:

[0038] If the subscription condition list is empty, storing the multiple subscriptions to be received in the subscription condition list in sequence according to the timestamp order corresponding to the multiple subscriptions to be received, and naming the multiple subscriptions to be received stored in the subscription condition list as the Nth subscription;

[0039] The partial order state currently corresponding to the subscription condition list is an empty state. According to the content and partial order relationship of the first condition included in the multiple subscriptions to be received, the multiple subscriptions to be received are classified: the index information corresponding to the Nth subscription including the string condition is added to the index structure; and / or the tree information corresponding to the Nth subscription including the numerical range condition and satisfying {Ω|A∩B=Ω,Ω≠A,Ω≠B} is added to the root directory of the partial order R tree; and / or the tree information corresponding to the Mth subscription including the integer condition and satisfying {Ω|A∩B=Ω,Ω≠A,Ω≠B} is added to the root directory of the partial order R tree;

[0040] The classification result is written into the partial order state, the multiple subscriptions to be received stored in the subscription condition list are named as the Mth subscription, and the partial order state currently corresponding to the subscription condition list is updated to the stored state.

[0041] Preferably, the updating unit is specifically used for:

[0042] Compare the content of the first condition included in the Nth subscription with the partial order relationship corresponding to the stored state:

[0043] If the first condition included in the Nth subscription has a numerical range condition that overlaps with multiple Mth subscriptions that already exist in the partial order R-tree, the index information corresponding to the Nth subscription is added to the index structure; or if the first condition included in the Nth subscription has a numerical range condition that does not overlap with multiple Mth subscriptions that already exist in the partial order R-tree, the tree information corresponding to the Nth subscription is added to the root directory of the partial order R-tree; or if the first condition included in the Nth subscription has a numerical range condition that is completely covered by any Mth subscription that already exists in the partial order R-tree, the tree information corresponding to the Nth subscription is added to the directory of the Mth subscription that completely covers the Nth subscription;

[0044] Add the index information corresponding to the Nth subscription including the integer condition to the index structure;

[0045] The index information corresponding to the Nth subscription including the string condition is added to the index structure.

[0046] Preferably, the updating unit is further used for:

[0047] When a request event is received, the event is searched in a partial order relationship including a partial order R-tree and an index structure, and if the request conditions included in the event are fully met, the event is published.

[0048] The embodiment of the present invention provides a method and device for dynamic publishing and subscription, the method comprising: when monitoring a subscription to be received, obtaining a first condition included in the subscription to be received, matching the first condition with a second condition corresponding to multiple Mth subscriptions stored in a subscription condition list; M is a positive integer greater than 0; if the first condition has at least one different content from any of the second conditions, storing the multiple subscriptions to be received in the subscription condition list in sequence according to the timestamp order corresponding to the multiple subscriptions to be received, and naming the multiple subscriptions to be received as Nth subscriptions according to the order of the subscription condition list, where N is a positive integer greater than M; the partial order state currently corresponding to the subscription condition list is an existing state, and classifying each Nth subscription according to the partial order relationship corresponding to the existing state and the content of the first condition included in each Nth subscription stored in the subscription condition list, and updating the partial order relationship including the partial order R tree and the index structure according to the classification result. The method is a content-based publishing and subscription method, which aims to solve the problem of dynamic interaction of virtual prototype resources of high-altitude platforms with huge virtual environment information and complex association relationships between interactive nodes. As the test process of the high-altitude platform virtual prototype progresses, the interaction relationship between nodes changes frequently. The previous method only uses one structure to store content-based subscription conditions, which has a high time complexity. In particular, the interval values ​​in the content gradually increase. The single tree structure is required to be frequently updated, which causes the system to reduce real-time performance, congestion and network bottlenecks, seriously affecting the practicality of the system. Therefore, this method uses a composite storage structure: a partial order R tree and an index structure to classify and store different subscription conditions, making it easier to find and locate subscription conditions and improving the operating efficiency of the publishing end. At the same time, the partial order R tree stores the interval structure through multiple R trees according to the partial order relationship of the subscription conditions, solving the problem of high complexity of dynamic update of the storage structure. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0050] Figure 1 A schematic diagram of a dynamic publishing and subscription method provided by an embodiment of the present invention;

[0051] Figure 2 A schematic diagram of the basic structure of a subscription condition list provided in an embodiment of the present invention;

[0052] Figure 3A schematic diagram of a structure of storing subscription conditions list to be received provided by an embodiment of the present invention;

[0053] Figure 4 A schematic diagram of the process of constructing and updating a partially ordered R-tree and an index structure provided by an embodiment of the present invention;

[0054] Figure 5 A schematic diagram of a partially ordered R-tree and index structure provided in an embodiment of the present invention;

[0055] Figure 6 A schematic diagram of the initially constructed partial order R-tree and index structure provided in the first embodiment of the present invention;

[0056] Figure 7 Provide an updated partial order R-tree and index structure schematic diagram for the first embodiment of the present invention;

[0057] Figure 8 A schematic diagram of the structure of a dynamic publishing and subscription device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0058] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0059] Figure 1 The following is a schematic diagram of a dynamic publishing and subscription method provided by an embodiment of the present invention. Figure 1 As shown, the method mainly includes the following steps:

[0060] Step 101, when a subscription to be received is monitored, a first condition included in the subscription to be received is obtained, and the first condition is matched with a second condition corresponding to a plurality of Mth subscriptions stored in a subscription condition list; M is a positive integer greater than 0;

[0061] Step 102: if the first condition and any one of the second conditions have at least one different content, the multiple subscriptions to be received are sequentially stored in a subscription condition list according to the order of timestamps corresponding to the multiple subscriptions to be received, and the multiple subscriptions to be received are named as the Nth subscription according to the order of the subscription condition list, where N is a positive integer greater than M;

[0062] Step 103, the partial order state currently corresponding to the subscription condition list is the stored state, and each Nth subscription is classified according to the partial order relationship corresponding to the stored state and the content of the first condition included in each Nth subscription stored in the subscription condition list, and the partial order relationship including the partial order R tree and the index structure is updated according to the classification result.

[0063] It should be noted that the publish-subscribe method provided in the embodiment of the present invention is executed by an event agent. Specifically, the subscriber and the publisher use the event agent to match conditions and notify the publisher to execute the publishing task.

[0064] Before step 101, the event agent needs to confirm the initial state of the subscription condition list before listening to the new subscription, that is, before listening to the subscription to be received. Figure 2 If the basic structure of the provided subscription condition list is consistent, it can be determined that the subscription condition list is empty. It should be noted that the subscription condition list provided in the embodiment of the present invention can have a list capacity that can be dynamically changed according to the number of subscriptions.

[0065] Furthermore, when the subscription condition list is empty, if the event agent listens to multiple subscriptions to be received, since the subscription condition list is empty, the multiple subscriptions to be received can be stored in the subscription condition list in sequence according to the timestamp order corresponding to the multiple subscriptions to be received, and the multiple subscriptions to be received stored in the subscription condition list can be named as the Nth subscription.

[0066] In an embodiment of the present invention, since the subscriptions to be received in the stored value subscription condition list also need to be classified according to the partial order structure, in order to distinguish the subscriptions to be received in the stored value subscription condition list from the subscriptions to be received that have been classified according to the partial order structure, the subscriptions to be received in the stored value subscription condition list but not yet classified according to the partial order structure are named as the Nth subscriptions, and the subscriptions to be received in the subscription condition list that have been classified according to the partial order structure are named as the Mth subscriptions, where M is a positive integer greater than zero, and N is a positive integer greater than M.

[0067] Furthermore, when the subscription condition list is empty, its currently corresponding partial order state is an empty state, and the multiple subscriptions to be received need to be classified according to the content and partial order relationship of the first condition included in the multiple subscriptions to be received stored in the subscription condition list.

[0068] Before introducing the classification of multiple subscriptions to be received, the first condition included in the subscriptions to be received is introduced. In an embodiment of the present invention, the first condition includes at least any one of a string condition, a numerical range condition and an integer condition. For example, the first condition may include only a string condition, may include only a numerical range condition, may include only an integer condition, may include a string condition and a numerical range condition, may include a string condition and an integer condition, may include a numerical range condition and an integer condition, or may include a string condition, a numerical range condition and an integer condition.

[0069] Multiple subscriptions to be received are classified into the following situations:

[0070] The index information corresponding to the Nth subscription including the string condition is added to the index structure.

[0071] The tree information corresponding to the Nth subscription that includes the numerical range condition and satisfies {Ω|A∩B=Ω, Ω≠A, Ω≠B} is added to the root directory of the partially ordered R-tree.

[0072] The tree information corresponding to the Mth subscription that includes the integer condition and satisfies {Ω|A∩B=Ω, Ω≠A, Ω≠B} is added to the root directory of the partially ordered R-tree.

[0073] Furthermore, the classification results of the multiple subscriptions to be received are written into the partial order state corresponding to the subscription condition list, and the partial order state currently corresponding to the subscription condition list is updated to the stored state; furthermore, the names of the multiple subscriptions to be received stored in the subscription condition list are updated from the Nth subscription to the Mth subscription.

[0074] It should be noted that the embodiment of the present invention also includes a buffer container (Container Buffer). Specifically, when the event proxy successively monitors multiple subscriptions to be received, all subscriptions to be received monitored in this time period will be saved in the buffer container. Since the subscription condition list is initially empty, the buffer container will forward the multiple subscriptions to be received to the subscription condition list in sequence according to the timestamp order of the multiple subscriptions to be received.

[0075] In step 101, when the event agent monitors multiple subscriptions to be received, the multiple subscriptions to be received are saved in the buffer container. When the event agent determines that the subscription condition list is not empty, it is necessary to check whether the next subscription to be received in the buffer container to be forwarded to the subscription condition list is stored in the subscription condition list. If the subscription to be received exists in the subscription condition list, the subscription condition list refuses to receive the subscription to be received, and the buffer container also deletes the subscription to be received; if the subscription to be received does not exist in the subscription condition list, the buffer container sends the subscription to be received to the subscription condition list for transfer.

[0076] like Figure 3 As shown, when the event agent successively listens to multiple subscriptions to be received, all subscriptions to be received listened to during this time period will be saved in the buffer container. Since the subscription condition list is empty at the beginning, the buffer container will forward the multiple subscriptions to be received to the subscription condition list in sequence according to the timestamp order of the multiple subscriptions to be received; and when the subscription condition list is not empty, it is necessary to check whether the next subscription to be received forwarded to the subscription condition list in the buffer container has been stored in the subscription condition list. If the subscription to be received does not exist in the subscription condition list, the subscription to be received in the buffer container can be transferred to the subscription condition list. If the subscription to be received exists in the subscription condition list, the subscription condition list refuses to receive the subscription to be received, and the buffer container also deletes the subscription to be received.

[0077] It should be noted that in an embodiment of the present invention, by matching the first condition included in the subscription to be received with the second condition in the subscription condition list, if the first condition has at least one different content with any of the second conditions, it can be determined that there is no subscription to be received corresponding to the first condition in the subscription condition list.

[0078] Specifically, it includes the following situations:

[0079] 1) If the character string condition included in the first condition is inconsistent with the character string condition included in the second condition, it can be determined that there is no subscription to be received corresponding to the first condition in the subscription condition list;

[0080] 2) If the numerical range condition included in the first condition is inconsistent with the numerical range condition included in the second condition, it can be determined that there is no subscription to be received corresponding to the first condition in the subscription condition list;

[0081] 3) If the integer condition included in the first condition is inconsistent with the integer condition included in the second condition, it can be determined that there is no subscription to be received corresponding to the first condition in the subscription condition list;

[0082] 4) If the string condition included in the first condition is inconsistent with the string condition included in the second condition, and the numerical range condition included in the first condition is inconsistent with the numerical range condition included in the second condition, it can be determined that there is no subscription to be received corresponding to the first condition in the subscription condition list;

[0083] 5) If the string condition included in the first condition is inconsistent with the string condition included in the second condition, and the integer condition included in the first condition is inconsistent with the integer condition included in the second condition, it can be determined that there is no subscription to be received corresponding to the first condition in the subscription condition list;

[0084] 6) If the numerical range condition included in the first condition is inconsistent with the numerical range condition included in the second condition, and the integer condition included in the first condition is inconsistent with the integer condition included in the second condition, it can be determined that there is no subscription to be received corresponding to the first condition in the subscription condition list;

[0085] 7) If the string condition included in the first condition is inconsistent with the string condition included in the second condition, the numerical range condition included in the first condition is inconsistent with the numerical range condition included in the second condition, and the integer condition included in the first condition is inconsistent with the integer condition included in the second condition, it can be determined that there is no subscription to be received corresponding to the first condition in the subscription condition list.

[0086] It should be noted that, in actual applications, the content of the second condition included in the Mth subscription stored in the subscription condition list is consistent with the content of the first condition included in the subscription to be received. Here, the condition included in the Mth subscription is called the second condition, and the condition included in the subscription to be received is called the first condition. These are distinguishable names used only to distinguish when introducing the matching of the subscription to be received with the subscription condition list.

[0087] In step 102, when it is determined that the first condition and any second condition have at least one different content, it can be determined that there is no subscription to be received corresponding to the first condition in the subscription condition list, and the subscription to be received corresponding to the first condition can be stored in the subscription condition list.

[0088] Furthermore, the subscriptions to be received corresponding to the first condition are stored in the subscription condition list in the order of the subscription condition list, and the subscriptions to be received corresponding to the first condition are named as the Nth subscription in the order of the subscription condition list. It should be noted that when the event agent monitors multiple subscriptions to be received, it is necessary to match the first conditions included in the multiple subscriptions to be received with the second conditions included in the subscription condition list respectively. If there are multiple first conditions and second conditions that fail to match successfully in the multiple subscriptions to be received monitored by the event agent, the multiple subscriptions to be received can be stored in the subscription condition list in sequence, and at the same time, the subscriptions to be received corresponding to the multiple first conditions respectively are named as the Nth subscription in the order of the subscription condition list.

[0089] In practical applications, in the dynamic update function of the subscription condition list, constructing a partial order R-tree to store the subscription conditions of the partial order structure can realize the dynamic update of the storage structure, improve the matching efficiency of subscriptions, and thus realize the dynamic interaction of the virtual prototype resources of the aerial platform.

[0090] like Figure 4As shown, before updating the partial order R-tree and index structure, it is necessary to check the storage status of the two, namely, "existing subscription" and "empty state". "Empty state" means that there is no content in the structure, indicating the initial state of the event agent or the subscription is invalid. Therefore, it is necessary to classify all subscriptions in the subscription condition list and model them accordingly according to the partial order category. If it is "existing state", the subscriptions updated in the subscription condition list are classified based on the existing subscriptions in the partial order R-tree, and the non-partial order subscriptions and equal subscriptions are forwarded to the index structure. The subscriptions with partial order are used to update the partial order R-tree.

[0091] The following describes in detail in step 103 the process of updating the partial order R-tree and the index structure when the partial order state currently corresponding to the subscription condition list is the stored state.

[0092] Specifically, when the partial order state currently corresponding to the subscription condition list is the stored state, if there are multiple Nth subscriptions stored in the subscription condition list, it is necessary to classify each Nth subscription according to the partial order relationship corresponding to the stored state and the content of the first condition included in each Nth subscription stored in the subscription condition list.

[0093] It should be noted that, since the partial order state currently corresponding to the subscription condition list does not have an existing state, that is, multiple Nth subscriptions included in the subscription condition list. Therefore, the partial order relationship corresponding to the existing state can be compared one by one according to the content of the first condition included in each Nth subscription, including the following situations:

[0094] 1) Add the index information corresponding to the Nth subscription including the integer condition to the index structure.

[0095] 2) Add the index information corresponding to the Nth subscription including the string condition to the index structure.

[0096] 3) Compare the Nth subscription including the numerical range condition with the partially ordered R-tree, and determine whether the Nth subscription including the numerical range condition needs to be added to the partially ordered R-tree based on the comparison result:

[0097] 3-1) If the first condition included in the Nth subscription has a value range condition that overlaps with multiple Mth subscriptions that already exist in the partial order R-tree, the index information corresponding to the Nth subscription is added to the index structure.

[0098] 3-2) In the first condition included in the Nth subscription, its numerical range condition does not overlap with multiple Mth subscriptions that already exist in the partial order R-tree, and the tree information corresponding to the Nth subscription is added to the root directory of the partial order R-tree.

[0099] 3-3) If the value range condition of the first condition included in the Nth subscription is completely covered by any Mth subscription that already exists in the partial order R-tree, the tree information corresponding to the Nth subscription is added to the directory of the Mth subscription that completely covers the Nth subscription.

[0100] The following combination Figure 5 Taking the partial order R-tree and index structure as an example, the process of updating is introduced. Figure 5 As shown, suber1 and suber2 are multiple M-th subscriptions that already exist in the subscription condition list, and suber3 to suber6 are the four N-th subscriptions that have just been stored in the subscription condition list. At this time, the partial order state corresponding to the subscription condition list is the stored state, wherein the partial order R tree includes two root nodes R1 and R2, which are the partial order conditions in suber1 and suber2. After the subscription condition list stores multiple N-th subscriptions, the content of the first condition included in each N-th subscription can be compared one by one with the partial order relationship corresponding to the stored state, and the partial order R tree and index structure included in the partial order state can be updated according to the comparison result. Figure 5 In suber3 and suber5, the conditions that meet the partial order are stored in the corresponding nodes according to the partial order relationship of R1 and R2, and the conditions that do not meet the partial order are forwarded to the index structure for storage. In practical applications, in order to ensure that the partial order R-tree can fully utilize the partial order relationship to store subscription conditions, it is necessary to modify the partial order R-tree based on the insertion and deletion operations, stipulating that if a larger area of ​​subscription conditions overlaps with the existing partial order conditions, the smaller overlapping area will be deleted and forwarded to the index for storage.

[0101] It should be noted that the index information corresponding to the Nth subscription and the tree information corresponding to the Nth subscription mentioned above may correspond to the numbers of multiple Mth subscriptions included in the subscription condition list, and the tree information may also correspond to the numbers of multiple Mth subscriptions included in the subscription condition list; for example, Figure 5 The index information in are v1, v2 and v3 respectively, where v1 corresponds to suber1, v2 corresponds to suber2, and v3 corresponds to suber3; Figure 5 The tree information in are R1, R2, R3 and R5 respectively, where R1 corresponds to suber1, R2 corresponds to suber2, R3 corresponds to suber3, and R5 corresponds to suber5.

[0102] In the embodiment of the present invention, the specific forms of the index information and the tree information corresponding to the Nth subscription are not limited, as long as the index information and the tree information maintain a unique corresponding relationship with each Mth subscription in the subscription condition list.

[0103] After completing the update of the partial-order R-tree and the index structure, subscription matching can be performed. Specifically, when the event agent receives a request event, it can search for the received event in the partial-order relationship including the partial-order R-tree and the index structure, that is, match the numerical range condition included in the received event with the partial-order R-tree in the partial-order relationship, and then match the string condition included in the received event with the index structure in the partial-order relationship; finally, take the intersection of the second conditions included in the multiple Mth subscriptions obtained by the previous match. If the intersection is empty, it is determined that the received event fails to match; if there is an intersection, it can be determined that the received event meets the subscription conditions, and the received event is published to the Mth subscription corresponding to the intersection.

[0104] It should be noted that, when the numerical range condition included in the received event is matched with the partial order R-tree in the partial order relation, the numerical range condition is only used as an example for introduction here, which does not mean that only the numerical range condition can be selected for matching. In practical applications, if the content included in the received event is an integer condition, the integer condition included in the event can be matched with the partial order R-tree in the partial order relation; if the content included in the received event is an integer condition and a numerical range condition, the integer condition and the numerical range condition included in the event can be matched with the partial order R-tree in the partial order relation; if the content included in the received event is a numerical range condition, the numerical range condition included in the event can be matched with the partial order R-tree in the partial order relation.

[0105] In order to receive the publish-subscribe method provided by the embodiment of the present invention in more detail, the following Figure 6 and Figure 7 To introduce the publish and subscribe method.

[0106] 1) When the event proxy is initialized, the subscription condition list contains multiple Nth subscriptions as shown in Table 1. The partial order state corresponding to the subscription condition list is currently empty, that is, the partial order R-tree and index structure included in the partial order relationship do not have subscriptions. Among the three Nth subscriptions, string conditions c, d, and e are equal conditions and can be classified as non-partial order classes. Add c, d, and e to the index structure. At the same time, add the index information corresponding to the Nth subscription corresponding to each string condition to the index structure. For example, the Nth subscription corresponding to the string condition c is Suber1, and the index information corresponding to Suber1 is v1. Therefore, Figure 6 As shown, v1 is added to the index structure corresponding to c.

[0107] Furthermore, among the three N-th subscriptions, the numerical range conditions included in Suber3 do not overlap with the numerical range conditions included in Suber1 and Suber2, that is, they satisfy the condition {Ω|A∩B=Ω,Ω≠A,Ω≠B}, so there is no Ω region between Suber3 and Suber1 and Suber2; furthermore, there is no partial overlap between Suber1 and Suber2, because That is, Suber2 completely contains Suber1, and there is no Ω region between Suber1 and Suber2. Figure 6 As shown, since the tree information corresponding to Suber1, Suber2 and Suber3 is R1, R2 and R3 respectively, they can be organized into a partially ordered R-tree according to the partial order relationship of R1, R2 and R3, and R2 and R3 are added to the root directory of the partially ordered R-tree. Because R2 completely protects R1, R1 is added to the directory of R2.

[0108] After the classification results of the three N-th subscriptions are written into the partial order state, the three subscriptions to be received stored in the subscription condition list are named as the M-th subscription.

[0109] It should be noted that in the condition {Ω|A∩B=Ω,Ω≠A,Ω≠B}, Ω represents a partially overlapping area, where A and B represent the range of the interval subscription conditions, such as Suber1 in Table 1. Conditions 1 and 2 together form a rectangle on a plane, see Figure 5 R1 in Table 1; Suber3 in Table 1, which consists of interval conditions Figure 5 Rectangle R3 in the box; if A represents R1 and B represents R3, then the intersection of A and B is R3. According to the formula, there is no area Ω.

[0110] Table 1 Subscription Condition List Storage 3 Nth Subscription

[0111]

[0112]

[0113] Table 2 Subscription Condition List Receive 5 Nth Subscriptions

[0114]

[0115] 2) Subscription Condition List After receiving the 5 Nth subscription as shown in Table 2, the update process of the partial order R-tree and index structure is described below:

[0116] When the subscription condition list receives the five Nth subscriptions shown in Table 2, the partial order state corresponding to the subscription condition list is the stored state, and the five Nth subscriptions are classified according to the partial order relationship of the subscription conditions of the partial order R-tree and index structure. Figure 7 As shown in the figure, since the partially ordered classes R4 and R6 divided by suber4 and suber6 overlap with the existing subscriptions in the tree, and their area size is not enough to modify the root node of the partially ordered R tree, R4 and R6 are re-divided into non-partially ordered classes and organized into an index structure, as shown in Figure 7 a and b in . Since the area of ​​R5 is completely covered by R3, R7 completely covers R8, and R7 does not overlap with the existing area, the partial order relationship is satisfied. Therefore, R5, R7 and R8 are a partial order class, which is stored in the tree structure. The pointer of R3 points to R5, and R7 points to R8. R7 is stored as a root node in the Po-R tree. Finally, all equal-value strings are divided into non-partial order classes and stored in the index structure.

[0117] It should be noted that in Figure 7 In the example, R4, R1, R2, R6, R3, R5 all have Ω regions. Ω regions lead to low matching efficiency. When a partially ordered R-tree has Ω regions, the tree structure must be modified to ensure that the R-tree does not have Ω regions.

[0118] 3) Condition matching, when the event agent receives a request event, for example, the received event is A={a=5, b=15, e=″Copy″, f=″Require″}. First, the R3 and R5 areas can be quickly located through the partially ordered R-tree. Next, the equivalent strings are searched in the index structure. Since the addresses are maintained by the buffer, e and f can be quickly located, and the corresponding blocks on the disk are found through the addresses. After the content is compared, the matching results are obtained: e→v5 and f→v5. Finally, {R3, e→v5, f→v5} and {R5, e→v5, f→v5} are intersected with subber3 and subber5 respectively, and the result is {subber5}. Since only the publishing requirements of subber5 are met, the received event is published to the subscription.

[0119] Based on the same inventive concept, an embodiment of the present invention provides a dynamic publishing and subscribing device. Since the principle of solving the technical problem of the device is similar to that of a dynamic publishing and subscribing method, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.

[0120] like Figure 8 As shown, the device mainly includes a matching unit 801, a storage unit 802 and an updating unit 803.

[0121] The matching unit 801 is used for, when monitoring a subscription to be received, obtaining a first condition included in the subscription to be received, and matching the first condition with a second condition corresponding to a plurality of Mth subscriptions stored in the subscription condition list; M is a positive integer greater than 0;

[0122] The storage unit 802 is configured to, if the first condition and any one of the second conditions have at least one different content, sequentially store the multiple subscriptions to be received into a subscription condition list according to the order of timestamps corresponding to the multiple subscriptions to be received, and name the multiple subscriptions to be received as an Nth subscription according to the order of the subscription condition list, where N is a positive integer greater than M;

[0123] Update unit 803 is used to classify each Nth subscription according to the partial order relationship corresponding to the stored state and the content of the first condition included in each Nth subscription stored in the subscription condition list, and update the partial order relationship including the partial order R tree and the index structure according to the classification result.

[0124] Preferably, the first condition includes at least any one of a character string condition, a numerical range condition and an integer condition;

[0125] The storage unit 802 is specifically used for:

[0126] The character string condition included in the first condition is inconsistent with the character string condition included in the second condition; and / or

[0127] The numerical range condition included in the first condition is inconsistent with the numerical range condition included in the second condition; and / or

[0128] The integer condition included in the first condition is inconsistent with the integer condition included in the second condition.

[0129] Preferably, the matching unit 801 is further used for:

[0130] If the subscription condition list is empty, storing the multiple subscriptions to be received in the subscription condition list in sequence according to the timestamp order corresponding to the multiple subscriptions to be received, and naming the multiple subscriptions to be received stored in the subscription condition list as the Mth subscription;

[0131] If the subscription condition list is empty, storing the multiple subscriptions to be received in the subscription condition list in sequence according to the timestamp order corresponding to the multiple subscriptions to be received, and naming the multiple subscriptions to be received stored in the subscription condition list as the Nth subscription;

[0132] The partial order state currently corresponding to the subscription condition list is an empty state. According to the content and partial order relationship of the first condition included in the multiple subscriptions to be received, the multiple subscriptions to be received are classified: the index information corresponding to the Nth subscription including the string condition is added to the index structure; and / or the tree information corresponding to the Nth subscription including the numerical range condition and satisfying {Ω|A∩B=Ω,Ω≠A,Ω≠B} is added to the root directory of the partial order R tree; and / or the tree information corresponding to the Mth subscription including the integer condition and satisfying {Ω|A∩B=Ω,Ω≠A,Ω≠B} is added to the root directory of the partial order R tree;

[0133] The classification result is written into the partial order state, the multiple subscriptions to be received stored in the subscription condition list are named as the Mth subscription, and the partial order state currently corresponding to the subscription condition list is updated to the stored state.

[0134] Preferably, the updating unit 803 is specifically used for:

[0135] Compare the content of the first condition included in the Nth subscription with the partial order relationship corresponding to the stored state:

[0136] If the first condition included in the Nth subscription has a numerical range condition that overlaps with multiple Mth subscriptions that already exist in the partial order R-tree, the index information corresponding to the Nth subscription is added to the index structure; or if the first condition included in the Nth subscription has a numerical range condition that does not overlap with multiple Mth subscriptions that already exist in the partial order R-tree, the tree information corresponding to the Nth subscription is added to the root directory of the partial order R-tree; or if the first condition included in the Nth subscription has a numerical range condition that is completely covered by any Mth subscription that already exists in the partial order R-tree, the tree information corresponding to the Nth subscription is added to the directory of the Mth subscription that completely covers the Nth subscription;

[0137] Add the index information corresponding to the Nth subscription including the integer condition to the index structure;

[0138] The index information corresponding to the Nth subscription including the string condition is added to the index structure.

[0139] Preferably, the updating unit 803 is further used for:

[0140] When a request event is received, the event is searched in a partial order relationship including a partial order R-tree and an index structure, and if the request conditions included in the event are fully met, the event is published.

[0141] It should be understood that the units included in the above-mentioned dynamic publishing and subscription device are only logical divisions based on the functions implemented by the device. In actual applications, the above-mentioned units can be superimposed or split. In addition, the functions implemented by the dynamic publishing and subscription device provided in this embodiment correspond one-to-one to the dynamic publishing and subscription method provided in the above-mentioned embodiment. The more detailed processing flow implemented by the device has been described in detail in the above-mentioned method embodiment 1, and will not be described in detail here.

[0142] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.

[0143] 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. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.

Claims

1. A dynamic publish-subscribe method, characterized in that: include: When a subscription to be received is monitored, a first condition included in the subscription to be received is obtained, and the first condition is matched with second conditions corresponding to multiple M-th subscriptions stored in the subscription condition list; M is a positive integer greater than 0; If the first condition and any one of the second conditions have at least one different content, the subscription to be received corresponding to the first condition is stored in a subscription condition list, and the multiple subscriptions to be received are named as the Nth subscription in the order of the subscription condition list, where N is a positive integer greater than M; The partial order state currently corresponding to the subscription condition list is the stored state. According to the partial order relationship corresponding to the stored state and the content of the first condition included in each Nth subscription stored in the subscription condition list, each Nth subscription is classified, and the partial order relationship including the partial order R tree and the index structure is updated according to the classification result; the first condition includes at least any one of a string condition, a numerical range condition and an integer condition; Before matching the first condition with the second conditions corresponding to the plurality of M-th subscriptions stored in the subscription condition list, the method further includes: If the subscription condition list is empty, storing the multiple subscriptions to be received in the subscription condition list in sequence according to the timestamp order corresponding to the multiple subscriptions to be received, and naming the multiple subscriptions to be received stored in the subscription condition list as the Nth subscription; The partial order state currently corresponding to the subscription condition list is an empty state. According to the content and partial order relationship of the first condition included in the multiple subscriptions to be received, the multiple subscriptions to be received are classified: the index information corresponding to the Nth subscription including the string condition is added to the index structure; and / or the tree information corresponding to the Nth subscription including the numerical range condition and satisfying {Ω|A∩B=Ω,Ω≠A,Ω≠B} is added to the root directory of the partial order R tree; and / or the tree information corresponding to the Mth subscription including the integer condition and satisfying {Ω|A∩B=Ω,Ω≠A,Ω≠B} is added to the root directory of the partial order R tree; The classification result is written into the partial order state, the multiple subscriptions to be received stored in the subscription condition list are named as the Mth subscription, and the partial order state currently corresponding to the subscription condition list is updated to the stored state.

2. The publish-subscribe method according to claim 1, characterized in that: If the first condition and any of the second conditions have at least one different content, specifically includes: The character string condition included in the first condition is inconsistent with the character string condition included in the second condition; and / or The numerical range condition included in the first condition is inconsistent with the numerical range condition included in the second condition; and / or The integer condition included in the first condition is inconsistent with the integer condition included in the second condition.

3. The publish-subscribe method according to claim 1, characterized in that: The classifying each Nth subscription according to the partial order relationship corresponding to the stored state and the content of the first condition included in each Nth subscription stored in the subscription condition list specifically includes: Compare the content of the first condition included in the Nth subscription with the partial order relationship corresponding to the stored state: If the first condition included in the Nth subscription has a numerical range condition that overlaps with multiple Mth subscriptions that already exist in the partial order R-tree, the index information corresponding to the Nth subscription is added to the index structure; or if the first condition included in the Nth subscription has a numerical range condition that does not overlap with multiple Mth subscriptions that already exist in the partial order R-tree, the tree information corresponding to the Nth subscription is added to the root directory of the partial order R-tree; or if the first condition included in the Nth subscription has a numerical range condition that is completely covered by any Mth subscription that already exists in the partial order R-tree, the tree information corresponding to the Nth subscription is added to the directory of the Mth subscription that completely covers the Nth subscription; Add the index information corresponding to the Nth subscription including the integer condition to the index structure; The index information corresponding to the Nth subscription including the string condition is added to the index structure.

4. The publish-subscribe method according to claim 1, characterized in that: After the partial order relationship including the partial order R tree and the index structure is updated according to the classification result, the following is further included: When a request event is received, the event is searched in a partial order relationship including a partial order R-tree and an index structure, and if the request conditions included in the event are fully met, the event is published.

5. A dynamic publish-subscribe device, characterized in that: include: a matching unit, configured to, when monitoring a subscription to be received, obtain a first condition included in the subscription to be received, and match the first condition with a second condition corresponding to a plurality of Mth subscriptions stored in the subscription condition list; M is a positive integer greater than 0; a storage unit, configured to store the subscription to be received corresponding to the first condition into a subscription condition list if the first condition has at least one different content from any one of the second conditions, and name the plurality of subscriptions to be received as an Nth subscription in the order of the subscription condition list, where N is a positive integer greater than M; An updating unit, configured to classify each Nth subscription according to the partial order relationship corresponding to the stored state and the content of the first condition included in each Nth subscription stored in the subscription condition list when the partial order state currently corresponding to the subscription condition list is the stored state, and to update the partial order relationship including the partial order R tree and the index structure according to the classification result; the first condition includes at least any one of a string condition, a numerical range condition and an integer condition; The matching unit is also used for: If the subscription condition list is empty, storing the multiple subscriptions to be received in the subscription condition list in sequence according to the timestamp order corresponding to the multiple subscriptions to be received, and naming the multiple subscriptions to be received stored in the subscription condition list as the Nth subscription; The partial order state currently corresponding to the subscription condition list is an empty state, and the multiple subscriptions to be received are classified according to the content and partial order relationship of the first condition included in the multiple subscriptions to be received: the index information corresponding to the Nth subscription including the string condition is added to the index structure; and / or adding the tree information corresponding to the Nth subscription that includes the numerical range condition and satisfies {Ω|A∩B=Ω,Ω≠A,Ω≠B} to the root directory of the partially ordered R-tree; and / or adding the tree information corresponding to the Mth subscription that includes the integer condition and satisfies {Ω|A∩B=Ω,Ω≠A,Ω≠B} to the root directory of the partially ordered R-tree; The classification result is written into the partial order state, the multiple subscriptions to be received stored in the subscription condition list are named as the Mth subscription, and the partial order state currently corresponding to the subscription condition list is updated to the stored state.

6. The publish-subscribe device according to claim 5, characterized in that: The storage unit is specifically used for: The character string condition included in the first condition is inconsistent with the character string condition included in the second condition; and / or The numerical range condition included in the first condition is inconsistent with the numerical range condition included in the second condition; and / or The integer condition included in the first condition is inconsistent with the integer condition included in the second condition.

7. The publish-subscribe device according to claim 5, characterized in that: The updating unit is specifically used for: Compare the content of the first condition included in the Nth subscription with the partial order relationship corresponding to the stored state: If the first condition included in the Nth subscription has a numerical range condition that overlaps with multiple Mth subscriptions that already exist in the partial order R-tree, the index information corresponding to the Nth subscription is added to the index structure; or if the first condition included in the Nth subscription has a numerical range condition that does not overlap with multiple Mth subscriptions that already exist in the partial order R-tree, the tree information corresponding to the Nth subscription is added to the root directory of the partial order R-tree; or if the first condition included in the Nth subscription has a numerical range condition that is completely covered by any Mth subscription that already exists in the partial order R-tree, the tree information corresponding to the Nth subscription is added to the directory of the Mth subscription that completely covers the Nth subscription; Add the index information corresponding to the Nth subscription including the integer condition to the index structure; The index information corresponding to the Nth subscription including the string condition is added to the index structure.

8. The publish-subscribe device according to claim 5, characterized in that: The updating unit is further configured to: When a request event is received, the event is searched in a partial order relationship including a partial order R-tree and an index structure, and if the request conditions included in the event are fully met, the event is published.