CN114546674A - Method, device, electronic equipment and medium for processing service - Google Patents
Method, device, electronic equipment and medium for processing service Download PDFInfo
- Publication number
- CN114546674A CN114546674A CN202210050850.7A CN202210050850A CN114546674A CN 114546674 A CN114546674 A CN 114546674A CN 202210050850 A CN202210050850 A CN 202210050850A CN 114546674 A CN114546674 A CN 114546674A
- Authority
- CN
- China
- Prior art keywords
- task
- timing
- service
- cron expression
- receiving
- 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
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/546—Message passing systems or structures, e.g. queues
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2209/00—Indexing scheme relating to G06F9/00
- G06F2209/54—Indexing scheme relating to G06F9/54
- G06F2209/547—Messaging middleware
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2209/00—Indexing scheme relating to G06F9/00
- G06F2209/54—Indexing scheme relating to G06F9/54
- G06F2209/548—Queue
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Transfer Between Computers (AREA)
Abstract
The application discloses a method, a device, electronic equipment and a medium for processing services. By applying the technical scheme of the application, a set of timing task service method based on the quartz framework is provided, so that complete timing task service can be provided by utilizing the quartz framework, and the timing task service and a service system are completely decoupled. Meanwhile, a database is added to store the timing task information, so that a uniform timing task viewing and managing entrance can be provided. And further, the problem of over centralized processing caused by the fact that the business system does not process each timing task in order in the related technology is solved.
Description
Technical Field
The present application relates to data processing technologies, and in particular, to a method, an apparatus, an electronic device, and a medium for processing a service.
Background
With the continuous upgrading of the software business scale, the system architecture of the software is also continuously evolving, the micro-service architecture is increasingly used, and the software system with the continuously increasing scale is split into single independent micro-services which are mutually coordinated in dependence relationship.
Due to the existence of the micro-service architecture, each split timing task module can be independently developed, required functional components can be selected, independent deployment and maintenance can be carried out, and meanwhile, processing of the server can be carried out aiming at different timing tasks. However, when the number of timing tasks searched in the system is too large, if the plurality of tasks cannot be uniformly allocated, the problem that the task processing is too concentrated occurs in the system, and further, the operation pressure is increased.
Disclosure of Invention
The embodiment of the application provides a method, a device, electronic equipment and a medium for processing a service. The method and the device are used for solving the problem that processing is too concentrated due to the fact that the business system does not process each timing task in order in the related technology.
According to an aspect of an embodiment of the present application, a method for processing a service is provided, including:
receiving a cron expression which is sent by a user and used for creating a timing service by using an Http interface and/or a message queue interface;
creating at least one corresponding timing task according to the cron expression and the Quartz frame, and recording the at least one timing task into a preset task database table;
and after receiving task adjusting parameters for adjusting the target timing task, adjusting the corresponding target timing task in the task database table according to the task adjusting parameters.
Optionally, in another embodiment based on the foregoing method of the present application, the receiving, by using an Http interface, a cron expression sent by a user for creating a timing service includes:
receiving a first cron expression by using an Http interface, wherein the first cron expression comprises a name of a timing service and a corresponding service type parameter;
when the first timing service is determined to be established completely based on the first cron expression, recording the ID name of the first timing service, the first cron expression and the first timing task information into the task database table.
Optionally, in another embodiment based on the foregoing method of the present application, the receiving, by using a message queue interface, a cron expression sent by a user for creating a timing service includes:
receiving a second cron expression by using an Http interface, wherein the second cron expression comprises url of the Http interface and a request message body realized by a task;
and when the creation of a second timing service is determined to be completed based on the second cron expression, recording the ID name of the second timing service, the second cron expression and the second timing task information into the task database table.
Optionally, in another embodiment based on the foregoing method of the present application, the receiving, by using an Http interface, a cron expression sent by a user for creating a timing service includes:
receiving a third cron expression by using an mq message of a pre-agreed first routing key, wherein the third cron expression comprises a name of a timing service and a corresponding service type parameter;
when it is determined that the creation of the third timing service is completed based on the third cron expression, recording the ID name of the third timing service, the third cron expression and the third timing task information into the task database table.
Optionally, in another embodiment based on the foregoing method of the present application, the receiving, by using an Http interface, a cron expression sent by a user for creating a timing service includes:
receiving a fourth cron expression by using an mq message of a pre-agreed second routing key, wherein the fourth cron expression comprises a url of the mq message and a request message body realized by a task;
when it is determined that the fourth timing service is created based on the fourth cron expression, recording the ID name of the fourth timing service, the fourth cron expression and the fourth timing task information into the task database table.
Optionally, in another embodiment based on the foregoing method of the present application, after receiving a task adjustment parameter for adjusting a target timing task, adjusting the corresponding target timing task in the task database table according to the task adjustment parameter includes:
after receiving the task adjustment parameters, determining a target timing task corresponding to the service ID name according to the service ID name carried in the task adjustment parameters;
and searching a target service parameter corresponding to the target timing task in the task database table, and adjusting the task state of the target timing task by adjusting the target service parameter, wherein the task state comprises one of pause, recovery and deletion.
According to another aspect of the embodiments of the present application, there is provided an apparatus for processing a service, including:
the receiving module is configured to receive a cron expression which is sent by a user and used for creating a timing service by using an Http interface and/or a message queue interface;
the creating module is configured to create at least one corresponding timing task according to the cron expression and the Quartz frame, and record the at least one timing task into a preset task database table;
and the adjusting module is configured to adjust the corresponding target timing task in the task database table according to the task adjusting parameter after receiving the task adjusting parameter for adjusting the target timing task.
According to another aspect of the embodiments of the present application, there is provided an electronic device including:
a memory for storing executable instructions; and
a display for communicating with said memory to execute said executable instructions to perform the operations of any of the above described methods of processing a service.
According to a further aspect of the embodiments of the present application, there is provided a computer-readable storage medium for storing computer-readable instructions, which, when executed, perform the operations of any one of the above-mentioned methods for processing a service.
In the application, a cron expression which is sent by a user and used for creating the timing service can be received by using an Http interface and/or a message queue interface; creating at least one corresponding timing task according to the cron expression and the Quartz frame, and recording the at least one timing task into a preset task database table; and after receiving the task adjusting parameters for adjusting the target timing task, adjusting the corresponding target timing task in the task database table according to the task adjusting parameters. By applying the technical scheme of the application, a set of timing task service method based on the quartz framework is provided, so that complete timing task service can be provided by utilizing the quartz framework, and the timing task service and a service system are completely decoupled. Meanwhile, a database is added to store the timing task information, so that a uniform timing task viewing and managing entrance can be provided. And further, the problem of over centralized processing caused by the fact that the business system does not process each timing task in order in the related technology is solved.
The technical solution of the present application is further described in detail by the accompanying drawings and embodiments.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments of the application and together with the description, serve to explain the principles of the application.
The present application may be more clearly understood from the following detailed description with reference to the accompanying drawings, in which:
fig. 1 is a schematic diagram of a method for processing services according to the present application;
fig. 2-4 are schematic flow charts of the business processing method applied to the micro-service architecture according to the present application;
fig. 5 is a schematic structural diagram of an electronic device for processing services according to the present application;
fig. 6 is a schematic structural diagram of an electronic device for processing services according to the present application.
Detailed Description
Various exemplary embodiments of the present application will now be described in detail with reference to the accompanying drawings. It should be noted that: the relative arrangement of the components and steps, the numerical expressions, and numerical values set forth in these embodiments do not limit the scope of the present application unless specifically stated otherwise.
Meanwhile, it should be understood that the sizes of the respective portions shown in the drawings are not drawn in an actual proportional relationship for the convenience of description.
The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the application, its application, or uses.
Techniques, methods, and apparatus known to those of ordinary skill in the relevant art may not be discussed in detail but are intended to be part of the specification where appropriate.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, further discussion thereof is not required in subsequent figures.
In addition, technical solutions between the various embodiments of the present application may be combined with each other, but it must be based on the realization of the technical solutions by a person skilled in the art, and when the technical solutions are contradictory or cannot be realized, such a combination of technical solutions should be considered to be absent and not within the protection scope of the present application.
It should be noted that all the directional indicators (such as upper, lower, left, right, front and rear … …) in the embodiment of the present application are only used to explain the relative position relationship between the components, the motion situation, etc. in a specific posture (as shown in the drawings), and if the specific posture is changed, the directional indicator is changed accordingly.
A method for handling traffic according to an exemplary embodiment of the present application is described below in conjunction with fig. 1-4. It should be noted that the following application scenarios are merely illustrated for the convenience of understanding the spirit and principles of the present application, and the embodiments of the present application are not limited in this respect. Rather, embodiments of the present application may be applied to any scenario where applicable.
The application also provides a method, a device, electronic equipment and a medium for processing the service.
Fig. 1 schematically shows a flow chart of a method for processing a service according to an embodiment of the present application. As shown in fig. 1, the method includes:
s101, receiving a cron expression which is sent by a user and used for creating a timing service by using an Http interface and/or a message queue interface.
S102, creating at least one corresponding timing task according to the cron expression and the Quartz frame, and recording the at least one timing task into a preset task database table.
S103, after receiving task adjusting parameters for adjusting the target timing task, adjusting the corresponding target timing task in the task database table according to the task adjusting parameters.
In the related art, with the continuous upgrading of the software business scale, the system architecture of the software is continuously evolving, the micro-service architecture is increasingly used, and the software system with the continuously increasing scale is divided into single independent micro-services which are mutually coordinated in dependence relationship. Due to the existence of the micro-service architecture, each split service module can be independently developed, required functional components can be selected, independent deployment and maintenance can be carried out, and meanwhile scaling of the server can be carried out aiming at different services. However, if a micro-service architecture is pursued, firstly, the requirement on a distributed system is high, and secondly, due to the fact that the technical level and the business analysis capability of part of products and developers are insufficient, the splitting of micro-services is caused to be problematic, and as a result, too much interaction of each team is caused by the overlapping of businesses and the coupling of the development, the business of the development task itself cannot be concerned, or a large amount of redundant codes are repeatedly developed, or the pressure of part of services per se is too large, or the communication pressure between the services is large, so that the unnecessary consumption and maintenance cost are increased for the whole team and the software system.
The timing task is also a very important ring in the current software function, and the existing java implementation timing task mainly comprises a timer type, a thread delay, a scheduler thread pool, a delay queue, a quartz open source framework and the like. The functions of the quartz framework are the most comprehensive, the requirements of respective timing tasks can be realized by utilizing the cron expression, and the functions of task query suspension and recovery of the timing tasks, recovery after downtime and the like are provided, but the quartz is used as a complete timing task scheme, and the code is overweight.
In current microservice architecture system development, the timing task, as a function required by almost every service, is a high issue of such redundancy cost.
Further, the process of the method for processing the service provided by the present application may include the following steps:
according to the requirements of a quartz framework, a basic timing task function is realized;
first, the present application may implement a way of creating four sets of timing tasks. The two sets are based on an http interface and are respectively realized by utilizing a universal or customized task called by reflection and realized by a timing task service; and the timing task service is only responsible for regularly calling the tasks of the service to realize the http interface. The other two sets are based on mq monitoring and are respectively realized by utilizing a general or customized task realized by a reflection calling timing task service; and the timed task service is only responsible for timed message notification, and message monitoring processing handler of the service is notified by using mq.
In one mode, after the timing task is created, when the timing scheduler is operated, a database table is added in addition to the database of the quartz framework, and the database table is used for recording the condition of the timing task. In addition, the timing task service can develop a plurality of universal or customized task implementation classes and methods according to the overall system requirements, and after the timing time point is reached, the specified method is called to complete the implementation of the timing task by reflection.
Further, when the service module of the present application creates the timing task, the http mode or the mq mode may be selected to send the creation request to the timing task module. And the task realization is realized by a timing task module or a service module according to the requirement and the project schedule. The method comprises the steps of receiving four timing task creation modes of a cron expression used for creating a timing service, which are issued by a user, by using an Http interface and/or a message queue interface.
In one mode, when the service needs to use the timing task, the application can send the queue monitored by the given timing task according to the routing key specified by the timing task service through the message queue mq and the relevant parameters. And the timing task service needs to monitor a direct exchange (direct exchange) bound with a specified routing key, acquire and store the creation information of the timing task. Through the quartz framework, when the timing task trigger point is reached, the related content is pushed into the mq according to the requirement.
In one mode, a service module needs to implement a set of mq-based RPC communication mechanism, different task implementation handling handlers are created into a map by using annotations during service construction, specific implementation handlers and methods for messages pushed by timed tasks are confirmed according to different routing keys, switch types and message contents, and specific task implementation is performed in the handlers. The RPC communication mechanism can be used not only for notification of timed tasks, but also for conventional inter-service communication.
In the application, a cron expression which is sent by a user and used for creating the timing service can be received by using an Http interface and/or a message queue interface; creating at least one corresponding timing task according to the cron expression and the Quartz frame, and recording the at least one timing task into a preset task database table; and after receiving the task adjusting parameters for adjusting the target timing task, adjusting the corresponding target timing task in the task database table according to the task adjusting parameters. By applying the technical scheme of the application, a set of timing task service method based on the quartz framework is provided, so that complete timing task service can be provided by utilizing the quartz framework, and the timing task service and a service system are completely decoupled. Meanwhile, a database is added to store the timing task information, so that a uniform timing task viewing and managing entrance can be provided. And further, the problem of over centralized processing caused by the fact that the business system does not process each timing task in order in the related technology is solved. After the information is known, the service information such as the notification information and the like can be directly pushed to the enterprise wechat platform. So that the enterprise wechat platform completes the message sending of each user to be notified. Thereby reducing the processing burden of the platform. And further, the problem of large processing amount caused by immediately sending the related message to the service personnel in the related technology is avoided. And detecting the fault probability, and optimizing the model based on the historical collected data and the overhaul data so as to determine whether a fault equipment node exists in the service plant line in real time. Therefore, the problem that time is consumed due to the fact that whether fault equipment nodes exist in data acquired by the equipment acquisition nodes is judged manually in the related technology is solved.
Optionally, in another embodiment based on the foregoing method of the present application, the receiving, by using an Http interface, a cron expression sent by a user for creating a timing service includes:
receiving a first cron expression by using an Http interface, wherein the first cron expression comprises a name of a timing service and a corresponding service type parameter;
when the first timing service is determined to be established completely based on the first cron expression, recording the ID name of the first timing service, the first cron expression and the first timing task information into the task database table.
Optionally, in another embodiment based on the foregoing method of the present application, the receiving, by using a message queue interface, a cron expression sent by a user for creating a timing service includes:
receiving a second cron expression by using an Http interface, wherein the second cron expression comprises url of the Http interface and a request message body realized by a task;
and when the creation of a second timing service is determined to be completed based on the second cron expression, recording the ID name of the second timing service, the second cron expression and the second timing task information into the task database table.
Optionally, in another embodiment based on the foregoing method of the present application, the receiving, by using an Http interface, a cron expression sent by a user for creating a timing service includes:
receiving a third cron expression by using an mq message of a pre-agreed first routing key, wherein the third cron expression comprises a name of a timing service and a corresponding service type parameter;
when the creation of a third timing service is determined to be completed based on the third cron expression, recording the ID name of the third timing service, the third cron expression and the third timing task information into the task database table.
Optionally, in another embodiment based on the foregoing method of the present application, the receiving, by using an Http interface, a cron expression sent by a user for creating a timing service includes:
receiving a fourth cron expression by using an mq message of a pre-agreed second routing key, wherein the fourth cron expression comprises a url of the mq message and a request message body realized by a task;
when it is determined that the fourth timing service is created based on the fourth cron expression, recording the ID name of the fourth timing service, the fourth cron expression and the fourth timing task information into the task database table.
Optionally, in another embodiment based on the foregoing method of the present application, after receiving a task adjustment parameter for adjusting a target timing task, adjusting the corresponding target timing task in the task database table according to the task adjustment parameter includes:
after receiving the task adjustment parameters, determining a target timing task corresponding to the service ID name according to the service ID name carried in the task adjustment parameters;
and searching a target service parameter corresponding to the target timing task in the task database table, and adjusting the task state of the target timing task by adjusting the target service parameter, wherein the task state comprises one of pause, recovery and deletion.
In one mode, as shown in fig. 2, a flow chart provided for the present application, in which an Http interface and/or a message queue interface is used to receive a cron expression issued by a user and used to create a timing service, and create at least one corresponding timing task according to the cron expression and a Quartz frame, and record the at least one timing task in a preset task database table, includes:
the first mode is as follows:
and receiving a first cron expression by using an Http interface, wherein the first cron expression comprises the name of the timing service and the corresponding service type parameter. And when the first timed service is determined to be established based on the first cron expression, recording the ID name of the first timed service, the first cron expression and the first timed task information into a task database table.
Furthermore, the main parameters received by the http interface are a timed cron expression, a task realization class of a timed task service module, a method name, method parameters and the like; the method is realized by utilizing a java reflection mechanism and calling a task realization class in the timed task service according to an incoming class name, a method name and parameters; its return value is the Id of the timed task.
The second mode is as follows:
receiving a second cron expression by using an Http interface, wherein the second cron expression comprises url of the Http interface and a request message body realized by a task;
and when the creation of a second timing service is determined to be completed based on the second cron expression, recording the ID name of the second timing service, the second cron expression and the second timing task information into the task database table.
Furthermore, the method comprises the steps of utilizing a cron expression with a fixed time as a main parameter transmitted by an http interface, using url of the http interface of a corresponding task implementation method of a service module and using a request message body for implementing a task; the implementation is that the http interface is directly called; the return value is Id of the timing task;
the third mode is as follows:
receiving a third cron expression by using an mq message of a pre-agreed first routing key, wherein the third cron expression comprises a name of a timing service and a corresponding service type parameter;
when it is determined that the creation of the third timing service is completed based on the third cron expression, recording the ID name of the third timing service, the third cron expression and the third timing task information into the task database table.
Further, the monitoring provided by the application is used for monitoring the mq message of a direct exchange (the same applies to the following) bound with an agreed routing key (the same applies to the following), wherein the main parameters of the message are a timed cron expression, a task realization class of a timed task service module, a method name, method parameters and the like; the implementation method is characterized in that a task implementation class in a timed task service is called according to a class name, a method name and parameters by using java reflection; its return value is the Id of the timed task.
The fourth mode is that:
receiving a fourth cron expression by using an mq message of a pre-agreed second routing key, wherein the fourth cron expression comprises a url of the mq message and a request message body realized by a task;
when it is determined that the fourth timing service is created based on the fourth cron expression, recording the ID name of the fourth timing service, the fourth cron expression and the fourth timing task information into the task database table.
The method comprises the steps that mq messages of a direct switch bound with a well-agreed routing key are monitored, and the parameters of the transmitted messages are the forwarded routing key, the routing mode (unicast or broadcast) and the context used for task realization; the method is realized by pushing the message with a specified route key or route mode; the return value is Id of the timing task;
it should be noted that, in the above four ways, all there are cron expression parameters, and through the quartz framework, registration of the corresponding timing task can be completed. And subsequent control.
Further, as shown in fig. 3, the present application also needs to implement two sets of http and mq adjustment methods for the timing task, and when the service module needs to adjust the created timing task, the Id of the corresponding timing task is sent through the http or mq, that is, the existing timing task may be suspended, recovered, cron timing modified, and deleted by using the implementation function of the quartz frame.
In addition, aiming at the establishment and implementation of the timing task, the timing task service needs to implement several sets of general timing task methods according to the service needs so as to be directly called by other services; and simultaneously, customized timing task implementation classes can be developed in the timing task service according to the requirements of other business modules. This approach is not suggested and would result in a coupling of services.
In one approach, the application may also augment the snooping of MQs. The timing task can be variously customized and executed according to different business requirements by utilizing the principle of reflection, but the specific implementation logic is still in the timing task service; the established timing task can achieve decoupling of task implementation and timing, so that a timing task service master needs to maintain the timing function, and a service developer only needs to make a corresponding interface or monitor a handle, does not need to pay attention to implementation details of timing, and pays attention to solving the service.
Furthermore, as shown in fig. 4, the business service module needs to configure the relevant support of the application program on rabbitmq, and the rabbitmq uses an amqp protocol to support multiple types of switches (exchange) to handle the sending and receiving of messages. And adding a new self-defined annotation to the java program, wherein the annotation needs to be added with a parameter which is similar to url and is mainly used for appointing and positioning a specific processing class.
Wherein, a new handle is defined in the java program, which can be abstrat class or interface. One or more methods need to be defined. The subsequent implementation class is the corresponding task implementation class, the method is the task implementation method, the annotation needs to be added on the implementation class, and different methods correspond to different message source processing.
The init method is that all parameters with annotations are scanned to be used as keys, and the annotated classes are stored into a hashmap as values. The init method needs to be invoked when the project is started. The message handling class requires the handling of one or more snoops.
Finally, when receiving the mq message, the method can enter different monitoring processing methods according to different routing keys. At this time, the specific processing class is obtained from the map in a matching manner according to the designated field class url in the message, and since the processing classes are all defined abstract classes or interface subclasses, unified processing can be performed, and the task implementation method defined by the corresponding subclass can be directly called, that is, different class url fields correspond to different handles and the same subclass implementation method.
Different monitoring processing methods correspond to multiple methods of a single subclass, namely the methods can process messages from different message sources, so that different processing processes of a single type of problem to different message initiators and overall forwarding positioning can be concerned by a single handle implementation class.
Finally, because the above-mentioned flow has unified message processing class, the operations of reply to the RPC message, permission-related verification, abnormal capture processing and the like can be uniformly completed in the class, or the message content can be processed, shunted, limited and the like according to the service requirement.
In addition, by applying the technical scheme of the application, a set of timing task service method based on the quartz framework is provided, so that complete timing task service can be provided by utilizing the quartz framework, and the timing task service and a service system are completely decoupled. Meanwhile, a database is added to store the timing task information, so that a uniform timing task viewing and managing entrance can be provided. And further, the problem of over centralized processing caused by the fact that the business system does not process each timing task in order in the related technology is solved.
Optionally, what is proposed by the above scheme of the present application is actually a universal service communication processing mode based on MQ, and by using the characteristics of MQ, the processing of asynchronous non-blocking RPC can be relatively easily implemented, the ACK mechanism of MQ can ensure high reachability of messages under various scenarios as much as possible, and the master-slave mirror image of MQ and the like can ensure high availability of MQ itself. Based on the RPC communication mechanism, the communication in the service under the micro-service architecture under most of situations and high flow can be almost met, the RPC communication mechanism can be repeatedly developed as a general communication framework in a system, and other customization and function expansion of each service are facilitated.
Optionally, in another embodiment of the present application, as shown in fig. 5, the present application further provides a device for processing a service. Which comprises the following steps:
a receiving module 201, configured to receive, by using an Http interface and/or a message queue interface, a cron expression sent by a user and used for creating a timing service;
a creating module 202, configured to create at least one corresponding timing task according to the cron expression and the Quartz framework, and record the at least one timing task into a preset task database table;
and the adjusting module 203 is configured to, after receiving the task adjusting parameter for adjusting the target timing task, adjust the corresponding target timing task in the task database table according to the task adjusting parameter.
In the application, an Http interface and/or a message queue interface can be used for receiving a cron expression which is issued by a user and used for creating a timing service; creating at least one corresponding timing task according to the cron expression and the Quartz frame, and recording the at least one timing task into a preset task database table; and after receiving the task adjusting parameters for adjusting the target timing task, adjusting the corresponding target timing task in the task database table according to the task adjusting parameters. By applying the technical scheme of the application, a set of timing task service method based on the quartz framework is provided, so that complete timing task service can be provided by utilizing the quartz framework, and the timing task service and a service system are completely decoupled. Meanwhile, a database is added to store the timing task information, so that a uniform timing task viewing and managing entrance can be provided. And further, the problem of over centralized processing caused by the fact that the business system does not process each timing task in order in the related technology is solved.
In another embodiment of the present application, the receiving module 201 is configured to perform the steps including:
receiving a first cron expression by using an Http interface, wherein the first cron expression comprises a name of a timing service and a corresponding service type parameter;
when the first timing service is determined to be completely established based on the first cron expression, the ID name of the first timing service, the first cron expression and the first timing task information are recorded in the task database table.
In another embodiment of the present application, the receiving module 201 is configured to perform the steps including:
receiving a second cron expression by using an Http interface, wherein the second cron expression comprises url of the Http interface and a request message body realized by a task;
and when the creation of a second timing service is determined to be completed based on the second cron expression, recording the ID name of the second timing service, the second cron expression and the second timing task information into the task database table.
In another embodiment of the present application, the receiving module 201 is configured to perform the steps including:
receiving a third cron expression by using an mq message of a pre-agreed first routing key, wherein the third cron expression comprises a name of a timing service and a corresponding service type parameter;
when it is determined that the creation of the third timing service is completed based on the third cron expression, recording the ID name of the third timing service, the third cron expression and the third timing task information into the task database table.
In another embodiment of the present application, the receiving module 201 is configured to perform the steps including:
receiving a fourth cron expression by using an mq message of a pre-agreed second routing key, wherein the fourth cron expression comprises a url of the mq message and a request message body realized by a task;
when it is determined that the fourth timing service is created based on the fourth cron expression, recording the ID name of the fourth timing service, the fourth cron expression and the fourth timing task information into the task database table.
In another embodiment of the present application, the receiving module 201 is configured to perform the steps including:
after receiving the task adjustment parameters, determining a target timing task corresponding to the service ID name according to the service ID name carried in the task adjustment parameters;
and searching a target service parameter corresponding to the target timing task in the task database table, and adjusting the task state of the target timing task by adjusting the target service parameter, wherein the task state comprises one of pause, recovery and deletion.
FIG. 6 is a block diagram illustrating a logical structure of an electronic device in accordance with an exemplary embodiment. For example, the electronic device 300 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, an exercise device, a personal digital assistant, and the like.
In an exemplary embodiment, there is also provided a non-transitory computer readable storage medium, such as a memory, including instructions executable by an electronic device processor to perform a method of processing services as described above, the method comprising: receiving a cron expression which is sent by a user and used for creating a timing service by using an Http interface and/or a message queue interface; creating at least one corresponding timing task according to the cron expression and the Quartz frame, and recording the at least one timing task into a preset task database table; and after receiving task adjusting parameters for adjusting the target timing task, adjusting the corresponding target timing task in the task database table according to the task adjusting parameters. Optionally, the instructions may also be executable by a processor of the electronic device to perform other steps involved in the exemplary embodiments described above. For example, the non-transitory computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
In an exemplary embodiment, there is also provided an application/computer program product including one or more instructions executable by a processor of an electronic device to perform the method of processing traffic described above, the method comprising: receiving a cron expression which is sent by a user and used for creating a timing service by using an Http interface and/or a message queue interface; creating at least one corresponding timing task according to the cron expression and the Quartz frame, and recording the at least one timing task into a preset task database table; and after receiving task adjusting parameters for adjusting the target timing task, adjusting the corresponding target timing task in the task database table according to the task adjusting parameters. Optionally, the instructions may also be executable by a processor of the electronic device to perform other steps involved in the exemplary embodiments described above.
Those skilled in the art will appreciate that the schematic diagram 6 is merely an example of the electronic device 300 and does not constitute a limitation of the electronic device 300 and may include more or less components than those shown, or combine certain components, or different components, e.g., the electronic device 300 may also include input-output devices, network access devices, buses, etc.
The Processor 302 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. The general purpose processor may be a microprocessor or the processor 302 may be any conventional processor or the like, and the processor 302 is the control center of the electronic device 300 and connects the various parts of the entire electronic device 300 using various interfaces and lines.
The memory 301 may be used to store computer readable instructions and the processor 302 may implement various functions of the electronic device 300 by executing or executing computer readable instructions or modules stored in the memory 301 and by invoking data stored in the memory 301. The memory 301 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data created according to the use of the electronic device 300, and the like. In addition, the Memory 301 may include a hard disk, a Memory, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash Memory Card (Flash Card), at least one disk storage device, a Flash Memory device, a Read-Only Memory (ROM), a Random Access Memory (RAM), or other non-volatile/volatile storage devices.
The modules integrated by the electronic device 300 may be stored in a computer-readable storage medium if they are implemented in the form of software functional modules and sold or used as separate products. Based on such understanding, all or part of the flow in the method of the embodiments described above can be realized by the present application, and can also be realized by hardware related to computer readable instructions, which can be stored in a computer readable storage medium, and when the computer readable instructions are executed by a processor, the steps of the above described method embodiments can be realized.
Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the application being indicated by the following claims.
It will be understood that the present application is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the application is limited only by the appended claims.
Claims (9)
1. A method for processing services, applied to a Quartz framework, comprising:
receiving a cron expression which is sent by a user and used for creating a timing service by using an Http interface and/or a message queue interface;
creating at least one corresponding timing task according to the cron expression and the Quartz frame, and recording the at least one timing task into a preset task database table;
and after receiving task adjusting parameters for adjusting the target timing task, adjusting the corresponding target timing task in the task database table according to the task adjusting parameters.
2. The method of claim 1, wherein the receiving, by using an Http interface, a cron expression issued by a user for creating a timing service comprises:
receiving a first cron expression by using an Http interface, wherein the first cron expression comprises a name of a timing service and a corresponding service type parameter;
when the first timing service is determined to be established completely based on the first cron expression, recording the ID name of the first timing service, the first cron expression and the first timing task information into the task database table.
3. The method as claimed in claim 1, wherein said receiving, by using a message queue interface, a cron expression for creating a timing service issued by a user comprises:
receiving a second cron expression by using an Http interface, wherein the second cron expression comprises url of the Http interface and a request message body realized by a task;
and when the creation of a second timing service is determined to be completed based on the second cron expression, recording the ID name of the second timing service, the second cron expression and the second timing task information into the task database table.
4. The method of claim 1, wherein the receiving, by using an Http interface, a cron expression issued by a user for creating a timing service comprises:
receiving a third cron expression by using an mq message of a pre-agreed first routing key, wherein the third cron expression comprises a name of a timing service and a corresponding service type parameter;
when it is determined that the creation of the third timing service is completed based on the third cron expression, recording the ID name of the third timing service, the third cron expression and the third timing task information into the task database table.
5. The method of claim 1, wherein the receiving, by using an Http interface, a cron expression issued by a user for creating a timing service comprises:
receiving a fourth cron expression by using an mq message of a pre-agreed second routing key, wherein the fourth cron expression comprises a url of the mq message and a request message body realized by a task;
when it is determined that the fourth timing service is created based on the fourth cron expression, recording the ID name of the fourth timing service, the fourth cron expression and the fourth timing task information into the task database table.
6. The method as claimed in claim 1, wherein said adjusting the corresponding target timing task in the task database table according to the task adjustment parameter after receiving the task adjustment parameter for adjusting the target timing task comprises:
after receiving the task adjustment parameters, determining a target timing task corresponding to the service ID name according to the service ID name carried in the task adjustment parameters;
and searching a target service parameter corresponding to the target timing task in the task database table, and adjusting the task state of the target timing task by adjusting the target service parameter, wherein the task state comprises one of pause, recovery and deletion.
7. An apparatus for processing services, applied to a Quartz framework, comprising:
the receiving module is configured to receive a cron expression which is sent by a user and used for creating a timing service by using an Http interface and/or a message queue interface;
the creating module is configured to create at least one corresponding timing task according to the cron expression and the Quartz frame, and record the at least one timing task into a preset task database table;
and the adjusting module is configured to adjust the corresponding target timing task in the task database table according to the task adjusting parameter after receiving the task adjusting parameter for adjusting the target timing task.
8. An electronic device, comprising:
a memory for storing executable instructions; and the number of the first and second groups,
a processor for executing the executable instructions with the memory to perform the operations of the method of processing a service of any of claims 1-6.
9. A computer-readable storage medium storing computer-readable instructions that, when executed, perform the operations of the method of processing traffic of any of claims 1-6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210050850.7A CN114546674A (en) | 2022-01-17 | 2022-01-17 | Method, device, electronic equipment and medium for processing service |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210050850.7A CN114546674A (en) | 2022-01-17 | 2022-01-17 | Method, device, electronic equipment and medium for processing service |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114546674A true CN114546674A (en) | 2022-05-27 |
Family
ID=81672550
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210050850.7A Pending CN114546674A (en) | 2022-01-17 | 2022-01-17 | Method, device, electronic equipment and medium for processing service |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114546674A (en) |
-
2022
- 2022-01-17 CN CN202210050850.7A patent/CN114546674A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8171492B2 (en) | Systems and/or methods for end-to-end business process management, business event management, and/or business activity monitoring | |
CN105593817B (en) | Method and system for flexible node composition on local or distributed computer system | |
CN103516746B (en) | Method for pushing, the apparatus and system of service change message | |
JP2004348680A (en) | Composite event notification system and composite event notification program | |
CN112910995A (en) | Resource allocation method and device based on multi-cloud environment, electronic equipment and medium | |
CN101675424A (en) | Inter-process communication methods and apparatus for building scalable/redundant telecommunications systems | |
US20210149709A1 (en) | Method and apparatus for processing transaction | |
CN101213521A (en) | Mediator-based recovery mechanism for multi-agent system | |
CN111125681A (en) | Service processing method, device and storage medium | |
CN114301859A (en) | Notification message sending method and device, electronic equipment and medium | |
CN114546674A (en) | Method, device, electronic equipment and medium for processing service | |
JP2001265603A (en) | Automatic division software distribution system and method therefor | |
CN115658745A (en) | Data processing method, data processing device, computer equipment and computer readable storage medium | |
JP2003006331A (en) | Medical information managing system, medical information managing server, terminal device, production control device, distribution control device, method for controlling medical information and control program | |
CN114968617A (en) | API conversion system, access request processing method thereof, electronic device and medium | |
CN101106489A (en) | Status synchronization system and its method | |
CN113778560B (en) | Method, system, equipment and medium for custom development and execution of hospital treatment process | |
JP7524404B2 (en) | Messaging service method and apparatus | |
CN112433821B (en) | Method and device for building business model, electronic equipment and medium | |
JP7208086B2 (en) | Management system, method and program | |
JP2003150524A (en) | Information gathering system, information gathering method and data correcting program | |
CN113223679A (en) | Patient transfer process management method and device and electronic system | |
JP2812274B2 (en) | Transaction load balancing system for loosely coupled multi-computer systems | |
CN116010501A (en) | Distributed medium-level data processing method, system, device, storage medium and program product | |
JPH0879298A (en) | Electronic mail system |
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 |