CN117251307B - Event subscription and publishing method, device, equipment and medium - Google Patents

Event subscription and publishing method, device, equipment and medium Download PDF

Info

Publication number
CN117251307B
CN117251307B CN202311490480.XA CN202311490480A CN117251307B CN 117251307 B CN117251307 B CN 117251307B CN 202311490480 A CN202311490480 A CN 202311490480A CN 117251307 B CN117251307 B CN 117251307B
Authority
CN
China
Prior art keywords
message
subscription
event
thread
file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202311490480.XA
Other languages
Chinese (zh)
Other versions
CN117251307A (en
Inventor
孙嘉怿
张世躔
黄习瑞
姚银河
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Benxi Steel Group Information Automation Co ltd
Original Assignee
Benxi Steel Group Information Automation Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Benxi Steel Group Information Automation Co ltd filed Critical Benxi Steel Group Information Automation Co ltd
Priority to CN202311490480.XA priority Critical patent/CN117251307B/en
Publication of CN117251307A publication Critical patent/CN117251307A/en
Application granted granted Critical
Publication of CN117251307B publication Critical patent/CN117251307B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/542Event management; Broadcasting; Multicasting; Notifications
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/547Remote procedure calls [RPC]; Web services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/544Remote
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/547Messaging middleware

Abstract

The disclosure relates to an event subscription publishing method, device, equipment and medium, comprising the following steps: event subscription registration is carried out, and a corresponding subscription method set is obtained through a current subscription registration object; circulating through the subscription method set, storing the subscription method in a dictionary taking the subscription event type as a key value, and packaging the subscription method set into packaging information; the message center firstly names the file of the encapsulated message in a subscription event type, then copies the file, and permanently stores the copied encapsulated message in a hard disk or a database through a storage sequence; the main thread is utilized to issue the message; after the information is released, the event and the subscriber information thereof are sent to a history record file for storage. By adopting the scheme, the exposure of the event storage position can be prevented, and the subscription event can be accurately tracked.

Description

Event subscription and publishing method, device, equipment and medium
Technical Field
The disclosure relates to the technical field of data processing, and in particular relates to an event subscription and publishing method, device, equipment and medium.
Background
In the current application event subscription and release mechanism, a large number of event registration subscriptions and release are included, the process needs explicit registration and deregistration of developers, if the developer forgets to deregister, the event storage position is exposed, and the use of the application is extremely risky. On the other hand, tracking and locating is difficult when registration events are used in large numbers in an item.
Therefore, how to prevent the exposure of event storage locations and accurately track subscription events is a current urgent issue.
Disclosure of Invention
The disclosure provides an event subscription and publishing method, device, equipment and medium, which are used for solving the problems that an event storage position is easy to expose and subscription events cannot be accurately tracked in the prior art.
In a first aspect, the present disclosure provides an event subscription publishing method, including:
event subscription registration is carried out, a corresponding subscription method set is obtained through a current subscription registration object, and caching is carried out;
circulating through the subscription method set, storing the subscription method in a dictionary taking the subscription event type as a key value, and packaging the subscription method set into packaging information;
the message center firstly names the file of the encapsulated message in a subscription event type, then copies the file, and permanently stores the copied encapsulated message in a hard disk or a database through a storage sequence;
when the message is released, if the thread mode of the message release event is a main thread, directly calling a subscription method through reflection, and if the thread mode of the message release event is not the main thread, switching the thread to the main thread through a thread processor;
after the information is published, the information middleware informs all subscribers subscribing the event type, and sends the event and the subscriber information thereof to the history record file for storage.
According to the event subscription and release method provided by the disclosure, a message center firstly names a file of an encapsulated message according to a subscription event type, then copies the file, and after the copied encapsulated message is permanently stored in a hard disk or a database through a storage sequence, after the message center is started, firstly checking whether the hard disk or the database has a message to be sent or not, and if the message to be sent exists, sending the message; after the subscriber returns the successful message, deleting the successful message and the corresponding duplicate message in the hard disk or the database.
According to the event subscription publishing method provided by the disclosure, the encapsulation message is serialized into byte data, and the byte data is converted into binary data stream.
According to the event subscription publishing method provided by the present disclosure, the persistent storage includes: and after the number of the encapsulated messages reaches a preset threshold, permanently storing the encapsulated messages in a hard disk or a database through a storage sequence.
According to the event subscription publishing method provided by the disclosure, the number of the published messages in the preset period is monitored, and when the number of the published messages reaches a threshold value, the published messages are published through the main thread.
According to the event subscription and publishing method provided by the disclosure, the priorities of different subscribers are set, and the higher the priority is, the earlier the time for receiving the message is.
According to the event subscription and release method provided by the disclosure, a sticky event is defined, so that a subscriber can receive the event released before registration through filtering setting; after receiving the viscosity event, the subscriber deletes the viscosity event.
In a second aspect, the present disclosure further provides an event subscription publishing device, including:
the registration module is used for carrying out event subscription registration, acquiring a corresponding subscription method set through a current subscription registration object and carrying out caching;
the encapsulation module circularly traverses the subscription method set, stores the subscription method in a dictionary taking the subscription event type as a key value, and packages the subscription method set into encapsulation information;
the message center firstly names the file of the encapsulated message in a subscription event type, then copies the file, and permanently stores the copied encapsulated message in a hard disk or a database through a storage sequence;
the system comprises a release module, a thread processor and a thread processor, wherein when a message is released, if a thread mode of a message release event is a main thread, a subscription method is directly called through reflection, and if the thread mode of the message release event is not the main thread, the thread is switched to the main thread through the thread processor;
and the notification module is used for notifying all subscribers subscribing the event type by the message middleware after the message is published, and sending the event and the subscriber information thereof to the history record file for storage.
Compared with the prior art, the method and the device have the advantages that event subscription registration is carried out, and a corresponding subscription method set is obtained through the current subscription registration object; circulating through the subscription method set, storing the subscription method in a dictionary taking the subscription event type as a key value, and packaging the subscription method set into packaging information; the message center firstly names the file of the encapsulated message in a subscription event type, then copies the file, and permanently stores the copied encapsulated message in a hard disk or a database through a storage sequence; the main thread is utilized to issue the message; after the information is released, the event and the subscriber information thereof are sent to a history record file for storage. By adopting the scheme, the exposure of the event storage position can be prevented, and the subscription event can be accurately tracked.
Drawings
In order to more clearly illustrate the technical solutions of the present disclosure, the following description will briefly introduce the drawings required for embodiments or the description of the prior art, and it is obvious that the drawings in the following description are some embodiments of the present disclosure, and other drawings may be obtained according to these drawings without inventive effort for a person of ordinary skill in the art.
FIG. 1 is a flow diagram of a message subscription publication schema provided by the present disclosure;
FIG. 2 is a flow chart of an event subscription publishing method provided by the present disclosure;
FIG. 3 is a schematic diagram of an event subscription publishing device provided by the present disclosure;
fig. 4 is a frame structure diagram of an electronic device provided by the present disclosure.
Detailed Description
For the purposes of making the objects, technical solutions and advantages of the present disclosure more apparent, the technical solutions in the present disclosure will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are some, but not all, embodiments of the present disclosure. All other embodiments, which can be made by one of ordinary skill in the art without inventive effort, based on the embodiments in this disclosure are intended to be within the scope of this disclosure.
In the current application event subscription and release mode, a large number of event registration subscription and release are included, explicit registration and deregistration of a developer are needed in the process, and if deregistration is forgotten, the exposure of a storage position is caused, so that all registration events existing in an operating environment are stored in a lasting mode, statistics retention is realized, and the problems of repeated definition events and lack of deregistration cannot occur in the later system expansion function.
An event publish-subscribe pattern refers to a one-to-many dependency between objects, all objects that depend on an object being notified when the state of the object changes. The message subscription and release mode shown in fig. 1 specifically includes an event publisher when event subscription and release are performed, and the publisher sends an event to a message center when the state is changed; further, after subscribing interested events from the message center, the message center sends corresponding messages to the subscription roles, so that the subscription roles can automatically update themselves.
Events represent user actions such as clicks, keystrokes, mouse movements, etc., and additionally include system-generated notifications. The application needs to respond to the event in time when it occurs and send the event to the subscriber.
Subscription refers to receiving events and providing event related handlers.
An event storage location exposure refers to when an event has no longer needed for use, the reclaimed release, and another in-use object holds a reference to the event, resulting in the event not being reclaimed normally for release, which creates a storage location exposure. Eventually, the application may crash due to excessive storage location exposure.
Fig. 2 is a flowchart of an event subscription publishing method provided in the present disclosure, as shown in fig. 2, the method includes:
step 1: event subscription registration is carried out, a corresponding subscription method set is obtained through a current subscription registration object, and caching is carried out;
in this embodiment, the subscription registration object includes attributes such as an object, a subscription event type, a subscription priority, and the like.
Step 2: circulating through a subscription method set, storing the subscription method in a HashMap dictionary which takes a subscription event type as a key value, and packaging the subscription method set into packaging information; the HashMap is a hash table, and is a data structure directly accessed according to a Key value (Key value).
Step 3: the message center firstly names the file of the encapsulated message in a subscription event type, then copies the file, and permanently stores the copied encapsulated message in a hard disk or a database through a storage sequence;
in the prior art, because the framework has no forced constraint on event naming, different components may define events with renames, and logic errors are generated. In the embodiment, the file naming is carried out on the encapsulated message by subscribing the event type, so that the hidden danger of renaming is avoided, and the logic error is reduced.
The storage mark of the message permanent storage is an event type, and the subsequent message reading is also performed by taking the event type storage mark as a unit.
In the prior art, when a message is stored, a certain probability of message loss can exist, but after the message is copied, the probability of losing both the original message and the copied mirror image message is extremely small and can be almost ignored. Therefore, the original message and the copied mirror image message are permanently stored, and the probability of storing the complete message is greatly increased.
In this embodiment, the message center firstly names the file of the encapsulated message in the subscription event type, then copies the file, and after the copied encapsulated message is permanently stored in the hard disk or the database through the storage sequence, the message center firstly checks whether the hard disk or the database has the message to be sent or not after starting, and if the message to be sent exists, the message is sent out; after the subscriber returns the successful message, deleting the successful message and the corresponding duplicate message in the hard disk or the database. In the step, after the subscriber confirms that the successful message is received, the successful message and the corresponding duplicate message are deleted, and the processed message can be released in time, so that the real-time performance of message transmission is improved, and the space of a hard disk or a database occupied by the message is reduced.
Further, the system may delete the important message by mistake, so in order to prevent the message from being deleted by mistake, the original message and the copied mirror message may be defined as a frozen message, and after deleting the frozen message, the original message may be recovered by a reactivation method.
In this embodiment, the encapsulated message is serialized into byte data and the byte data is converted into a binary data stream. The method converts byte data into binary data stream, so that the data is easy to store in a hard disk or a database, and when the data needs to be read, the related data can be directly and quickly read in the hard disk or the database. The process can save the data for a long time, and the data cannot be lost due to the power failure of the memory.
In this embodiment, the persistent storage includes: storing the encapsulation information in a cache, and permanently storing the encapsulation information in a hard disk or a database through a storage sequence after the number of the encapsulation information in the cache reaches a preset threshold. The scheme can reduce the communication times of information transmission, thereby reducing delay and improving system efficiency.
Step 4: when the message is released, if the thread mode of the message release event is a main thread, directly calling a subscription method through reflection, and if the thread mode of the message release event is not in the main thread, switching the thread to the main thread through a thread processor Handler;
a reflected call refers to the ability of an application to access, detect, and modify its own state or behavior. The flexibility and expansibility of the application program can be improved through reflection calling, the coupling property is reduced, and the self-adaption capability is improved.
In the prior art, if the thread mode of the message issue event is not in the main thread but in a plurality of sub threads, the message middleware may not monitor the issue results of all the sub threads, so that in order to better monitor all the issue results, the threads of all the message issue event are concentrated to the main thread.
Further, in this embodiment, the number of the published messages in the preset period is monitored, and when the number of the published messages reaches the threshold value, the published messages are published through the main thread.
Step 5: after the information is published, the information middleware informs all subscribers subscribing the event type, and sends the event and the subscriber information thereof to the history record file for storage.
In the prior art, if a published event or a subscribed event needs to be searched, the source tracing can only be performed in a mode of searching event references, and the difficulty of understanding code logic is increased. Particularly when temporary events are all around in the project, the difficulty can be greatly increased; in the embodiment, by adopting the function of adding the event and the subscriber to send the subscription record and establishing the function of sending the archive record by the message center event through the message middleware, the number of registered objects in the project can be known, and the parameter types of the number of methods are consistent with the parameter types of the sent event. Therefore, the event calling condition can be known, and a basis is provided for coding modification and program configuration update.
In this embodiment, the priorities of different subscribers are set, and the higher the priority, the earlier the message is received.
Before the message is issued, the method further comprises the following steps:
defining a viscosity event so that a subscriber can receive events published before registration through filtering settings; after receiving the viscosity event, the subscriber deletes the viscosity event.
A common subscription event must be receivable after subscription and if more messages are to be received, such as history information before subscription, by defining a sticky event, history information before subscription can be received.
Compared with the prior art, the method and the device have the advantages that event subscription registration is carried out, and a corresponding subscription method set is obtained through the current subscription registration object; circulating through the subscription method set, storing the subscription method in a dictionary taking the subscription event type as a key value, and packaging the subscription method set into packaging information; the message center firstly names the file of the encapsulated message in a subscription event type, then copies the file, and permanently stores the copied encapsulated message in a hard disk or a database through a storage sequence; the main thread is utilized to issue the message; after the information is released, the event and the subscriber information thereof are sent to the record file for storage. By adopting the scheme, the exposure of the storage position can be prevented, and the subscription event can be accurately tracked.
An event subscription publishing device provided by the present disclosure is described below, and a detection system described below and a detection method described above may be referred to correspondingly.
As shown in fig. 3, an event subscription publishing device includes:
the registration module is used for carrying out event subscription registration, acquiring a corresponding subscription method set through a current subscription registration object and carrying out caching;
the encapsulation module circularly traverses the subscription method set, stores the subscription method in a dictionary taking the subscription event type as a key value, and packages the subscription method set into encapsulation information;
the message center firstly names the file of the encapsulated message in a subscription event type, then copies the file, and permanently stores the copied encapsulated message in a hard disk or a database through a storage sequence;
the system comprises a release module, a thread processor and a thread processor, wherein when a message is released, if a thread mode of a message release event is a main thread, a subscription method is directly called through reflection, and if the thread mode of the message release event is not the main thread, the thread is switched to the main thread through the thread processor;
and the notification module is used for notifying all subscribers subscribing the event type by the message middleware after the message is published, and sending the event and the subscriber information thereof to the history record file for storage.
As shown in fig. 4, an electronic device 400 provided in the embodiment of the present application includes a processor 402 and a memory 401, where a computer program capable of running on the processor is stored in the memory, and the steps of the method provided in the foregoing embodiment are implemented when the processor executes the computer program.
Referring to fig. 4, the electronic device further includes: a bus 403 and a communication interface 404, the processor 402, the communication interface 404 and the memory 401 being connected by the bus 403; the processor 402 is used to execute executable modules, such as computer programs, stored in the memory 401.
The memory 401 may include a high-speed random access memory (Random Access Memory, abbreviated as RAM), and may further include a non-volatile memory (non-volatile memory), such as at least one magnetic disk memory. The communication connection between the system network element and at least one other network element is implemented via at least one communication interface 404 (which may be wired or wireless), and may use the internet, a wide area network, a local network, a metropolitan area network, etc.
Bus 403 may be an ISA bus, a PCI bus, an EISA bus, or the like. The buses may be classified as address buses, data buses, control buses, etc. For ease of illustration, only one bi-directional arrow is shown in FIG. 4, but not only one bus or type of bus.
The memory 401 is configured to store a program, and the processor 402 executes the program after receiving an execution instruction, and a method executed by an apparatus defined by a process disclosed in any embodiment of the present application may be applied to the processor 402 or implemented by the processor 402.
The processor 402 may be an integrated circuit chip with signal processing capabilities. In implementation, the steps of the methods described above may be performed by integrated logic circuitry in hardware or instructions in software in processor 402. The processor 402 may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU), a network processor (Network Processor, NP), etc.; but may also be a digital signal processor (Digital Signal Processing, DSP for short), application specific integrated circuit (Application Specific Integrated Circuit, ASIC for short), off-the-shelf programmable gate array (Field-Programmable Gate Array, FPGA for short), or other programmable logic device, discrete gate or transistor logic device, discrete hardware components. The disclosed methods, steps, and logic blocks in the embodiments of the present application may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of a method disclosed in connection with the embodiments of the present application may be embodied directly in hardware, in a decoded processor, or in a combination of hardware and software modules in a decoded processor. The software modules may be located in a random access memory, flash memory, read only memory, programmable read only memory, or electrically erasable programmable memory, registers, etc. as well known in the art. The storage medium is located in the memory 401 and the processor 402 reads the information in the memory 401 and in combination with its hardware performs the steps of the above method.
Corresponding to the event subscription publishing method, the embodiment of the application also provides a computer readable storage medium, wherein the computer readable storage medium stores computer executable instructions, and the computer executable instructions cause a processor to execute the steps of the event subscription publishing method when the computer executable instructions are called and executed by the processor.
The event subscription publishing device provided by the embodiment of the application can be specific hardware on the equipment or software or firmware installed on the equipment. The device provided in the embodiments of the present application has the same implementation principle and technical effects as those of the foregoing method embodiments, and for a brief description, reference may be made to corresponding matters in the foregoing method embodiments where the device embodiment section is not mentioned. It will be clear to those skilled in the art that, for convenience and brevity, the specific operation of the system, apparatus and unit described above may refer to the corresponding process in the above method embodiment, which is not described in detail herein.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other manners. The above-described apparatus embodiments are merely illustrative, for example, the division of the units is merely a logical function division, and there may be other manners of division in actual implementation, and for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some communication interface, device or unit indirect coupling or communication connection, which may be in electrical, mechanical or other form.
As another example, the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments provided in the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the event subscription publishing method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
It should be noted that: like reference numerals and letters in the following figures denote like items, and thus once an item is defined in one figure, no further definition or explanation of it is required in the following figures, and furthermore, the terms "first," "second," "third," etc. are used merely to distinguish one description from another and are not to be construed as indicating or implying relative importance.
Finally, it should be noted that: the foregoing examples are merely specific embodiments of the present application, and are not intended to limit the scope of the present application, but the present application is not limited thereto, and those skilled in the art will appreciate that while the foregoing examples are described in detail, the present application is not limited thereto. Any person skilled in the art may modify or easily conceive of the technical solution described in the foregoing embodiments, or make equivalent substitutions for some of the technical features within the technical scope of the disclosure of the present application; such modifications, changes or substitutions do not depart from the spirit of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application. Are intended to be encompassed within the scope of this application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (9)

1. An event subscription publishing method is characterized by comprising the following steps:
event subscription registration is carried out, a corresponding subscription method set is obtained through a current subscription registration object, and caching is carried out;
circulating through the subscription method set, storing the subscription method in a dictionary taking the subscription event type as a key value, and packaging the subscription method set into packaging information;
the message center firstly names the file of the packaged message in a subscription event type, then copies the file, permanently stores the copied packaged message in a hard disk or a database through a storage sequence, and firstly checks whether the hard disk or the database has the message to be sent or not after the message center is started, and if the message to be sent exists, the message is sent out; after the subscriber returns the successful message, deleting the successful message and the corresponding copy message in the hard disk or the database;
when the message is released, if the thread mode of the message release event is a main thread, directly calling a subscription method through reflection, and if the thread mode of the message release event is not the main thread, switching the thread to the main thread through a thread processor;
after the information is published, the information middleware informs all subscribers subscribing the event type, and sends the event and the subscriber information thereof to the history record file for storage.
2. The event subscription publishing method of claim 1, wherein the save sequence comprises:
the encapsulated message is serialized into byte data and the byte data is converted into a binary data stream.
3. The event subscription publishing method of claim 2, wherein the persistent store comprises: and after the number of the encapsulated messages reaches a preset threshold, permanently storing the encapsulated messages in a hard disk or a database through a storage sequence.
4. The event subscription publishing method of claim 1, wherein the thread mode of the message publishing event comprises:
and monitoring the quantity of the release messages in a preset period, and releasing the release messages through the main thread after the quantity of the release messages reaches a threshold value.
5. The event subscription publishing method of claim 1, wherein the message middleware informing all subscribers subscribing to an event type comprises:
the priorities of different subscribers are set, and the higher the priority is, the earlier the message is received.
6. The event subscription publishing method of claim 1, further comprising, prior to message publishing:
defining a viscosity event so that a subscriber can receive events published before registration through filtering settings; after receiving the viscosity event, the subscriber deletes the viscosity event.
7. An event subscription issuing apparatus, comprising:
the registration module is used for carrying out event subscription registration, acquiring a corresponding subscription method set through a current subscription registration object and carrying out caching;
the encapsulation module circularly traverses the subscription method set, stores the subscription method in a dictionary taking the subscription event type as a key value, and packages the subscription method set into encapsulation information;
the storage module is used for naming the file of the packaged message by the subscription event type, copying the file, permanently storing the copied packaged message in a hard disk or a database through a storage sequence, and after the message center is started, firstly checking whether the hard disk or the database has the message to be sent or not, and if the message to be sent exists, sending the message out; after the subscriber returns the successful message, deleting the successful message and the corresponding copy message in the hard disk or the database;
the system comprises a release module, a thread processor and a thread processor, wherein when a message is released, if a thread mode of a message release event is a main thread, a subscription method is directly called through reflection, and if the thread mode of the message release event is not the main thread, the thread is switched to the main thread through the thread processor;
and the notification module is used for notifying all subscribers subscribing the event type by the message middleware after the message is published, and sending the event and the subscriber information thereof to the history record file for storage.
8. An electronic device, comprising:
a processor; and
a memory in which a program is stored,
wherein the program comprises instructions which, when executed by the processor, cause the processor to perform the method according to any of claims 1-6.
9. A non-transitory computer readable storage medium storing computer instructions, wherein the computer readable storage medium has instructions or a computer program stored therein, which when run on a device, cause the device to perform the method of any of claims 1-6.
CN202311490480.XA 2023-11-10 2023-11-10 Event subscription and publishing method, device, equipment and medium Active CN117251307B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311490480.XA CN117251307B (en) 2023-11-10 2023-11-10 Event subscription and publishing method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311490480.XA CN117251307B (en) 2023-11-10 2023-11-10 Event subscription and publishing method, device, equipment and medium

Publications (2)

Publication Number Publication Date
CN117251307A CN117251307A (en) 2023-12-19
CN117251307B true CN117251307B (en) 2024-01-26

Family

ID=89129694

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311490480.XA Active CN117251307B (en) 2023-11-10 2023-11-10 Event subscription and publishing method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN117251307B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102647319A (en) * 2012-03-27 2012-08-22 许继集团有限公司 Application service system for monitoring power charging-exchanging station and interprocess communication method
CN111651281A (en) * 2020-04-27 2020-09-11 北京中交兴路信息科技有限公司 Message publishing and subscribing method and system
CN112272835A (en) * 2018-04-13 2021-01-26 普拉德有限公司 Secure licensing of user account access, including secure distribution of aggregated user account data
CN113515501A (en) * 2021-06-21 2021-10-19 清华大学 Nonvolatile memory database management system recovery method and device and electronic equipment
CN114168358A (en) * 2021-10-22 2022-03-11 济南浪潮数据技术有限公司 Message processing method and device, distributed transaction processing system and computer equipment
CN114465989A (en) * 2020-10-30 2022-05-10 京东方科技集团股份有限公司 Streaming media data processing method, server, electronic device and readable storage medium
CN116909907A (en) * 2023-07-21 2023-10-20 中兴通讯股份有限公司 Memory leakage detection method and device, electronic equipment and readable storage medium

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
IN2015DE02312A (en) * 2015-07-29 2015-08-21 Pradeep Varma
US20190303648A1 (en) * 2018-04-02 2019-10-03 QRI Group, LLC Smart surveillance and diagnostic system for oil and gas field surface environment via unmanned aerial vehicle and cloud computation
US20220374723A1 (en) * 2021-05-10 2022-11-24 Nvidia Corporation Language-guided distributional tree search

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102647319A (en) * 2012-03-27 2012-08-22 许继集团有限公司 Application service system for monitoring power charging-exchanging station and interprocess communication method
CN112272835A (en) * 2018-04-13 2021-01-26 普拉德有限公司 Secure licensing of user account access, including secure distribution of aggregated user account data
CN111651281A (en) * 2020-04-27 2020-09-11 北京中交兴路信息科技有限公司 Message publishing and subscribing method and system
CN114465989A (en) * 2020-10-30 2022-05-10 京东方科技集团股份有限公司 Streaming media data processing method, server, electronic device and readable storage medium
CN113515501A (en) * 2021-06-21 2021-10-19 清华大学 Nonvolatile memory database management system recovery method and device and electronic equipment
CN114168358A (en) * 2021-10-22 2022-03-11 济南浪潮数据技术有限公司 Message processing method and device, distributed transaction processing system and computer equipment
CN116909907A (en) * 2023-07-21 2023-10-20 中兴通讯股份有限公司 Memory leakage detection method and device, electronic equipment and readable storage medium

Also Published As

Publication number Publication date
CN117251307A (en) 2023-12-19

Similar Documents

Publication Publication Date Title
CN107239324B (en) Service flow processing method, device and system
US11907561B2 (en) Data backup method and apparatus
GB2514563A (en) Selective purging of a log structure
CN109639501B (en) Abnormal record information storage method and device
CN112506710B (en) Distributed file system data restoration method, device, equipment and storage medium
CN112217684A (en) API gateway monitoring method, device and system
CN114625767A (en) Data query method, device, equipment and readable medium
CN111343267B (en) Configuration management method and system
CN107368330B (en) Client patch repair method, device and system
CN117251307B (en) Event subscription and publishing method, device, equipment and medium
CN110737716A (en) data writing method and device
CN113760658A (en) Monitoring method, device and equipment
CN108133034B (en) Shared storage access method and related device
CN112650613B (en) Error information processing method and device, electronic equipment and storage medium
CN115129728A (en) File checking method and device
CN113485872A (en) Fault processing method and device and distributed storage system
CN114706697A (en) Method, device, equipment, medium and program product for processing message subscription event
CN112148513B (en) Method, device and storage medium for dumping single-point service data
CN111625402A (en) Data recovery method and device, electronic equipment and computer readable storage medium
CN109656927B (en) Data table early warning method and device
CN117099101A (en) Management server and method for file storage management
CN116149882B (en) Method, device, equipment and storage medium for generating interface description file
CN112051985B (en) Event triggering method, device, electronic equipment and readable storage medium
CN116594841A (en) Event persistence method, device, server and storage medium for container cluster
CN110908792A (en) Data processing method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant