CN111930355A - Web back-end development framework and construction method thereof - Google Patents

Web back-end development framework and construction method thereof Download PDF

Info

Publication number
CN111930355A
CN111930355A CN202010807848.0A CN202010807848A CN111930355A CN 111930355 A CN111930355 A CN 111930355A CN 202010807848 A CN202010807848 A CN 202010807848A CN 111930355 A CN111930355 A CN 111930355A
Authority
CN
China
Prior art keywords
module
framework
core
component
development
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.)
Granted
Application number
CN202010807848.0A
Other languages
Chinese (zh)
Other versions
CN111930355B (en
Inventor
杨岗
王波
廖文绪
周正斌
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Creative Information Technology Co ltd
Original Assignee
Creative Information 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 Creative Information Technology Co ltd filed Critical Creative Information Technology Co ltd
Priority to CN202010807848.0A priority Critical patent/CN111930355B/en
Publication of CN111930355A publication Critical patent/CN111930355A/en
Application granted granted Critical
Publication of CN111930355B publication Critical patent/CN111930355B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/20Software design
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/3636Software debugging by tracing the execution of the program
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Stored Programmes (AREA)

Abstract

The invention discloses a web back-end development framework, which comprises a basic function module, a web back-end development module and a web back-end development module, wherein the basic function module is used for integrating a web back-end development technology, and is constructed on the basis of a common package, so that other function modules can be conveniently developed; the module function module is used for providing additional and customizable functions in a module mode, and the functions exist in the form of separate sub-modules after being completed, so that developers can conveniently introduce and use the modules in development; and the micro-service function module is used for expanding other micro-service sub-modules by taking the app-core module as a core on the basis of the basic function module. The invention also provides a construction method of the web back-end development framework. The technical integration problem in the existing development framework can be solved through the scheme, the development efficiency is improved, the flexibility and the expandability are high, the third-party framework can be flexibly integrated, the existing functions can be expanded in a component passing mode, the cross-platform performance is good, and cross-platform deployment is supported.

Description

Web back-end development framework and construction method thereof
Technical Field
The invention relates to the technical field of computers, in particular to a web back-end development framework and a construction method thereof.
Background
A software framework generally refers to a specification of software components for implementing an industry standard or for performing a particular basic task, and also refers to a software product that provides the basic functionality required by the specification for implementing a software component specification.
The framework functions like an infrastructure, independent of the specific software application, but provides and implements the most basic software architecture and architecture. Software developers typically implement more complex business applications and business logic depending on the particular framework. Such software applications may run in software systems that support the same framework.
The existing web back-end development framework has the disadvantages of incomplete basic technology integration, poor development flexibility and expandability and unfriendly cross-platform performance.
Disclosure of Invention
The invention aims to overcome the defects of the prior art and provides a web back-end development framework and a construction method thereof.
The purpose of the invention is realized by the following technical scheme:
a web back-end development framework comprises a basic function module, a web back-end development module and a web back-end development module, wherein the basic function module is used for integrating a web back-end development technology, and is constructed on the basis of a common package, so that other function modules can be developed conveniently;
the module function module is used for providing additional and customizable functions in a module mode, and the functions exist in the form of separate sub-modules after being completed, so that developers can conveniently introduce and use the modules in development;
and the micro-service function module is used for expanding other micro-service sub-modules by taking the app-core module as a core on the basis of the basic function module.
Specifically, the basic function module specifically comprises a dynamic data source module, a Druid connection pool module, a cache module, a log management module, an asynchronous processing module, a global exception handling module, an ID generator module, an automatic audit module, a paging plug-in module and a slow query tracking module.
Specifically, the components in the component function module include an interface configuration component, a file uploading component, a workflow component, a timing task component, and a system management component.
Specifically, the functions in the micro service function module include a registration center, a gateway, a configuration center, current limiting, uniform authentication, distributed transaction and uniform monitoring.
Specifically, the common packet specifically includes common-api, common-core, common-jpa, common-mybasic, common-security-core, common-security-client, and common-security-server.
Specifically, a map is provided inside the dynamic data source module, the alias of the actual connection database is stored by the key of the map, and the actual data source is stored by the vlaue.
Specifically, the asynchronous processing module comprises a bounded thread pool and an asynchronous annotation; the bounded thread pool is used for automatically selecting the optimal thread number according to the CPU core number of the operating system when the project is started; the asynchronous annotation is used to label operations in the asynchronous processing.
Specifically, the global exception handling module includes a unified exception class KeepException, which is used to automatically capture an exception thrown by the rest layer in the process of developing the interface.
Specifically, the ID generator module takes a snowflake algorithm as an ID generation strategy of the module, and the ID generated by the module comprises a first-order invalid character, a timestamp difference value, a machine code and a serial number.
A method for constructing a web back-end development framework comprises the following steps:
s1, designing a basic function module framework of the framework, selecting basic functions according to the basic function module framework for development, and packaging to form a basic component library of the framework;
s2, designing a component function module architecture, developing component functions according to the component function module architecture, and packaging to form a component library of the framework;
s3, designing a micro-service function module architecture, expanding and developing the micro-service function of the deployment frame by taking the app-core module as a core, and simultaneously packaging to form a micro-service function library of the frame;
and S4, integrating to form a web back-end development framework according to the basic component library, the component library and the micro service function library.
The invention has the beneficial effects that:
1. ease of use: the framework has clear functional division, all functions provide corresponding APIs or configuration documents, and the configuration is simplified as much as possible. The programming habit of developers is also met in use, and the developers can quickly get on hand. The integration problem is solved when the technologies are integrated into the framework, developers do not need to consider the integration problem and only need to use the integration problem;
2. development efficiency: common functions and technologies are packaged for the second time, so that the development efficiency is greatly improved;
3. the comprehensiveness: the functions of the internet hot technology cover more than 90%, developers do not need to integrate the related technologies by themselves and only need to find the technologies needed by themselves for use;
4. flexibility: developers can freely select the needed technology, and only need to make corresponding maven introduction in engineering;
5. and (3) expandability: the framework uses maven to manage modules and spring to develop foundation construction. The third-party framework can be flexibly integrated, and the existing functions can be expanded in a component mode;
6. cross-platform performance: JAVA development is adopted, and cross-platform deployment support is achieved.
Drawings
FIG. 1 is a functional architecture diagram of the development framework of the present invention.
Fig. 2 is a basic functional block architecture diagram of the present invention.
Fig. 3 is a block diagram of the functional block architecture of the assembly of the present invention.
Fig. 4 is a micro service function module architecture diagram of the present invention.
FIG. 5 is a flow chart of a method for constructing a web backend development framework of the present invention.
Detailed Description
In order to more clearly understand the technical features, objects, and effects of the present invention, embodiments of the present invention will now be described with reference to the accompanying drawings.
In this embodiment, as shown in fig. 1, a web backend development framework includes a basic function module, a component function module, and a micro-service function module. The basic function module is used for integrating the web back-end development technology, and the basic function module for web back-end development is constructed on the basis of the common package, so that other function modules can be developed conveniently. The component function module is used for providing additional and customizable functions in a component mode, and the functions exist in the form of separate sub-modules after being completed, so that development personnel can conveniently introduce and use the sub-modules in development. The micro-service function module is used for expanding other micro-service sub-modules by taking the app-core module as a core on the basis of the basic function module.
In this embodiment, the basic function module is configured as shown in fig. 2, and the basic function module is divided into 7 packets: common-api, common-core, common-jpa, common-mybases, common-security-core, common-security-client, and common-security-server.
common-api and common-core are basic parts, where some basic DTO, enumeration, constants, exception information, etc. are defined in common-api. common-core relies on common-api, and functions such as dynamic data sources, jdbc connection pools, cache, log, asynchronous and global exception handling are provided in common-core.
common-jpa and common-mybases are the ORM capability portion of the framework, and in development, may be 1 out of 2. The common-JPA uses JPA technology, and common-Mybatis uses Mybatis and MybatisPlus technology. Both packages provide their own ID generator and automatic audit functions, and common-mybatis also provides paging and slow query tracking functions.
common-security-core, common-security-client and common-security-server are the authentication basic part of the framework and are based on the oauth2 protocol for authentication. Wherein, the common-security-core is the basis of the common-security-client and the common-security-server, and provides the functions of Token analysis, Token conversion, Cookietoken analysis and the like. The common-security-client mainly provides functions of configuration, authorization and the like of the resource server, and the common-security-server mainly provides functions of configuration, authentication and the like of the authentication server.
The basic function module comprises a dynamic data source module, a Druid connection pool module, a cache module, a log management module, an asynchronous processing module, a global exception handling module, an ID generator module, an automatic audit module, a paging plug-in module and a slow query tracking module.
The dynamic data source module is used for providing flexible data sources for developers and is beneficial to expansion. In the actual development process, developers often encounter the need to connect or operate multiple databases. If a plurality of data sources are configured only during development, if the operation database needs to be changed due to the change of requirements, or the operation database needs to be increased or decreased, the configuration needs to be modified, and codes need to be modified, so that the method is not flexible enough and is not beneficial to expansion. The custom dynamic DataSource inherits from the AbstractRouteingDataSource, a map is provided in the data source, the key of the map stores the alias of the actual connection, and the value stores the actual data source. The default key of the dynamic DataSource is default, and each of the other data sources has its own unique key. In the method of using the non-default data source, the data source to be used can be specified by specifying the key of the data source through the @ TargetDataSource annotation. If not, the default data source is used.
The Druid connection pool module is used for providing the database connection which can be reused, and the response time to the request and the performance of the server are improved. The Druid is called a database connection pool configuration specially generated for monitoring, integrates the advantages of connection pools such as c3p0, dbcp, proxool and the like, and is added with a log monitoring function to effectively monitor the execution condition and performance of DB pool connection and SQL, so that the Druid connection pool is integrated in the web back-end development framework.
The cache module is used for relieving the pressure of a large number of data access requests on the database. Data access is the most common requirement for any web application system. For a data access request of a client, the system queries the database in the background and then responds the queried result to the client. In a highly concurrent scenario, if we go to query the database for each data access request, it will put a lot of stress on the database. The cache is managed by using a cache manager in a springboot technology, wherein Rediscache is set as a default cache to realize, and the serialization mode selects the serial number mode of the Object. On the method needing to increase the cache, the cache can be increased by using @ CachePut. Where the cache needs to be removed after the database data is modified, the cache can be removed using @ cacheEvent.
The log management module is used for uniformly managing log codes in the service development process. To this end, the framework integrates a logback component to manage logs in the framework. logback is currently divided into three modules: logback-core, logback-class and logback-access. The logback-core is the base module for the other two modules. Furthermore, the complete implementation of the SLF4J API by the logback-class allows developers to easily switch to other Logging systems such as log4j or JDK14 Logging. The framework of the invention integrates the log-access module with Servlet container, providing the function of accessing the log through Http.
And the asynchronous processing module is used for carrying out asynchronous processing on the attached events in the client request. For some client requests, there may be something attached to the requests that the server does, and the user does not care about the things or does not need to immediately take the processing results of the things, which is suitable for processing the things in an asynchronous manner. The conventional solution is to create a Thread to perform asynchronous operation by means of new Thread () in the program, but the Thread is often confused and difficult to manage, and some more serious problems may also occur. Thus, the framework design of the present invention provides a thread pool called asyncExecutor, which is a bounded thread pool. When the project is started, the optimal thread number can be automatically selected according to the CPU core number of the operating system. An asynchronous annotation is then provided for annotating the asynchronous operation. A developer only needs to make @ Async annotation on a method needing to use asynchronous operation, and the method uses an asyncExecutor thread pool to asynchronously execute the method.
The global exception handling module is used for processing program exceptions in a targeted manner according to preset exception handling logic, so that the program is recovered to be normal and continuously executed as much as possible, and the clearness of the code is kept. Therefore, a unified exception class KeepException is defined in the framework of the invention, and the exception thrown at the rest layer is captured by @ controlleradview. When a developer develops an interface, the exception does not need to be captured through try catch code at the rest layer, and the framework automatically captures the thrown exception. In addition, anywhere the framework will do a uniform interception process as long as the exception thrown by the developer is KeepException.
The ID generator module is used for generating a unique ID for the business data when the business data is stored. In the web system, the service data must have a unique ID as long as it is stored in the database. Particularly in a distributed system, the ID is more globally unique. When the ID generator generates an ID, an ID generation policy is required. The performance of the ID generator is directly influenced by the quality of the ID generation strategy. The framework of the invention adopts a snowflake algorithm as an ID generating strategy, the generated ID consists of four parts, namely a first-order invalid character, a timestamp difference value, a machine (process) code and a serial number, an ID generator module binds the relevant logic generated by the ID in the IdEntity, and the ID can be automatically generated when the entity of the IdEntity is inherited and an inserting operation is carried out.
And the automatic auditing module is used for tracking the problems through data by developers. The framework of the present invention provides an audioentity that has inherited the idenity. Therefore, as long as the entity that inherits the audioentity is equivalent to inheriting the idenity, the function of automatically generating the ID is also provided. Meanwhile, the AuditEntity inherits the entity of AuditEntity and also has the function of automatic audit. When the plug-in operation is performed, the creator and the creation time can be automatically generated, and when the update operation is performed, the updater and the update time can be automatically generated, so that the development efficiency of developers is greatly improved.
The paging plug-in module is used for providing a paging query function for developers. When the data volume is large, it is unreasonable to query all the data displayed on the page at one time. The invention provides a universal paging query plug-in, which can automatically perform paging query only by creating a Page object, indicating a Page and a size, and then taking the Page object as a parameter of a selected Page method.
The slow query tracking module is used for optimizing the SQL query statement. In a web system, if there are some SQL statements to be executed for a long time, this can result in a drastic drop in database performance, eventually affecting the entire application. Therefore, a slow query tracking function is required to find out and optimize the SQL statements with slow execution efficiency. Therefore, the framework of the invention integrates the slow query monitoring plug-in, and optimizes the SQL sentences which have long query execution time and poor query efficiency. Since the slow query tracking function requires the log to be printed, the default setting is off, and sql. The default slow-query threshold is 10 ms, which can be modified by the value of sql.
In this embodiment, the component functional module architecture is as shown in fig. 3, and each component in the component functional module is independent from each other, but depends on the common-core in the basic functional module. The components of the system comprise an interface configuration component, a file uploading component, a workflow component, a timing task component and a system management component.
In this embodiment, the architecture of the micro service function module is shown in fig. 4, and its main functions include a registration center, a gateway, a configuration center, current limiting, unified authentication, distributed transaction, and unified monitoring. The micro-service function module takes an app-core module as a core, and all other sub-modules are extended from the app-core module. The registry has 2 cores, eureka-core and alibaba-core. An eureka registry may be implemented by relying on eureka-core, and a nacos registry may be implemented by relying on alibaba-core.
The configuration center has 2 cores, which are respectively alibaba-core and config-server-core. The nacos configuration center can be realized by depending on the alibaba-core, and the config configuration center can be realized by depending on the config-server-core.
The gateway has 2 cores, zuul-core and gateway-core. The zuul gateway can be realized by depending on the zuul-core, and the gateway can be realized by depending on the gateway-core.
There are 2 cores, alibaba-core and app-cpre, for current limiting. The sentinel current limiting can be realized by depending on the alibaba-core, and the hystrix current limiting can be realized by depending on the app-core.
The distributed transaction is directly realized from the app-core, and the data distributed transaction client is realized.
Unified authentication needs to depend on the uaa-core, and the uaa-core realizes a unified authentication center.
There are 3 packets monitored, admin-core, hystrix dashboard-core and app-core respectively. The admin monitoring can be realized by relying on the admin-core, the hystrix dashboard monitoring can be realized by relying on the hystrix dashboard-core, and the slauth, zipkin and skywalk monitoring can be realized by relying on the apps-cores only.
The invention designs and develops a basic function module architecture, a component function module architecture and a micro-service function module architecture, correspondingly encapsulates the basic function module architecture, the component library and the micro-service function library to form a basic component library, a component library and a micro-service function library, and integrates the basic component library, the component library and the micro-service function library to form a web back-end development framework.
In this embodiment, as shown in fig. 5, a method for constructing a web backend development framework is further provided, where a construction flow of the method includes:
step 1, designing a basic function module framework of the framework, selecting basic functions according to the basic function module framework for development, and packaging to form a basic component library of the framework.
And 2, designing a component function module framework, developing a component function according to the component function module framework, and packaging to form a component library of the framework.
And 3, designing a micro service function module architecture, expanding, developing and deploying the micro service functions of the framework by taking the app-core module as a core, and simultaneously packaging to form a micro service function library of the framework.
And 4, integrating to form a web back-end development framework according to the basic component library, the component library and the micro-service function library.
In this embodiment, in the building process of the component function module, the interface configuration component is an interface configuration tool provided for the application, so that a user configures an interface meeting the requirement without developing any code, and the design and building process is as follows:
dynamic interface: and a universal url is intercepted in an interceptor mode. This url will prefix all interfaces configured by the interface configuration tool. All the interfaces are stored in the database after being configured. The database designs two tables: interface _ info and interface _ release. interface _ info records the configuration information of the interface, and interface _ release records the information of the sql script of the interface. When the interface request is carried out, the interceptor is firstly moved, and then the url of the interface and the request parameter are inquired whether to be legal or not through the interface _ info. If the received configuration information is legal, the interface _ release is used for acquiring the SQL script and returning the configuration information, and corresponding processing is performed after execution and then the configuration information is returned.
Interface configuration: the whole interface configuration, test and release are completed in one-stop mode through the UI. As shown in fig. 3, an interface configuration flow of the interface configuration component is that interface creation is performed on a page, and url and an access mode of interface access to be formulated are POST or GET; in the parameter definition area, configuring request parameters of a test interface, wherein the parameters only support a JSON format; configuring SQL sentences for accessing the database in the main working area; configuring an entity returned by the interface in the main working area; testing whether the return interface is expected through the test button; and finally, issuing an interface through an issuing button.
The file upload component is intended to provide a common API for file upload and download for applications. When a developer has file uploading or downloading requirements, the developer can directly use the API to complete development, and the main design and construction process is as follows:
file storage: all files are stored by means of a file server, and the file server provides an sftp protocol for communication.
Uploading a file: the database is used to record metadata of file uploads, including file name, file category, file batch number, file save path, etc. Wherein the file saving path corresponds to a storage path of the file on the file server.
Downloading a file: and inquiring the storage path of the file from the database, and calling an API (application programming interface) for downloading the file to download.
In the embodiment, in order to improve the productivity of Web developers to the maximum extent, the invention discloses a set of base workflow components which are not directly embedded into a business system but are independently deployed into services, an interface is exposed for the calling of the business system, and the coupling with the business system is reduced. The main design and construction process is as follows:
model management design: mainly, the method includes the following steps of CURD operation on a workflow MODEL table (ACT _ RE _ MODEL) and some extended functions, such as: and model import and export, model deployment and the like. The model is the beginning of the process, and the design of the process is the design process of the model; the definition file of the process, namely bpmn file, can be exported through the model, and can be used for the deployment of the process. The model management function provides a visual management interface and a design interface.
Flow definition management design: the flow must be defined before the workflow is used, which defines that the flow is also to be deployed. To deploy a process, they have to be packaged in a business document. One business document is a unit of workflow engine deployment. A service document corresponds to a compressed file that contains BPMN2.0 procedures, task forms, rules and any other type of file. In general, a business document is a container that contains named resources. When a business document is deployed, it will automatically scan BPMN files with either.bpmn 20.xml or.bpmn as an extension. Each file will be parsed and may contain multiple process definitions. The process definition provides a visual management interface, and the process model is deployed in the workflow component after being designed and is not deployed in the business system.
Starting a flow design: with the flow definition, a flow instance can be created. A new process instance is started, using the id defined in the process definition (corresponding to the process element in the XML file). Note that the ID here should be called a Key for the workflow (note: ID is generally used in the flow model, and Key is used in the workflow, such as task ID, etc.). A flow instance is created, first entering a start event. After the start event, it will follow all outgoing links to the first task. The workflow component will save a task to the database. At this point, the user or group assigned to the task is parsed and saved to the database. It should be noted that the workflow engine will continue to execute the flow unless a wait state is encountered, such as a user task. In the wait state, the state of the current process instance is saved to the database. This state cannot be changed until the user decides to complete the task. At this point, the engine may continue execution until the next wait state is encountered, or the process ends. If the intermediate engine restarts or crashes, the process state is also safely saved in the database. After the task is created, the startprocessInstantByKey will not return until the wait state of the user task is reached. The task is now assigned to a group, which means that this group is a candidate group for performing this task. The starting process does not provide a management interface, and only exposes the interface for the service application to call.
Designing a task list to be handled: the workflow engine is used in the process, one very important function is to obtain the to-do list, and the to-do list can be inquired in the workflow through the relevant APIs of the task service, although the APIs are designed elegantly, the APIs are often inconvenient in actual use and lack flexibility, and the requirements of technical solutions cannot be met. After analyzing the above disadvantages and requirements, the present invention considers that there are various defects when querying in API mode, so the design target is put on the database, and the problem is solved by defining the view mode, thus thoroughly solving the problems of convenience, flexibility and universality of query. The workflow component does not provide interface management of the task list to be handled, only provides flow data for the service system to use, and the data display is realized by the service system.
Designing a signing task: when a task is sent to a plurality of persons for processing at the same time and the task does not need to be signed, the task must be signed first to be processed. The current registrant claims this task. As will be appreciated, the user becomes the performer of the task and the task disappears from the task list of the other members. The task may move to the user's personal task list that signed in for the task. The current login person will also see that the performer of the task has become the current logged-in user. The function does not provide an operation interface, and only provides interface calling.
Task handling design: after the current login person finishes the task signing, the task can be directly processed in the task list to be handled. For the workflow engine, an external message is needed to let the process instance continue execution. The task will remove itself from the runtime. The flow may follow a single outbound connection moving to a second task. The same mechanism as the first task is used for the second task, except that the task is assigned to another group or person. The function does not provide interface operations, but only interface calls.
And (3) designing an already-processed task list: an already tasked task is a historical component that can capture information that occurs during the execution of a process and store it permanently, unlike runtime data, which exists in a database when a process instance is run through. There are 5 historical entity objects, historian processinstances, which contain information on current and completed process instances, historian variable instances, which contain the latest process variables or task variables, historian reactive instances, which contain execution information on an activity (node on the process), historian task instances, which contain information on current and past (completed or deleted) task instances, historian details, which contain various information on historical process instances, activity instances, task instances. Because the database stores historical information and information about the running process instances, it is necessary to consider how to run as few pairs as possible.
And (3) flow tracking design: after the process is started, a unique process instance is provided, and the execution condition of the process can be tracked through the process instance. The tracking of the flow includes a history list of flow pictures and flows.
Designing a sub-process: a sub-flow is an activity that contains other activities, gateways, events, etc. The implementation of the sub-process comprises two implementations based on the sub-process. One is embedded sub-flow: the sub-process elements are embedded in the main process element, the sub-process can only be used in the process, and the outside cannot be accessed. Such sub-processes are typically handled as local general logic or because of specific business needs, making the design of a more complex single main process clear and intuitive. The other is to call a sub-flow: firstly, one process is realized, the process can be called in another process, and some general processes can be generally defined as the calling sub-processes for the definition and the multiplexing of other processes. The sub-process uses elements to call and is indirectly embedded into the main process, so that the sub-process is convenient to use.
And (3) design of a tag: in process business management, tasks are usually processed by one person, and a plurality of persons process one task at the same time, and the task is called as a countersigning task. The flow assembly does not provide the interface operation of the function, only provides the interface to acquire data, and the interface is realized by the service system.
Retraction/retraction design: in the process business management, incomplete information or misoperation often occurs to send the process to a next-step handler, and the task can be recovered and reprocessed before the next-step handler does not process, namely, the recovery or the withdrawal of the process.
The timed task component requires what is a common demand scene to do at a certain characteristic time point in real production. This time a timing task is needed. Existing Spring provides a way to implement timed tasks by annotating methods with @ Schedule annotation. However, this approach has the biggest problem of having to modify the program source code if it comes to the task that needs to be adjusted. If the project is already online, modifying the source code means that a shutdown is required, which can hardly be allowed. Thus, the present invention develops a timed task component that can adjust tasks without downtime. The main design and construction process is as follows:
task management: metadata information for the tasks is stored by the database. The metadata includes task ID, task name, task grouping, task status, cron expression, etc. And then providing an interface for increasing, deleting, modifying and checking the tasks, and performing increasing, deleting, modifying and checking on the task database.
Task state management: and providing a task state management interface to manage the task state. The task states are as follows: started, suspended, stopped. The modification of the task involves changes in two places. One is a state change in memory and one is a state change of data in the database.
Task deployment: the tasks can be deployed in a distributed mode or in a single mode. For the distributed deployment approach, distributed locks are used to avoid repeated execution of tasks on multiple machines. The distributed lock defaults to using a database to realize lightweight, and can also use redis or zookeeper and the like in a customized manner.
Task logging: a log of tasks is stored by the database.
And a system management component, which is an essential module for the web system. The main design idea is as follows:
and (3) organization management: and providing an organization management interface to perform operations such as addition, deletion, modification, check and the like on the organization. Wherein, the mechanism is designed with the concept of a parent-child mechanism.
User management: and providing a user management interface to perform operations such as addition, deletion, modification, check and the like on the user. The user is associated with the institution and, in addition, an interface is provided for modifying the password and resetting the password.
And (3) role management: and providing a role management interface to perform operations such as adding, deleting, modifying, checking and the like on roles.
And (3) menu management: and providing a menu management interface to perform operations such as adding, deleting, modifying, checking and the like on the menu. In order to avoid using recursion to query when querying the menu, a relationship field is set for the menu. Relationship records a chain structure of current menu id and all parent menu ids, for example: 1-5-7 represents that the current menu id is 7, the father menu id is 5 and the father menu id of the father menu is 1. The current menu is at level 3. Therefore, through the relationship field, when the menu is queried, the menu can be queried through the like, and the menu and the role are associated.
And (4) post management: and providing a post management interface to perform operations such as increasing, deleting, modifying, checking and the like on the posts. The post is designed with the concept of parent-child post. In addition, the post and the mechanism, the post and the role, and the post and the user have an association relationship.
And (3) authority management: and providing an authority management interface to perform operations such as addition, deletion, modification, check and the like on the authority. The authority actually modifies the association between the post and the user.
In this embodiment, the function of the micro service architecture takes the app-core module in the basic function module as a core, and all other sub-modules are extended from the app-core.
The registry has 2 cores, eureka-core and alibaba-core. An eureka registry may be implemented by relying on eureka-core, and a nacos registry may be implemented by relying on alibaba-core.
The configuration center has 2 cores, which are respectively alibaba-core and config-server-core. The nacos configuration center can be realized by depending on the alibaba-core, and the config configuration center can be realized by depending on the config-server-core.
The gateway has 2 cores, zuul-core and gateway-core. The zuul gateway can be realized by depending on the zuul-core, and the gateway can be realized by depending on the gateway-core.
There are 2 cores, alibaba-core and app-cpre, for current limiting. The sentinel current limiting can be realized by depending on the alibaba-core, and the hystrix current limiting can be realized by depending on the app-core.
The distributed transaction is directly realized from the app-core, and the data distributed transaction client is realized.
Unified authentication needs to depend on the uaa-core, and the uaa-core realizes a unified authentication center.
There are 3 packets monitored, admin-core, hystrix dashboard-core and app-core respectively. The admin monitoring can be realized by relying on the admin-core, the hystrix dashboard monitoring can be realized by relying on the hystrix dashboard-core, and the slauth, zipkin and skywalk monitoring can be realized by relying on the apps-cores only.
In the process of constructing functions of the registration center, the architecture integrates two registration centers for development and selection: eureka and Nacos. Eureka favors AP and Nacos supports both AP and CP. The framework provides default configuration items for both registries, and if needed, can modify the content in the application.
The Eureka is a part of a Spring Cloud Netflix micro-service suite, is packaged secondarily based on the Netflix Eureka and is mainly responsible for completing a service management function in a micro-service architecture. Eureka provides operations for registration, management, and querying of service instances in the form of REST APIs.
Nacos is a component of the open source of arizaba that supports service registration and discovery, configuration management, and microservice management. The Nacos integrates the functions of a registration center and a configuration center, and achieves two-in-one.
In the process of constructing the gateway function, the architecture integrates two gateways for development and selection: zuul (Zuul 2 version) and Gateway. The two gateways are developed on the basis of an asynchronous non-blocking model, and have little difference in performance. The framework provides default configuration items for both gateways. Yml can be modified to adjust if needed.
Zuuul is an API Gateway server open to netflix, essentially a web servlet application. Zuul provides a framework for edge services such as dynamic routing, monitoring, resiliency, security, etc. on a cloud platform. Zuul corresponds to the front door of all requests at the back end of the Web site for the device and Netflix streaming applications.
The Gateway is developed by Spring officials based on Spring 5.0, Spring Boot 2.0, Project Reactor and other technologies, and aims to provide a simple and effective unified API route management mode for the micro-service architecture. Spring Cloud Gateway as a Gateway in the Spring Cloud ecosystem, the goal is to replace ZUULL, which not only provides a uniform routing approach, but also provides the basic functions of the Gateway in a Filter chain-based approach, such as: safety, monitoring/burying points, current limiting, etc.
In the construction process of the function of the configuration center, the architecture integrates two configuration centers for development and selection: config and Nacos. The Config is a component of the Spring Cloud ecosystem, and can be seamlessly integrated with the Spring Cloud system. The Nacos, although not a component of the Spring Cloud ecosphere, can also be combined with Spring Cloud, and the framework has been implemented. Moreover, the nacos also supports a registration center, so that two-in-one is realized. The micro-service architecture realizes dynamic configuration refreshing of two configuration centers in a framework, config is realized by combining a bus, and Nacos is realized in a udp broadcast mode. The framework provides default configuration items for both configuration centers, and if adjustment is needed, the content in the application.
In the construction process of the current limiting function, the framework integrates two current limiting components for development and selection: hystrix and Sentinel. Wherein, Sentinel is used in combination with configuration center (persistence of Sentinel configuration) in Nacos, while Hystrix is not limited. Sentinel needs to be deployed separately. The framework provides default configuration items for each of the 2 current limiting components, and if adjustment is needed, the content in the application.
Hystrix is a fusing protection middleware adopted by Netflix for a micro-service distributed system, and is equivalent to a fuse in a circuit. Hystrix isolates calls through HystrixCommand, thus, the cascading effect of faults can be prevented, and interface calls can fail quickly and return to normal quickly, or fall back and degrade gracefully.
The Sentinel is a lightweight flow control framework facing a distributed service framework, and mainly uses flow as an entry point to maintain the stability of the system from multiple dimensions of flow control, fusing degradation, system load protection and the like.
In the construction process of the unified authentication function, the architecture provides a unified authentication service end Uaa for development and direct use, and the Uaa can be directly deployed. In microservices, all App clients need to send requests to Uaa for authentication (oauth 2 jwt mode). The frame is packaged, and developers do not need to develop authentication related codes. The Uaa also provides functions of user management, role management, access system management, account management and the like, and developers can directly perform unified user management without developing any code.
In the construction process of the distributed transaction function, the architecture is realized by taking Seata as a bottom layer, and the distributed transaction function is provided. The development only needs to configure some distributed transactions in the App, and then the method for realizing the distributed transactions is marked by corresponding annotations in the codes to realize the distributed transactions.
Seata is an open source distributed transaction solution, which is aimed at providing a high performance and simple to use distributed transaction service. The current transaction mode of Seata includes three modes of AT, TCC and Saga, the default mode is AT mode, AT is essentially one implementation of 2pc protocol.
In the construction process of the unified monitoring function, various monitoring means are provided for development and selection, including Admin, Hystrix dashboard, Sleuth, Zipkin and Skywalking. The framework provides default configuration items for all monitoring components, and if adjustment is needed, the content in the application.
Admin is a Web application that manages and monitors the running state of the Spring Boot application. Each Spring Boot application is treated as a client and registered with the management server. The data collection behind is provided by the Spring Boot actor endpoint.
Hystrix Dashboard is a Dashboard (Dashboard) provided by Spring Cloud and is used for Hystrix to monitor open circuit conditions, thereby allowing developers to monitor possible problems.
Sleuth is a distributed system service chain tracking component provided by Spring Cloud, and can track a user request process (including data acquisition, data transmission, data storage, data analysis and data visualization) in the whole distributed system, and capture the tracking data to construct a view of the whole calling chain of the microservice, which is a key tool for debugging and monitoring the microservice.
Zipkin is a development source implementation of a distributed monitoring system Dapper (thesis) of Twitter based on google, and is used for tracking application data links between distributed services, analyzing and processing delay and helping us to improve the performance of the system and locate faults.
Skywalking is an APM system, namely an application performance monitoring system, and is designed for micro-service architecture and cloud native architecture systems. The method automatically collects required indexes through the probe and carries out distributed tracking. Through the call links and the indexes, the Skywalking APM can sense the relationship between applications and the relationship between services and carry out corresponding index statistics.
The foregoing shows and describes the general principles and broad features of the present invention and advantages thereof. It will be understood by those skilled in the art that the present invention is not limited to the embodiments described above, which are described in the specification and illustrated only to illustrate the principle of the present invention, but that various changes and modifications may be made therein without departing from the spirit and scope of the present invention, which fall within the scope of the invention as claimed. The scope of the invention is defined by the appended claims and equivalents thereof.

Claims (10)

1. A web backend development framework, comprising
The basic function module is used for integrating the web back-end development technology, and constructing the basic function module for web back-end development on the basis of the common package, so that other function modules can be conveniently developed;
the module function module is used for providing additional and customizable functions in a module mode, and the functions exist in the form of separate sub-modules after being completed, so that developers can conveniently introduce and use the modules in development;
and the micro-service function module is used for expanding other micro-service sub-modules by taking the app-core module as a core on the basis of the basic function module.
2. The web backend development framework according to claim 1, wherein the basic function modules specifically include a dynamic data source module, a Druid connection pool module, a cache module, a log management module, an asynchronous processing module, a global exception handling module, an ID generator module, an automatic audit module, a paging plug-in module, and a slow query tracking module.
3. The web backend development framework according to claim 1, wherein the components in the component function module include an interface configuration component, a file upload component, a workflow component, a timed task component, and a system management component.
4. The web backend development framework according to claim 1, wherein the functions in the micro service function module include registry, gateway, configuration center, throttling, unified authentication, distributed transaction and unified monitoring.
5. The web backend development framework of claim 1, wherein the common package specifically comprises common-api, common-core, common-jpa, common-mybases, common-security-core, common-security-client, and common-security-server.
6. The web back-end development framework according to claim 2, wherein the dynamic data source module internally provides a map, and stores alias names of the actual connection database with key of the map and stores the actual data source with vlaue.
7. The web backend development framework of claim 2, wherein the asynchronous processing module comprises a bounded pool of threads and asynchronous annotations; the bounded thread pool is used for automatically selecting the optimal thread number according to the CPU core number of the operating system when the project is started; the asynchronous annotation is used to label operations in the asynchronous processing.
8. The web backend development framework of claim 2, wherein the global exception handling module includes a unified exception class KeepException, which is used to automatically capture exceptions thrown by the rest layer in the process of developing the interface.
9. The web backend development framework of claim 2, wherein the ID generator module uses a snowflake algorithm as an ID generation policy of the module, and the ID generated by the module comprises a first-order invalidator, a timestamp difference, a machine code and a serial number.
10. A method for constructing a web back-end development framework is characterized by comprising the following steps:
s1, designing a basic function module framework of the framework, selecting basic functions according to the basic function module framework for development, and packaging to form a basic component library of the framework;
s2, designing a component function module architecture, developing component functions according to the component function module architecture, and packaging to form a component library of the framework;
s3, designing a micro-service function module architecture, expanding and developing the micro-service function of the deployment frame by taking the app-core module as a core, and simultaneously packaging to form a micro-service function library of the frame;
and S4, integrating to form a web back-end development framework according to the basic component library, the component library and the micro service function library.
CN202010807848.0A 2020-08-12 2020-08-12 Web back-end development framework and construction method thereof Active CN111930355B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010807848.0A CN111930355B (en) 2020-08-12 2020-08-12 Web back-end development framework and construction method thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010807848.0A CN111930355B (en) 2020-08-12 2020-08-12 Web back-end development framework and construction method thereof

Publications (2)

Publication Number Publication Date
CN111930355A true CN111930355A (en) 2020-11-13
CN111930355B CN111930355B (en) 2021-10-26

Family

ID=73311662

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010807848.0A Active CN111930355B (en) 2020-08-12 2020-08-12 Web back-end development framework and construction method thereof

Country Status (1)

Country Link
CN (1) CN111930355B (en)

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112486466A (en) * 2020-12-11 2021-03-12 光大兴陇信托有限责任公司 Method for realizing quick universal basic framework based on micro-service architecture
CN112818062A (en) * 2021-02-04 2021-05-18 北京易车互联信息技术有限公司 Basic data support assembly system
CN112882735A (en) * 2021-03-11 2021-06-01 百度在线网络技术(北京)有限公司 Fusing information processing method, device, equipment and storage medium
CN112954006A (en) * 2021-01-26 2021-06-11 重庆邮电大学 Industrial Internet edge gateway design method supporting Web high-concurrency access
CN112965446A (en) * 2021-01-29 2021-06-15 华中科技大学 Flexible production line control system platform based on micro-service architecture
CN113014424A (en) * 2021-02-09 2021-06-22 中国银联股份有限公司 Cloud platform management method and device, electronic equipment and storage medium
CN113094385A (en) * 2021-03-10 2021-07-09 广州中国科学院软件应用技术研究所 Data sharing fusion platform and method based on software definition open toolset
CN114531477A (en) * 2022-04-22 2022-05-24 深圳丰尚智慧农牧科技有限公司 Method and device for configuring functional components, computer equipment and storage medium
CN115242644A (en) * 2022-07-26 2022-10-25 天元大数据信用管理有限公司 Micro-service development and management system
CN115407972A (en) * 2022-08-23 2022-11-29 南京科技职业学院 Cloud native development component system and method

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105302568A (en) * 2015-11-13 2016-02-03 山东中创软件工程股份有限公司 Method for establishing Web development framework and Web development framework
CN107168746A (en) * 2017-05-27 2017-09-15 北京中电普华信息技术有限公司 A kind of micro services generation method and device

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105302568A (en) * 2015-11-13 2016-02-03 山东中创软件工程股份有限公司 Method for establishing Web development framework and Web development framework
CN107168746A (en) * 2017-05-27 2017-09-15 北京中电普华信息技术有限公司 A kind of micro services generation method and device

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
PAYNE YU: "AbstractRoutingDataSource实现动态数据源切换", 《HTTPS://BLOG.CSDN.NET/WEIXIN_42338555/ARTICLE/DETAILS/105033995》 *
XUPENG1644: "分布式ID生成之雪花算法", 《HTTPS://BLOG.CSDN.NET/XP178171640/ARTICLE/DETAILS/102801709》 *
ZLT2000: "microservices-platform", 《HTTPS://GITHUB.COM/ZHANGJINGTAO/MICROSERVICES-PLATFORM》 *

Cited By (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112486466A (en) * 2020-12-11 2021-03-12 光大兴陇信托有限责任公司 Method for realizing quick universal basic framework based on micro-service architecture
CN112954006B (en) * 2021-01-26 2022-07-22 重庆邮电大学 Industrial Internet edge gateway design method supporting Web high-concurrency access
CN112954006A (en) * 2021-01-26 2021-06-11 重庆邮电大学 Industrial Internet edge gateway design method supporting Web high-concurrency access
CN112965446B (en) * 2021-01-29 2022-06-14 华中科技大学 Flexible production line control system platform based on micro-service architecture
CN112965446A (en) * 2021-01-29 2021-06-15 华中科技大学 Flexible production line control system platform based on micro-service architecture
CN112818062A (en) * 2021-02-04 2021-05-18 北京易车互联信息技术有限公司 Basic data support assembly system
CN113014424A (en) * 2021-02-09 2021-06-22 中国银联股份有限公司 Cloud platform management method and device, electronic equipment and storage medium
CN113014424B (en) * 2021-02-09 2023-08-01 中国银联股份有限公司 Cloud platform management method and device, electronic equipment and storage medium
CN113094385A (en) * 2021-03-10 2021-07-09 广州中国科学院软件应用技术研究所 Data sharing fusion platform and method based on software definition open toolset
CN113094385B (en) * 2021-03-10 2024-04-30 广州中国科学院软件应用技术研究所 Data sharing fusion platform and method based on software defined open tool set
CN112882735A (en) * 2021-03-11 2021-06-01 百度在线网络技术(北京)有限公司 Fusing information processing method, device, equipment and storage medium
CN112882735B (en) * 2021-03-11 2024-04-19 百度在线网络技术(北京)有限公司 Fuse information processing method, device, equipment and storage medium
CN114531477A (en) * 2022-04-22 2022-05-24 深圳丰尚智慧农牧科技有限公司 Method and device for configuring functional components, computer equipment and storage medium
CN115242644A (en) * 2022-07-26 2022-10-25 天元大数据信用管理有限公司 Micro-service development and management system
CN115407972A (en) * 2022-08-23 2022-11-29 南京科技职业学院 Cloud native development component system and method

Also Published As

Publication number Publication date
CN111930355B (en) 2021-10-26

Similar Documents

Publication Publication Date Title
CN111930355B (en) Web back-end development framework and construction method thereof
US11422873B2 (en) Efficient message queuing service using multiplexing
CN109495308B (en) Automatic operation and maintenance system based on management information system
US9323647B2 (en) Request-based activation of debugging and tracing
Mayer et al. An approach to extract the architecture of microservice-based software systems
US8510720B2 (en) System landscape trace
US8185916B2 (en) System and method for integrating a business process management system with an enterprise service bus
US8204870B2 (en) Unwired enterprise platform
US8428983B2 (en) Facilitating availability of information technology resources based on pattern system environments
US6694362B1 (en) Method and system for network event impact analysis and correlation with network administrators, management policies and procedures
KR20170051471A (en) Methods and systems for portably deploying applications on one or more cloud systems
EP1292871A2 (en) Method and apparatus for automatically deploying data and simultaneously executing computer program scripts in a computer network
JP2006509266A (en) Method and system for problem determination in distributed enterprise applications
WO2007036932A2 (en) Data table management system and methods useful therefor
US8381167B2 (en) Business service discovery
CN111930354B (en) Framework component system for software development and construction method thereof
US11822433B2 (en) Qualification parameters for captain selection in a search head cluster
CN103248511B (en) A kind of analysis methods, devices and systems of single-point service feature
US11461288B2 (en) Systems and methods for database management system (DBMS) discovery
US20060059118A1 (en) Apparatus, system, and method for associating resources using a behavior based algorithm
Dillenseger Clif, a framework based on fractal for flexible, distributed load testing
Learmonth et al. Towards modernising data collection and archive for the Tor network
CN117215639A (en) Configuration management method and system for root cause analysis based on observation cloud
CN117555522A (en) Cloud pipe bus for multi-cloud management platform
Samsir The modification of nagios web config using PHP

Legal Events

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