CN114461419A - Message pushing method, system, computing device and readable storage medium - Google Patents

Message pushing method, system, computing device and readable storage medium Download PDF

Info

Publication number
CN114461419A
CN114461419A CN202210046851.4A CN202210046851A CN114461419A CN 114461419 A CN114461419 A CN 114461419A CN 202210046851 A CN202210046851 A CN 202210046851A CN 114461419 A CN114461419 A CN 114461419A
Authority
CN
China
Prior art keywords
message
component
message pushing
pushing
annotation
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210046851.4A
Other languages
Chinese (zh)
Inventor
宗高峰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chezhi Interconnection Beijing Technology Co ltd
Original Assignee
Chezhi Interconnection Beijing Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chezhi Interconnection Beijing Technology Co ltd filed Critical Chezhi Interconnection Beijing Technology Co ltd
Priority to CN202210046851.4A priority Critical patent/CN114461419A/en
Publication of CN114461419A publication Critical patent/CN114461419A/en
Pending legal-status Critical Current

Links

Images

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/546Message passing systems or structures, e.g. queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • G06F8/315Object-oriented languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/36Software reuse
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/73Program documentation
    • 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/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4488Object-oriented
    • G06F9/449Object-oriented method invocation or resolution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/548Queue

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Library & Information Science (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention discloses a message pushing method, a message pushing system, a computing device and a readable storage medium. The message pushing method comprises the following steps: responding to a message pushing request of a user, and analyzing a message pushing component with annotation scanned by an application development framework to obtain annotation information of the message pushing component, wherein the annotation information comprises configuration information; generating a dynamic proxy object for the message pushing component according to the annotation information, and injecting the dynamic proxy object into a container corresponding to the frame; and executing the real push logic corresponding to the message push component to finish message push. The message push system comprises: a system server; and a number of MQ servers communicatively coupled to the system server. The invention also discloses a corresponding computing device and a readable storage medium.

Description

Message pushing method, system, computing device and readable storage medium
Technical Field
The present invention relates to the field of message pushing technology of a microservice architecture, and in particular, to a message pushing method, apparatus, computing device and readable storage medium for a microservice architecture.
Background
With the development of services, the architecture of single application cannot support huge backend services, so the microservice of the server is a necessary trend. For the splitting of the micro-service, tens or hundreds of micro-services are split from lot to lot, and the communication mode between the services is not limited to synchronous communication but also comprises asynchronous message communication. Asynchronous messaging may increase application throughput, reduce application coupling, and increase development and maintenance complexity to some extent. The development of asynchronous communication based on messages needs to consider the sequentiality of message delivery, repeated consumption of messages, loss of messages, retry of messages and the like in addition to the business logic of the message.
Taking the travel mall system as an example, the travel mall system can be split into different services according to different service scenarios, such as air ticket service, hotel service, train ticket service, order service, preferential system, payment system, and the like, and the direct state synchronization and message notification of the different services are realized by means of asynchronous message communication. Asynchronous message communication can reduce the coupling degree between services, improve the throughput of application and ensure the final consistency of data. By means of the asynchronous message communication mechanism, the final consistency of the order state can be guaranteed, and the concurrency of active ticket robbing is improved.
The industry typically implements asynchronous message communication with the help of MQ servers, and the mainstream MQ services are RabbitMQ, rocktmq, and Kafka et al. Different message servers have different characteristics and different Java operation modes, and the mainstream client framework comprises spring-amqp, spring-kafka and the like. For message retries, the industry mainly relies on custom while loops or by means of spring-retry.
For asynchronous message pushing between services, the industry is mainly realized by means of MQ servers, and client frameworks connected with the MQ servers are mainly spring-amqp, spring-kafka and the like. Spring encapsulates the AMQP protocol, provides a highly encapsulated set of APIs to the outside, and allows any POJO to propagate as a message body. The Spring framework has the advantages that developers have no perception of AMQP protocols, asynchronous message pushing operation is simplified to a certain extent, but different message server characteristics and different usage methods are adopted, for example, RabbitMQ mainly relates to concepts such as a switch, a routing key and a queue, Kafka mainly relates to concepts such as a consumption group, a partition and a queue, developers need to fully master the characteristics, and application characteristics of various MQs, a client integration framework principle, a message retry mechanism and the like need to be mastered; therefore, the Spring framework is applied to the complex micro-server architecture to realize message pushing, so that developers cannot perceive MQ servers, and the technical requirements on the developers are still high.
Disclosure of Invention
To this end, the present invention provides a message pushing method, apparatus, computing device and readable storage medium in an effort to solve or at least mitigate at least one of the problems identified above.
According to an aspect of the present invention, there is provided a message pushing method, adapted to an application development framework, the method including the steps of: responding to a message pushing request of a user, analyzing a message pushing component with annotation scanned by the frame to obtain annotation information of the message pushing component, wherein the annotation information comprises configuration information; generating a dynamic proxy object for the message pushing component according to the annotation information, and injecting the dynamic proxy object into a container corresponding to the frame; and executing the real pushing logic corresponding to the message pushing component to complete message pushing.
Optionally, in the message pushing method according to the present invention, the configuration information includes a switch and a routing key.
Optionally, in the message pushing method according to the present invention, the parsing the message pushing component with the annotation scanned by the framework includes: scanning the component with the frame; when a preset scanning trigger component is scanned, starting to scan the push component to obtain a message push component with an annotation; and analyzing the message pushing component with the annotation to obtain the configuration information in the annotation.
Optionally, in the message pushing method according to the present invention, the step of generating a dynamic proxy object for the message pushing component according to the annotation information includes: and packaging the annotation information into an information descriptor of the dynamic proxy object so as to generate the dynamic proxy object.
Optionally, in the message pushing method according to the present invention, the step of executing a real pushing logic corresponding to the message pushing component includes: acquiring an object from a container corresponding to the frame; when the object is a dynamic proxy object of a message pushing component and a component pushing method corresponding to the object is a default method, executing the default method; and when the object is a dynamic proxy object of the message pushing component and the component pushing method corresponding to the object is not a default method, acquiring and executing a method caller corresponding to the component pushing method from a method cache so as to call the corresponding pushing method and execute the pushing method.
Optionally, in the message pushing method according to the present invention, the step of executing the real pushing logic corresponding to the message pushing component further includes: executing the target method when the object is not a dynamic proxy object of the message push component.
Optionally, in the message pushing method according to the present invention, the application development framework is a Springboot framework; the container corresponding to the frame is a Spring container; the annotation comprises: @ RabbitPusher, @ KafkaPusher, @ RabbitPush, and @ KafkaPush.
According to another aspect of the present invention, there is provided a message push system, including: a system server adapted to perform the method as described above; and a number of MQ servers communicatively coupled to the system server.
According to another aspect of the present invention, there is also provided a computing device comprising: at least one processor and a memory storing program instructions; the program instructions, when read and executed by a processor, cause a computing device to perform the message push method as above.
According to still another aspect of the present invention, there is also provided a readable storage medium storing program instructions, which, when read and executed by a computing device, cause the computing device to execute the message push method as above.
According to the message pushing method, the message pushing device, the computing equipment and the readable storage medium, at least one of the following beneficial effects can be realized:
developers only need to write a simple java component and select corresponding annotations to modify the push component without providing specific implementation of pushing, so that the developers really have no perception of spring-ampq, the developers are effectively prevented from writing and debugging redundant template codes, the development difficulty is reduced, and the development efficiency is improved;
the finished product form of the message pushing method is a standard spring boot Starter, the micro-service can be used only by introducing maven dependence, the Starter is internally provided with the common configuration of MQ, such as the configuration of a message serialization mode, a retry mechanism, timeout time and the like, and also supports the custom configuration, supports the characteristics of different MQ, meets the personalized requirements, and simultaneously improves the portability of the message pushing method.
Drawings
To the accomplishment of the foregoing and related ends, certain illustrative aspects are described herein in connection with the following description and the annexed drawings, which are indicative of various ways in which the principles disclosed herein may be practiced, and all aspects and equivalents thereof are intended to be within the scope of the claimed subject matter. The above and other objects, features and advantages of the present disclosure will become more apparent from the following detailed description read in conjunction with the accompanying drawings. Throughout this disclosure, like reference numerals generally refer to like parts or elements.
Fig. 1 shows a schematic diagram of a message push system 100 according to an embodiment of the invention;
FIG. 2 shows a schematic diagram of a computing device 200, according to one embodiment of the invention;
fig. 3 shows a flow diagram of a message pushing method 300 according to an embodiment of the invention;
FIG. 4 shows a timing diagram of a message push scan according to one embodiment of the invention;
fig. 5 shows a starter overall architecture diagram according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
Besides requiring developers to master various message server characteristics and usage, the existing message pushing technology has other problems, such as: the message formats in the message queues are not uniform, so that the difficulty of system docking and maintenance is increased; the portability is poor, a plurality of micro-services need different dependent packages for reference, and repeated configuration is needed; for message retry in the message pushing process, the industry is mainly realized by writing a while loop by a developer or by means of a spring-retry component provided by spring. The user-defined while loop mode is flexible, but needs to write a large amount of bloated code. Spring-retry is more elegant in use, only a retry mechanism needs to be annotated, but a large amount of repeated try-catch template codes need to be written, and a core push code of the try-catch template codes only has one line, for example:
Figure BDA0003471086890000051
Figure BDA0003471086890000061
for exception capture, a large amount of redundant template codes also need to be written, the attention of developers is dispersed, and the development efficiency is reduced.
Aiming at the problem that the development difficulty is high because developers need to master the characteristics and the use of various message servers in the existing message pushing method in the micro-service architecture, the invention provides the message pushing method for the micro-service architecture, which only needs self-defined annotation, and has low development difficulty and good portability.
The message pushing method is executed in the computing equipment. The computing device may be any device with storage and computing capabilities, and may be implemented as, for example, a server, a workstation, or the like, or may be implemented as a personal computer such as a desktop computer or a notebook computer, or may be implemented as a terminal device such as a mobile phone, a tablet computer, a smart wearable device, or an internet of things device, but is not limited thereto.
Fig. 1 shows a schematic diagram of a message push system 100 according to an embodiment of the invention.
As shown in fig. 1, the message push system 100 includes a system server 110 and several MQ servers 120, where the several MQ servers 120 may be different MQ servers. The system server 110 is communicatively connected to several MQ servers 120, respectively, for example, through a wired or wireless network connection.
It should be noted that the present invention is not limited to a particular type of system server 110. For example, the system server 110 may be implemented as a computing device such as a desktop computer, a notebook computer, a processor chip, a mobile phone, a tablet computer, etc., but is not limited thereto, and may also be an application program residing on the computing device.
In an embodiment of the invention, the system server 110 is adapted to perform a message push method. The message pushing method 300 of the present invention will be described in detail below.
In one embodiment, the system server 110 of the present invention may be implemented as a computing device, such that the message push method of the present invention may be executed in the computing device.
FIG. 2 shows a block diagram of a computing device 200, according to one embodiment of the invention. As shown in FIG. 2, in a basic configuration 202, a computing device 200 typically includes a system memory 206 and one or more processors 204. A memory bus 208 may be used for communication between the processor 204 and the system memory 206.
Depending on the desired configuration, the processor 204 may be any type of processing, including but not limited to: a microprocessor (UP), a microcontroller (UC), a digital information processor (DSP), or any combination thereof. The processor 204 may include one or more levels of cache, such as a level one cache 210 and a level two cache 212, a processor core 214, and registers 216. Example processor cores 214 may include Arithmetic Logic Units (ALUs), Floating Point Units (FPUs), digital signal processing cores (DSP cores), or any combination thereof. The example memory controller 218 may be used with the processor 204, or in some implementations the memory controller 218 may be an internal part of the processor 204.
Depending on the desired configuration, system memory 206 may be any type of memory, including but not limited to: volatile memory (such as RAM), non-volatile memory (such as ROM, flash memory, etc.), or any combination thereof. System memory 106 may include an operating system 220, one or more applications 222, and program data 224. The application 222 is actually a plurality of program instructions that direct the processor 204 to perform corresponding operations. In some embodiments, application 222 may be arranged to cause processor 204 to operate with program data 224 on an operating system.
Computing device 200 may also include a storage interface bus 234. The storage interface bus 234 enables communication from the storage devices 232 (e.g., removable storage 236 and non-removable storage 238) to the basic configuration 202 via the bus/interface controller 230. At least a portion of the operating system 220, applications 222, and data 224 may be stored on removable storage 236 and/or non-removable storage 238, and loaded into system memory 206 via storage interface bus 234 and executed by the one or more processors 204 when the computing device 200 is powered on or the applications 222 are to be executed.
Computing device 200 may also include an interface bus 240 that facilitates communication from various interface devices (e.g., output devices 242, peripheral interfaces 244, and communication devices 246) to the basic configuration 202 via the bus/interface controller 230. The example output device 242 includes a graphics processing unit 248 and an audio processing unit 250. They may be configured to facilitate communication with various external devices, such as a display or speakers, via one or more a/V ports 252. Example peripheral interfaces 244 can include a serial interface controller 254 and a parallel interface controller 256, which can be configured to facilitate communications with external devices such as input devices (e.g., keyboard, mouse, pen, voice input device, touch input device) or other peripherals (e.g., printer, scanner, etc.) via one or more I/O ports 258. An example communication device 246 may include a network controller 260, which may be arranged to facilitate communications with one or more other computing devices 262 over a network communication link via one or more communication ports 264.
A network communication link may be one example of a communication medium. Communication media may typically be embodied by computer readable instructions, data structures, program modules, and may include any information delivery media, such as carrier waves or other transport mechanisms, in a modulated data signal. A "modulated data signal" may be a signal that has one or more of its data set or its changes made in a manner that encodes information in the signal. By way of non-limiting example, communication media may include wired media such as a wired network or private-wired network, and various wireless media such as acoustic, Radio Frequency (RF), microwave, Infrared (IR), or other wireless media. The term computer readable media as used herein may include both storage media and communication media.
In a computing device 200 according to the present invention, the application 222 includes a plurality of program instructions that execute the message push method 300, which may instruct the processor 204 to perform the message push method 300 of the present invention such that the computing device 200 performs the message push method 300 of the present invention.
A message pushing method 300 according to an embodiment of the present invention includes the steps of: responding to a message pushing request of a user, analyzing a message pushing interface with annotation scanned by a Springboot to obtain an interface pushing method defined by the message pushing interface; the method comprises the steps of analyzing an interface pushing method, packaging the analyzed interface pushing method into a Bean (information description body, registering the information description body into a spring container), generating a dynamic proxy object for the analyzed interface, injecting the dynamic proxy object into the spring container, and executing real logic of the interface pushing method according to the spring container to finish message pushing.
Fig. 3 shows a flow chart of a message pushing method 300 according to an embodiment of the invention. The method 300 is performed in a computing device (such as the aforementioned computing device 200) and the application environment is a Springboot framework (as an example of an application development framework). As shown in fig. 3, the method 300 begins at step S310.
For convenience of understanding, the implementation manner of the message pushing method according to the embodiment of the present invention will be mainly described below by taking a Springboot (or Springboot framework) as an example of an application development framework, but it should be understood that the embodiment of the present invention is not limited thereto.
In step S310, in response to the message pushing request of the user, the message pushing component with annotation scanned by the Springboot is parsed, so as to obtain annotation information of the message pushing component, where the annotation information includes the switch and the routing key.
It should be noted that, the components of the present embodiment mainly refer to interfaces.
In one embodiment, developers may customize annotations such as @ xxxPusher to modify interfaces, such as @ RabbitPusher, @ kafka pusher, @ RabbitPush, and @ kafka push, each corresponding to a set of message push code that conforms to the real push logic, where the message push code may be message push code in the prior art. The developer does not need to write these codes, and in subsequent steps, the method 300 automatically generates and executes these codes, completing the pushing of the message.
In step S310, the user selects one interface with the @ xxxPusher form annotation according to actual needs, and specifies conventional configuration parameters such as push queue, routing rule, and retry mechanism. Taking an ORDER as an example of a message, a user can select @ RabbitPusher and note that a switch is E _ RABBITMQ _ ORDER, a routing key is RK _ RABBITMQ _ ORDER, and the number of retries can also be set to 3, where the switch and the routing key are necessary parameters, and the code that the user needs to write is as follows:
@RabbitPush(exchange="E_RABBITMQ_ORDER",routingKey="RK_R ABBITMQ_ORDER",retryTimes=3)
public Boolean pushOrder(Order order)
therefore, one order information is pushed, only two lines of codes need to be written, and compared with the prior art, the development difficulty is greatly reduced.
If the order, the order status, and the report import request are to be pushed simultaneously, the code that the user needs to write is as follows:
Figure BDA0003471086890000091
Figure BDA0003471086890000101
next, the system 100 starts a Springboot, which is used to scan all components. Since the Springboot defaults to scan only some components which are well defined by itself, and the above mentioned component with annotation modification of the embodiment is not in the scanning range, a scan trigger component, namely a bendefinitionregister component, needs to be predefined, when the Springboot scans to the bendefinitionregister component class, a scan action on the above mentioned component with annotation modification is triggered, and a scan program calling back the bendefinitionregister component is needed in the scanning process. After the message pushing component with the annotation is scanned, the message pushing component with the annotation is analyzed, the specific mode of the analysis can be realized by adopting a conventional method, after the analysis process is completed, configuration information in the annotation, such as a switch and a routing key, can be obtained, and according to the switch and the routing key, which queue the message is pushed to can be known.
Fig. 4 shows a timing diagram of push interface scanning according to one embodiment of the invention. As shown in fig. 4, in the component scanning process, a Springboot application is started first, and after the Springboot application is started, a springcontainer (as an example of a container corresponding to an application development framework) is automatically created, and the container standard initialization is completed. Next, Springboot scans, and when a custom benadenitionsRegistar component is scanned, the push component scan is triggered, that is, the scanning process of the push component formally starts. In the scanning process, the bendefinitionregistry is called back, pusheregittar is executed, and the push component used by the message push of this time, that is, the push component selected by the user in step S310, is scanned.
Next, in step S320, a dynamic proxy object is generated for the message pushing component according to the annotation information, and the dynamic proxy object is injected into the spring container.
In one embodiment, the spring container creates a single-instance Bean, and in the process of creating the single-instance Bean, the parsed annotation information is packaged into an information descriptor, namely a Bean definition, of the dynamic proxy object, wherein the Bean refers to a push component, so that the dynamic proxy object is generated, and then the Bean definition is registered into the spring container, and the registration refers to registering the dynamic proxy object in the spring container.
In one embodiment, a dynamic proxy object is generated for the message push component by means of Jdk dynamic proxy.
Steps S310 and 320 are actually transcoding processes. Before the method 300 starts, the system 100 has set a message push code corresponding to each selectable message push component, and after steps S310 and S320 are finished, the system 100 automatically generates a message push code corresponding to the push component selected by the user.
Next, in step S330, a real push logic corresponding to the message pushing component is executed, and message pushing is completed. The essence of invoking the push component is to invoke a dynamic proxy method of the push component, executing the true push logic.
In one embodiment, the actual logic of message pushing may be performed according to the following procedure. First, a bean is obtained from the spring container, it should be noted that there may be several beans in the spring container, wherein a part of the beans is from the message pushing component with annotation decoration, that is, the message pushing component selected by the user in step S310, and another part of the beans is from other conventional pushing components, and different pushing components correspond to different pushing logics. Then, after it needs to be determined which type of sending component the bean corresponds to, then the real logic corresponding to the bean is called and the real logic is executed, which specifically includes: judging whether the obtained bean is a dynamic proxy object of the message pushing component, judging whether the Rabbit carries annotation modification or not according to the judgment, if the Rabbit does not carry the annotation modification, indicating that the bean is from a conventional pushing component and is not the dynamic proxy object of the message pushing component, executing a target method, wherein the target method refers to a component pushing method corresponding to the bean; if the Rabbit is modified by the annotation, it indicates that the bean is from the message pushing component selected by the user in step S310 and belongs to a dynamic proxy object, at this time, it needs to further determine whether the component pushing method corresponding to the bean is a default method, where the default method refers to a default method in the Java grammar specification, if the component pushing method is the default method, the default method is executed, if the component pushing method is not the default method, a method invoker for pushing decoupling, i.e., methodlnvoker, is obtained from a method cache, and the methodlnvoker is executed, and the true logic of the corresponding component pushing method is invoked (i.e., in the conventional pushing method, a program written by a developer for executing a message pushing task) to complete the pushing of the message.
The execution part of the message pushing logic encapsulates a message pushing implementation layer, uniformly encapsulates message contents, and uniformly processes parameters which are commonly used by the message and are irrelevant to the service, such as parameters of unique message self-increment id, message timestamp and the like.
The method 300 packages the operation of the rabbitMQ into a starter which accords with the spring boot development specification, and realizes code decoupling. For other types of servers, such as kafka, etc., the operation of the MQ may be packaged as a starter in the same manner as the method 300.
Fig. 5 shows a starter overall architecture diagram according to an embodiment of the present invention. As shown in fig. 5, sboot-startup-parent is a custom startup top module, which is used to define common dependency and version information, etc.; the sboot-starter-MQ is a public module of MQ series starters and provides an automatic configuration function; the sboot-starter-rabbitmq is a rabbitmq-based declarative push implementation module; the sboot-starter-kafka is a declarative push implementation module based on a kafka message server; sboost-starter-xxx is an extension module, such as a RockettMq, ActiveMq and the like. The arrows in the figure show the dependency and inheritance relationships between the modules.
The message pushing method 300 of the embodiment of the present invention provides a new form for message pushing in a microservice architecture, the pushed message is a declarative message, that is, a message with annotation modification, and developers only need to select a pushing interface and specify configuration information such as a pushing queue, a routing rule, a retry mechanism, etc., and the message pushing of different MQ servers can be completed without providing specific implementation of pushing. Compared with the conventional message pushing mode, the message pushing method 300 of the embodiment of the invention has the following advantages:
the method has the advantages that developers only need to write a simple java interface, select a pushed interface method and then use a method for pushing annotation modification interfaces, specific implementation of pushing is not needed, the developers really do not sense the spring-ampq, development difficulty is reduced, writing and debugging of redundant template codes by the developers are effectively avoided, and development efficiency is improved.
The pushed statement annotation is separated from the realization, so that developers can concentrate on business logic more without concerning the details of message pushing realization, and the integrated design of the system is easy.
The execution part of the push logic encapsulates the implementation layer of message push, uniformly encapsulates message contents, uniformly processes parameters which are commonly used by messages and are irrelevant to services, and the uniform message format is convenient for the butt joint among different systems and is also beneficial to later-stage upgrading maintenance.
The finished product form of the message pushing method is a standard spring boot Starter, the micro-service can be used only by introducing maven dependence, the Starter is internally provided with the common configuration of MQ, such as the configuration of a message serialization mode, a retry mechanism, timeout time and the like, and also supports the custom configuration, supports the characteristics of different MQ, meets the personalized requirements, and simultaneously improves the portability of the message pushing method.
The retry times, retry intervals, exception mechanisms, etc. of the messages can be flexibly configured.
The various techniques described herein may be implemented in connection with hardware or software or, alternatively, with a combination of both. Thus, the methods and apparatus of the present invention, or certain aspects or portions thereof, may take the form of program code (i.e., instructions) embodied in tangible media, such as removable hard drives, U.S. disks, floppy disks, CD-ROMs, or any other machine-readable storage medium, wherein, when the program is loaded into and executed by a machine, such as a computer, the machine becomes an apparatus for practicing the invention.
In the case of program code execution on programmable computers, the computing device will generally include a processor, a storage medium readable by the processor (including volatile and non-volatile memory and/or storage elements), at least one input device, and at least one output device. Wherein the memory is configured to store program code; the processor is configured to execute the automatic verification method of the present invention according to instructions in the program code stored in the memory.
By way of example, and not limitation, readable media may comprise readable storage media and communication media. Readable storage media store information such as computer readable instructions, data structures, program modules or other data. Communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media. Combinations of any of the above are also included within the scope of readable media.
In the description provided herein, algorithms and displays are not inherently related to any particular computer, virtual system, or other apparatus. Various general purpose systems may also be used with examples of this invention. The required structure for constructing such a system will be apparent from the description above. Moreover, the present invention is not directed to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of the present invention as described herein, and any descriptions of specific languages are provided above to disclose preferred embodiments of the invention.
In the description provided herein, numerous specific details are set forth. It is understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: that the invention as claimed requires more features than are expressly recited in each claim. Those skilled in the art will appreciate that the modules or units or components of the devices in the examples disclosed herein may be arranged in a device as described in this embodiment or alternatively may be located in one or more devices different from the devices in this example. The modules in the foregoing examples may be combined into one module or may be further divided into multiple sub-modules.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. The modules or units or components of the embodiments may be combined into one module or unit or component, and furthermore they may be divided into a plurality of sub-modules or sub-units or sub-components. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features included in other embodiments, rather than other features, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. Furthermore, some of the described embodiments are described herein as a method or combination of method elements that can be performed by a processor of a computer system or by other means of performing the described functions. A processor having the necessary instructions for carrying out the method or method elements thus forms a means for carrying out the method or method elements. Further, the elements of the apparatus embodiments described herein are examples of the following apparatus: the apparatus is used to implement the functions performed by the elements for the purpose of carrying out the invention.
As used herein, unless otherwise specified the use of the ordinal adjectives "first", "second", "third", etc., to describe a common object, merely indicate that different instances of like objects are being referred to, and are not intended to imply that the objects so described must be in a given sequence, either temporally, spatially, in ranking, or in any other manner.
While the invention has been described with respect to a limited number of embodiments, those skilled in the art, having benefit of this description, will appreciate that other embodiments can be devised which do not depart from the scope of the invention as described herein. Furthermore, it should be noted that the language used in the specification has been principally selected for readability and instructional purposes, and may not have been selected to delineate or circumscribe the inventive subject matter.

Claims (10)

1. A message pushing method is suitable for an application development framework, and comprises the following steps:
responding to a message pushing request of a user, analyzing a message pushing component with annotation scanned by the frame to obtain annotation information of the message pushing component, wherein the annotation information comprises configuration information;
generating a dynamic proxy object for the message pushing component according to the annotation information, and injecting the dynamic proxy object into a container corresponding to the frame; and
and executing the real pushing logic corresponding to the message pushing component to complete message pushing.
2. The message pushing method of claim 1, wherein the configuration information includes a switch and a routing key.
3. The message pushing method according to claim 1, wherein the parsing the annotated message pushing component scanned by the framework comprises:
scanning the component with the frame;
when a preset scanning trigger component is scanned, starting to scan the push component to obtain a message push component with an annotation; and
and analyzing the message pushing component with the annotation to obtain the configuration information in the annotation.
4. The message pushing method according to any one of claims 1 to 3, wherein the step of generating a dynamic proxy object for the message pushing component according to the annotation information comprises:
and packaging the annotation information into an information descriptor of the dynamic proxy object so as to generate the dynamic proxy object.
5. The message pushing method according to any one of claims 1 to 3, wherein the step of executing the real pushing logic corresponding to the message pushing component comprises:
acquiring an object from a container corresponding to the frame;
when the object is a dynamic proxy object of a message pushing component and a component pushing method corresponding to the object is a default method, executing the default method; and
and when the object is a dynamic proxy object of the message pushing component and the component pushing method corresponding to the object is not a default method, acquiring and executing a method caller corresponding to the component pushing method from a method cache so as to call the corresponding pushing method and execute the pushing method.
6. The message pushing method according to claim 5, wherein the step of executing the real pushing logic corresponding to the message pushing component further comprises:
executing the target method when the object is not a dynamic proxy object of the message push component.
7. The message pushing method according to any one of claims 1 to 3, wherein the application development framework is a Springboot framework; the container corresponding to the frame is a Spring container;
wherein the annotation comprises: @ RabbitPusher, @ KafkaPusher, @ RabbitPush, and @ KafkaPush.
8. A message push system, comprising:
a system server adapted to perform the method of any one of claims 1-7; and
a number of MQ servers communicatively coupled to the system server.
9. A computing device, comprising:
at least one processor and a memory storing program instructions;
the program instructions, when read and executed by the processor, cause the computing device to perform the message push method of any of claims 1-7.
10. A readable storage medium storing program instructions that, when read and executed by a computing device, cause the computing device to perform the message push method of any of claims 1-7.
CN202210046851.4A 2022-01-14 2022-01-14 Message pushing method, system, computing device and readable storage medium Pending CN114461419A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210046851.4A CN114461419A (en) 2022-01-14 2022-01-14 Message pushing method, system, computing device and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210046851.4A CN114461419A (en) 2022-01-14 2022-01-14 Message pushing method, system, computing device and readable storage medium

Publications (1)

Publication Number Publication Date
CN114461419A true CN114461419A (en) 2022-05-10

Family

ID=81410318

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210046851.4A Pending CN114461419A (en) 2022-01-14 2022-01-14 Message pushing method, system, computing device and readable storage medium

Country Status (1)

Country Link
CN (1) CN114461419A (en)

Similar Documents

Publication Publication Date Title
US11829787B2 (en) Multi-process model for cross-platform applications
US9619304B2 (en) Automatic connections between application components
US11537606B2 (en) Solution for implementing computing service based on structured query language statement
WO2022199111A1 (en) Method and apparatus for implementing functions in application program, electronic device and storage medium
US9069549B2 (en) Machine processor
US11726799B2 (en) Preventing framework conflicts for multi-OS applications
WO2017219526A1 (en) Method for using graphic file format and storage device
US20130198325A1 (en) Provision and running a download script
US20210329100A1 (en) System and method for use of remote procedure call with a microservices environment
US20130176320A1 (en) Machine processor
US20130103931A1 (en) Machine processor
US9448823B2 (en) Provision of a download script
CN112925539A (en) Application updating method, computing device and storage medium
CN112416348A (en) Page generation method and system and computing equipment
CN114461419A (en) Message pushing method, system, computing device and readable storage medium
CN107797793B (en) Method and device for constructing proxy server framework
WO2022099913A1 (en) Interface configuration method and apparatus, and device and medium
WO2018121652A1 (en) Method and device for connecting wireless access point through application in user equipment
CN115576711A (en) Method and system for simulating returned data and computing equipment
CN110262912B (en) Calling method and device for procedure call gRPC
CN115982257A (en) Interface creation method and related device
CN115618147A (en) Page updating method and device, computing equipment and storage medium
JP2003114874A (en) Web server device, method of controlling web server device, program, and recording medium
CN115617230A (en) Application split-screen display method and device, computing equipment and storage medium
CN115756802A (en) Asynchronous task processing method, device, equipment and medium

Legal Events

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