[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN117111897A - Service processing method and device - Google Patents

Service processing method and device Download PDF

Info

Publication number
CN117111897A
CN117111897A CN202311055149.5A CN202311055149A CN117111897A CN 117111897 A CN117111897 A CN 117111897A CN 202311055149 A CN202311055149 A CN 202311055149A CN 117111897 A CN117111897 A CN 117111897A
Authority
CN
China
Prior art keywords
service
target
cheng zuoyong
zuoyong
cheng
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311055149.5A
Other languages
Chinese (zh)
Inventor
尹乐
朱文波
蒋威
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Hode Information Technology Co Ltd
Original Assignee
Shanghai Hode 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 Shanghai Hode Information Technology Co Ltd filed Critical Shanghai Hode Information Technology Co Ltd
Priority to CN202311055149.5A priority Critical patent/CN117111897A/en
Publication of CN117111897A publication Critical patent/CN117111897A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/20Software design
    • G06F8/24Object-oriented

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The embodiment of the application provides a service processing method, which comprises the following steps: creating a target protocol Cheng Zuoyong domain object; creating a target dependency injection scope object corresponding to the target protocol Cheng Zuoyong domain object in a dependency injection framework; creating the target business unit according to the target protocol Cheng Zuoyong domain object and the target dependency injection scope object; and operating the target business unit under the target protocol Cheng Zuoyong domain object to manage the target business unit. The technical scheme of the embodiment of the application can create the target service unit in the target dependency injection scope object, effectively reduce the code quantity and improve the development efficiency. The target service units correspondingly run under the target protocol Cheng Zuoyong domain object, so that the service logic self-running based on the corresponding life cycle can be realized through the target protocol Cheng Zuoyong domain.

Description

Service processing method and device
Technical Field
The embodiment of the application relates to the technical field of computers, in particular to a business processing method, a business processing device, computer equipment and a computer readable storage medium.
Background
The video platform is an online service platform for storing, managing, publishing, playing and sharing video content. As a core consumption scenario for a user, a video play page needs to cope with a complex service. Taking a video client as an example, a video playback page may include: manuscript playing page, live broadcast playing page, animation film playing page, etc. of the video uploading user. Each playing page is summarized with a large amount of services, and needs to accept the conversion from various services to the playing page and also needs to be responsible for accepting the function display of each service on the playing page. It can be seen that the function of playing the page is complex and the code complexity is high.
It is known that the above-mentioned page or a fused page of a plurality of pages is often disadvantageous for maintenance due to complicated codes, and has low development efficiency.
It should be noted that the foregoing is not necessarily prior art, and is not intended to limit the scope of the present application.
Disclosure of Invention
Embodiments of the present application provide a service processing method, apparatus, computer device, and computer readable storage medium, so as to solve or alleviate one or more of the technical problems set forth above.
An aspect of an embodiment of the present application provides a service processing method, where the method includes:
creating a target protocol Cheng Zuoyong domain object;
creating a target dependency injection scope object corresponding to the target protocol Cheng Zuoyong domain object in a dependency injection framework;
creating the target business unit according to the target protocol Cheng Zuoyong domain object and the target dependency injection scope object;
and operating the target business unit under the target protocol Cheng Zuoyong domain object to manage the target business unit.
Optionally, the target dependency injection scope object declares a target service anchor, the target service anchor including a plurality of service units;
Correspondingly, creating the target business unit according to the target protocol Cheng Zuoyong domain object and the target dependency injection scope object comprises:
binding the target protocol Cheng Zuoyong domain object to the target dependency injection scope object;
and creating a target service unit in the target dependency injection scope object through the target protocol Cheng Zuoyong domain object and the target service anchor point.
Optionally, the number of the services is multiple, and multiple services correspond to multiple service scopes;
the plurality of business scopes are divided into multiple levels of business scopes;
in the multi-level service scope, the upper level service scope comprises one or more lower level service scopes;
wherein, each business scope corresponds to a cooperative Cheng Zuoyong domain object and a dependency injection scope object;
the hierarchy of the business scope and the hierarchy of the collaboration Cheng Zuoyong domain object have a corresponding relationship with the hierarchy of the dependency injection scope object.
Optionally, the target cooperative Cheng Zuoyong domain object corresponds to a first-level cooperative Cheng Zuoyong domain object, and the target dependency injection scope object corresponds to a first-level dependency injection scope object;
the service processing method further comprises the following steps:
Creating a secondary collaboration Cheng Zuoyong field object under the primary collaboration Cheng Zuoyong field object in response to a target event;
creating a secondary dependency injection scope object corresponding to the secondary cooperative Cheng Zuoyong domain object in a dependency injection framework;
creating the secondary service unit according to the secondary cooperative Cheng Zuoyong domain object and the secondary dependency injection scope object;
and operating the secondary service unit under the secondary protocol Cheng Zuoyong domain object to manage the life cycle of the secondary service unit.
Optionally, the target service unit is used as a primary service unit for serving the secondary protocol Cheng Zuoyong domain object and the subordinate protocol Cheng Zuoyong domain object thereof.
Optionally, the target service unit is configured to provide a driving service event stream.
Optionally, the target cooperative Cheng Zuoyong domain object is a first-level cooperative Cheng Zuoyong domain object corresponding to a playing page, and the target dependency injection scope object is a first-level dependency injection scope object corresponding to the playing page; the play page is configured with a first secondary service and a second secondary service; correspondingly, the service processing method further comprises the following steps:
creating a first secondary collaboration Cheng Zuoyong field object under the primary collaboration Cheng Zuoyong field object and a first secondary dependency injection scope object under the primary dependency injection scope object in response to a selected event for a first secondary service;
Creating a first secondary service unit according to the first secondary collaboration Cheng Zuoyong domain object and the first secondary dependency injection scope object;
the first secondary service unit is operated under the first secondary protocol Cheng Zuoyong domain object to manage a lifecycle of the first secondary service unit.
Optionally, the first secondary service and the second secondary service are mutually exclusive, and the service processing method further includes:
destroying the first secondary collaboration Cheng Zuoyong domain object in response to a selected event for a second secondary service, and creating a second secondary collaboration Cheng Zuoyong domain object under the primary collaboration Cheng Zuoyong domain object and a second secondary dependency injection scope object under the primary dependency injection scope object;
creating a second-level service unit according to the second-level cooperative Cheng Zuoyong domain object and the second-level dependency injection scope object;
and running the second-level service unit under the second-level cooperative Cheng Zuoyong domain object to manage the life cycle of the second-level service unit.
Optionally, the first secondary service is associated with a first tertiary service, wherein the first tertiary service is used for playing one or more media objects; correspondingly, the service processing method further comprises the following steps:
In response to a selected event for a first media object in the first tertiary service, creating a first tertiary collaboration Cheng Zuoyong field object under the first secondary collaboration Cheng Zuoyong field object corresponding to the first media object, and creating a first tertiary dependency injection scope object under the first secondary dependency injection scope corresponding to the first media object;
creating the first tertiary service unit corresponding to the first media object according to the first tertiary protocol Cheng Zuoyong domain object corresponding to the first media object and the first tertiary dependent injection scope object corresponding to the first media object;
the first tertiary service unit corresponding to the first media object is run under the first tertiary protocol Cheng Zuoyong domain object corresponding to the first media object to manage a lifecycle of the first tertiary service unit corresponding to the first media object.
Optionally, the service processing method further includes:
destroying the first tertiary co-Cheng Zuoyong domain object corresponding to the first media object and creating a first tertiary co-Cheng Zuoyong domain object corresponding to the second media object under the first secondary co-Cheng Zuoyong domain object and creating a first tertiary dependent injection scope object corresponding to the second media object under the first secondary dependent injection scope in response to a selected event for the second media object in the first tertiary service;
Creating the first tertiary service unit corresponding to the second media object according to the first tertiary protocol Cheng Zuoyong domain object corresponding to the second media object and the first tertiary dependent injection scope object corresponding to the second media object;
the first tertiary service unit corresponding to the second media object is run under the first tertiary protocol Cheng Zuoyong domain object corresponding to the second media object to manage the lifecycle of the first tertiary service unit corresponding to the second media object.
Another aspect of an embodiment of the present application provides a service processing apparatus, including:
the first creation module is used for creating a target protocol Cheng Zuoyong domain object;
the second creating module is used for creating a target dependency injection scope object corresponding to the target cooperative Cheng Zuoyong domain object in the dependency injection framework;
a third creating module, configured to create the target service unit according to the target protocol Cheng Zuoyong domain object and the target dependency injection scope object;
and the operation module is used for operating the target business unit under the target protocol Cheng Zuoyong domain object so as to manage the target business unit.
Another aspect of an embodiment of the present application provides a computer apparatus, including:
at least one processor; and
A memory communicatively coupled to the at least one processor;
wherein: the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method as described above.
Another aspect of embodiments of the present application provides a computer-readable storage medium having stored therein computer instructions which, when executed by a processor, implement a method as described above.
The embodiment of the application adopts the technical scheme and can have the following advantages:
the target protocol Cheng Zuoyong domain object and the target dependency injection scope object are created, and the target protocol Cheng Zuoyong domain object corresponds to the target dependency injection scope object, so that a target service unit can be created in the target dependency injection scope object through dependency injection, the code quantity is effectively reduced, and the development efficiency is improved. Meanwhile, the target service unit correspondingly operates under the target protocol Cheng Zuoyong domain object, so that the self-operation of the service logic based on the corresponding life cycle is realized through the target protocol Cheng Zuoyong domain object.
Drawings
The accompanying drawings illustrate exemplary embodiments and, together with the description, serve to explain exemplary implementations of the embodiments. The illustrated embodiments are for exemplary purposes only and do not limit the scope of the claims. Throughout the drawings, identical reference numerals designate similar, but not necessarily identical, elements.
Fig. 1 schematically illustrates an operation environment diagram of a service processing method according to a first embodiment of the present application;
FIG. 2 schematically illustrates a workflow diagram for fusing play pages;
FIG. 3 schematically illustrates a service packet diagram fusing play pages;
FIG. 4 schematically illustrates a business scope split map fusing play pages;
fig. 5 schematically shows a flow chart of a service processing method according to a first embodiment of the application;
fig. 6 schematically shows a flow chart of substeps of step S504 in fig. 5;
fig. 7 schematically shows a new flow chart of a service processing method according to a first embodiment of the application;
fig. 8 schematically shows a new flowchart of a service processing method according to a first embodiment of the present application;
fig. 9 schematically shows a new flowchart of a service processing method according to a first embodiment of the present application;
Fig. 10 schematically shows a new flowchart of a service processing method according to a first embodiment of the present application;
fig. 11 schematically shows a new flowchart of a service processing method according to a first embodiment of the present application;
fig. 12 schematically shows an application example diagram of a service processing method according to a first embodiment of the present application;
fig. 13 schematically shows a block diagram of a service processing apparatus according to a second embodiment of the present application; and
Fig. 14 schematically shows a hardware architecture diagram of a computer device in accordance with the third embodiment of the present application.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
It should be noted that the descriptions of "first," "second," etc. in the embodiments of the present application are for descriptive purposes only and are not to be construed as indicating or implying a relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include at least one such feature. In addition, the technical solutions of the embodiments may be combined with each other, but it is necessary to base that the technical solutions can be realized by those skilled in the art, and when the technical solutions are contradictory or cannot be realized, the combination of the technical solutions should be considered to be absent and not within the scope of protection claimed in the present application.
In the description of the present application, it should be understood that the numerical references before the steps do not identify the order in which the steps are performed, but are merely used to facilitate description of the present application and to distinguish between each step, and thus should not be construed as limiting the present application.
First, a term explanation is provided in relation to the present application:
UGC (User Generated Content): the user originally created the content.
OGV (Occupationally Generated Video): professional copyrighted videos such as movies, television shows, documentaries, animations.
Scope (Scope): refers to the visibility and validity range of names of variables, functions, objects, etc. in a particular part or block of code in a program. The scope defines the accessibility and lifecycle of identifiers in the program. Different languages and programming environments may have different types of scopes, including block scope, function scope, global scope, and so forth.
Kotlen: a static type programming language is used to improve development efficiency, code readability, and security. Kotlin has many characteristics including empty checking, extended functions, data classes, etc., making it easier to write Android applications and easier to maintain. Kotlen is compatible with Java and can be widely used in Android development.
Corouritinescope (protocol Cheng Zuoyong domain): the method is used for life cycle management, exception handling and elimination of the cooperative program. For example, can be used to ensure that coroutines are started, run, and canceled within the correct range. CorourtinEScope should be declared as an attribute of an entity with a well-defined lifecycle, responsible for the promoter co-range.
Dependent injection (Dependency Injection) framework: the method is used for managing the dependency relationship among the components so as to improve the maintainability, testability and expandability of the code. The main function of the dependency injection framework is to help the developer separate the dependency relationship from the code, so that the cooperation between the components is more loosely coupled and easy to replace and adjust. The core idea of dependency injection is to manage the dependency of an object by an external container, rather than being created inside the object.
Dependent injection: is the passing of one object to another class or object, enabling the latter to use the functions or data provided by the former. The dependent injection may be implemented by way of constructors, recipe parameters, attributes, notes, etc.
Dagger: is a dependent injection framework. Dagger uses annotations to tag dependencies. The annotation includes: @ object for marking dependencies that need to be injected; component, used to connect where dependencies and needs to be. The Dagger automatically injects the dependency to the place where needed through the method provided by the component, and does not need to manually write codes to create and manage the dependency.
Component: and the connector is used as a dependency in the Dagger dependency framework. Through Component, dag ger can generate corresponding code to complete dependency injection, i.e. the object is no longer responsible for its own creation of dependency items, but is handled by Da gger.
Kotlin and Dagger may be used in combination. The developer can write the logic of the application program by using Kotlen and manage the dependency relationship in the application program by using Da gger, so that higher productivity and code quality are obtained in the development process.
And (3) specializing: unique special services.
Next, in order to facilitate understanding of the technical solutions provided by the embodiments of the present application by those skilled in the art, the following description is made on related technologies:
platform-type websites generally cope with complex business scenarios. Taking a video client as an example, a video playing page corresponds to the following scene: manuscript playing page, live broadcast playing page, sitz movie playing page, etc. of the video uploading person. Each playing page is a summary point of a large number of services, and needs to accept the conversion from various services to the playing page and the function display of each service on the playing page. It can be seen that the play page code belongs to one of the most complex codes of the client, not only because the function of the play page itself is complex, but also because the play page needs to incorporate a large number of external service functions. Implementing complex functions implies a high code complexity, which in turn implies a high maintenance cost of the code.
The inventors have appreciated that: in order to realize the same function, repeated development is not required to reduce development cost, and the related art synthesizes the above plurality of play pages into one play page. However, such merging of multiple pages may further increase code complexity and maintenance costs. For this reason, we need to explore a new architecture model to meet complex business appeal.
Taking a fused play page generated based on fusion of a UGC play page and an OGV play page as an example:
the fused play page includes at least the following 6 parts: general purpose of video playing service, UGC specialization of video playing service, OGV specialization of video playing service, general purpose of playing page interaction, UGC specialization of playing page interaction and OGV specialization of playing page interaction. Each part has a large number of service components, wherein the specialized parts have certain relevance, such as UGC-specialized screen-throwing service, the same screen-throwing SDK service can be relied on by the same screen-throwing SDK service with the OGV-specialized screen-throwing service, and most of the services are driven based on the return value of the interface request and the user behavior.
If all the services in the fused play page are implemented by codes, a huge network structure is formed. Therefore, it is necessary to optimize the mesh structure to reduce the code complexity and maintenance cost of the fused play page on the premise of satisfying the complex service of the fused play page, so that the fused play page is as stable as possible in the process of development and subsequent iteration. Specifically: better building of service units and establishment of dependency relation are needed; and minimizing maintenance costs of the mesh structure.
Therefore, the embodiment of the application provides a service processing technical scheme. In the technical scheme, the fusion playing page of the Android client is taken as an example, in the technical scheme, the cooperative range of Kotlen and the dependence injection framework Dagger are combined, complex business can be disassembled into a plurality of relatively cohesive business unit modules according to the real life cycle and driving relation of the business, and the code quantity is reduced through dependence injection, so that the development efficiency is improved. Specifically, the adopted scheme may include: (1) The complex and huge service network is disassembled into a plurality of independent service action domains according to different life cycles, and corresponding dependence injection S cope and CoroutinEScope are established; (2) For each service scope, completing the development of the service unit based on the corresponding CorourtineSepe and dependence injection; (3) Based on real business, business units and business action domains are combined through subscription to the driving business event stream, and corresponding driving relation is established. Although Dagger and Kotlen co-program are used for implementation, similar frameworks can be used in practical application, for example, dependency injection can be replaced by koin, co-program can be replaced by RxJava and Android Lifecycle, and the core is that the service units are created by event subscription driving dependency injection, so that service logic self-running based on corresponding life cycle is realized. See in particular below.
Finally, for ease of understanding, an exemplary operating environment is provided below.
Fig. 1 schematically shows an environmental application schematic of a method according to an embodiment of the application.
The computer device 10000 includes various types of electronic devices, such as a portable handheld device, a general-purpose computer (such as a personal computer and a laptop computer), a workstation computer, a wearable device, a smart screen device, a self-service terminal device, a service robot, a game system, a thin client, various messaging devices, a sensor, or other electronic devices, and the like. These computer devices may run various types and versions of software applications and operating systems, such as Android. Portable handheld devices may include cellular telephones, smart phones, tablet computers, and the like. The wearable device may include a head mounted display (e.g., smart glasses), or the like. The gaming system may include various handheld gaming devices, internet-enabled gaming devices, and the like. The client device is capable of executing a variety of different applications, such as various Internet-related applications, communication applications (e.g., email applications), short Message Service (SMS) applications, and may use a variety of communication protocols.
The computer device 10000 may include an input/output interface. The input interface may include a touch pad, touch screen, mouse, keyboard, or other sensing element. The input interface may be configured to receive user instructions that may cause the computer device 10000 to perform various operations, such as playing video, etc. The output interface is used to output information, such as display information, to a user.
Based on the above described operating environment, the computer device 10000 can also be installed with one or more applications, such as video play APP (Application).
The video play APP is configured with a fusion play page, and the fusion play page is configured with a plurality of services to form a complex and huge service network. According to different life cycles, the complex service network in the fused play page can be split into a plurality of independent service scopes. The service scope represents a service set with an explicit life cycle, and all services under the set correspond to the same service scope. The multiple business scopes have parent-child relationships, and can be divided into multiple levels of business scopes, and an upper level business scope can include one or more lower level business scopes.
A corresponding dependency injection scope object and a covariant Cheng Zuoyong domain object are established for each business scope. For each business scope, the development of business units is completed based on the corresponding dependency injection scope object and the cooperative Cheng Zuoyong domain object, and business logic is self-operated based on the corresponding life cycle.
As shown in fig. 2, the workflow of fusing the play pages may be as follows: after entering a page, a service end interface is requested through the route parameter of the current page, the current service is judged to be UGC service or OGV service according to the interface return, then a service unit corresponding to the service is started, and the selection logic of the corresponding service drives the corresponding video playing service to play the video at the same time. UGC services may have multiple P (parts) in a page, each P corresponding to an independent video feed. Correspondingly, a quaternary aggregate of OGV services may have multiple EPs (epoode), each EP also corresponding to a separate video feed. As shown in fig. 3, the fused play pages may be grouped based on service Scope, thereby configuring a plurality of service scopes (Scope).
As shown in fig. 4, the video play page (e.g., the fused play page) may be configured as three layers, for a total of 5 service scopes (Sc ops):
A first layer: and (3) the page Scope, wherein the corresponding life cycle is to fuse the playing page, open the page, start the page, and close the page to exit. The Scope life cycle middle operation is a service which runs through the whole page life cycle, such as buried point reporting.
A second layer: the service Scope is a sub Scope of the page Scope, and can be divided into UGC service Scope and OGV service Scope, which do not coexist. And only one service Scope exists for the same page Scope at the same time. When the page interface returns, deciding which specific service Scope is started according to the data return of the server, and if the service Scope exists currently, destroying the current Scope and the sub Scope of the current Scope. The service Scope life cycle middle operation is a unique service unit of UGC/OGV service, such as UGC multi-P logic, UGC screen comment and other service units, OGV multi-season logic and OGV segmentation list.
Third layer: the video playing Scope is divided into UGC video playing Scope and OGV video playing Scope, and the UGC video playing Scope and the OGV video playing Scope are respectively corresponding to sub-Scope of UGC service Scope and OGV service Scope. Since the parent Scope of both will not coexist, and only one video play Scope will exist for the same service Scope. And starting the service Scope corresponding to the video when triggering the new video playing every time, and destroying the current Scope if the video playing Scope exists currently. The middle of the life cycle of the video playing Scope runs a service unit unique to the UGC/OGV video playing service, such as UGC trial watching, member authentication of the OGV and the like.
In a page (e.g. a fused play page), if no service Scope is created, there will typically be only one Scope, i.e. a page Scope. Considering that all services have life cycles in fact, if they are not split by service Scope, it is usually only possible to bind page Scope to run. And the lifecycle of many services is much smaller than the page lifecycle. Thus, in this case, either the Scope inside the service unit needs to be manually maintained or consideration is left out to introduce the service Bug. Also in this case it is easy to rely on erroneous data for traffic due to timing problems of updating of the data. Therefore, splitting is required. Such as the multiple Scope split in fig. 4, can be easily mapped to a specific Scope and a specific service unit.
Taking a playing service as an example, it is assumed that a current OGV has a service unit to acquire related information corresponding to a current season of a video after video playing starts, and when a cut is made while cutting a season, the video is normally played because a video information interface is returned, and at this time, if the interface of the season information is not returned, the service unit acquires information of a previous season from the season service, thereby causing service errors. After the corresponding service Scope is established and the dependency among the scopes is completed, since the set service Scope is a sub Scope of the quaternary service Scope, when all service units under the set service Scope are started, the dependency injection framework can ensure that the information of the current quaternary is correct. Depending on the injection framework, the data of the dimension of the current season information can be used as the initialization parameter of the Scope, so that the service unit of the Scope does not need to care about the season change, and the service code is further simplified.
Specifically: splitting the service units according to the Scope to obtain a series of small Scope and corresponding service units. Each service need only care about its own service related Scope and does not need to understand all service units. Meanwhile, because of isolation relations among the Scope, code isolation can be realized by splitting modules according to services through different Scope, so that the cost of establishing error reference relations and the code maintenance cost are reduced. Referring to the fused play page, the code of the fused play page can be divided into 4 modules, namely a page Scope, UGCScope module, an OGVScope module and a fusion module. The fusion module references the OGV module and the UGC module, and the OGV module and the UGC module are in reference isolation from each other, but all reference the page Scope. The code is divided into different service modules to realize the isolation of the codes among different services, so that the establishment of wrong service unit dependency relationship is avoided.
Therefore, the video play APP in this embodiment may be designed as follows: the architecture design which supports dependency injection and uses Kotlen coroutine as dependency binding and can conveniently carry out multi-level father-child relationship Scope creation is supported.
The following describes the technical solution of the present application through a plurality of embodiments using the computer device 10000 as an execution body. It should be understood that these embodiments may be embodied in many different forms and should not be construed as limited to the embodiments set forth herein.
Example 1
Fig. 5 schematically shows a flow chart of a service processing method according to a first embodiment of the application.
As shown in fig. 5, the service processing method may include steps S500 to S506, wherein:
in step S500, a target protocol Cheng Zuoyong domain object is created.
In step S502, a target dependency injection scope object corresponding to the target protocol Cheng Zuoyong domain object is created in the dependency injection framework.
Step S504, the target business unit is created according to the target protocol Cheng Zuoyong domain object and the target dependency injection scope object.
Step S506, running the target service unit under the target protocol Cheng Zuoyong domain object to manage the target service unit.
According to the business processing method provided by the embodiment, the target cooperative Cheng Zuoyong domain object and the target dependent injection scope object are created, and the target cooperative Cheng Zuoyong domain object corresponds to the target dependent injection scope object, so that a target business unit can be created in the target dependent injection scope object through dependent injection, the code quantity is effectively reduced, and the development efficiency is improved. Meanwhile, the target service unit correspondingly operates under the target protocol Cheng Zuoyong domain object, so that the self-operation of the service logic based on the corresponding life cycle is realized through the target protocol Cheng Zuoyong domain object.
Each of steps S500 to S506 and optional other steps are described in detail below in conjunction with fig. 5.
Step S500A target protocol Cheng Zuoyong domain object is created.
The target protocol Cheng Zuoyong domain object is used to manage and control the lifecycle of the protocol, and the protocol initiated within its scope is managed and controlled by the target protocol Cheng Zuoyong domain.
Taking into account the complexity of numerous services and the variability between services, such as different service lifecycles, managing and controlling all services simultaneously in the same collaboration scope can result in later maintenance difficulties and increased development difficulties.
For example, a page (such as a video playing page) is configured with multiple services, and multiple levels and multiple directions of association may exist between the services, so as to form a complex and huge service network. Each service has a life cycle, and the life cycles of the respective services may be the same or different. Thus, the complex service network in the page can be split into multiple independent service scopes according to the lifecycle. The service scope represents a set of services with an explicit lifecycle, all services under the set corresponding to the same service scope.
In this embodiment, a service scope may correspond to a protocol Cheng Zuoyong domain. Traffic under the traffic scope may be managed by a corresponding protocol Cheng Zuoyong domain. For example, upon entering a target page, to manage traffic under the target page, a target collaboration Cheng Zuoyong domain object may be created that corresponds to the traffic scope of the target page. Since the target protocol Cheng Zuoyong domain object corresponds to the business scope, the lifecycle of the target protocol Cheng Zuoyong domain object is the same as the lifecycle of the business scope.
In this embodiment, the target protocol Cheng Zuoyong field object may be created by a kotlen protocol. In some embodiments, the target protocol Cheng Zuoyong domain object may also be created by Rxjava, andriod Lifecycle, or the like, without limitation.
In this embodiment, a target protocol Cheng Zuoyong domain object is created to subsequently manage the lifecycle of business logic under the corresponding business scope.
Step S502A target dependency injection scope object corresponding to the target protocol Cheng Zuoyong domain object is created in the dependency injection framework.
The dependency injection framework may be used to manage dependencies between objects. The dependency injection framework can inject dependency objects required by the objects from outside to complete object creation and form a loosely coupled, easily maintained code structure.
The dependency injection scope object is used to create business units (business objects).
In the dependency injection framework, a target dependency injection scope object is created that corresponds to the target covariant Cheng Zuoyong domain object. That is, the lifecycle of the target dependency injection scope object is the same as that of the target protocol Cheng Zuoyong domain object, and naturally the lifecycle of the corresponding business scope is also the same.
The target dependency injection scope object may be created through a Dagger dependency injection framework.
In some embodiments, other dependent injection frameworks may be used, such as: koin, hilt, etc., are not limited herein.
Step S504And creating the target business unit according to the target protocol Cheng Zuoyong domain object and the target dependency injection scope object.
As previously mentioned, a service scope represents a collection of services with an explicit lifecycle, and all services under the collection may correspond to the same service scope. Under the condition that the target cooperative Cheng Zuoyong domain object and the target dependency injection scope object corresponding to the service scope are established, the construction of the service unit under the service scope can be completed.
Specific: the target dependency injection scope object may be used to create a target business unit for a corresponding business scope. Wherein the creation of the target business unit needs the target protocol Cheng Zuoyong domain object which is depended on, and the target business unit comprises the specific business unit which needs to run by the target protocol Cheng Zuoyong domain. That is, creation of the target service unit is achieved by injecting the dependent object (target protocol Cheng Zuoyong domain object) required for the target service unit from outside.
In practical applications, the target business unit may be created through a variety of schemes. An exemplary scheme is provided below.
In an alternative embodiment, the target dependency injection scope object declares a target service anchor comprising a plurality of service units.
Correspondingly, the step S504 may include:
step S600, binding the target protocol Cheng Zuoyong domain object to the target dependency injection scope object.
In step S602, in the target dependency injection scope object, a target service unit is created through the target protocol Cheng Zuoyong domain object and the target service anchor point.
The target service Anchor (Anchor object) may be a service unit list of the corresponding service scope, for indicating a target service unit that needs to be created under the corresponding service scope.
There are a number of ways to bind the target-protocol Cheng Zuoyong domain object to the target-dependent injection scope object. For example: the target protocol Cheng Zuoyong domain object may be passed as a parameter to the target dependency injection scope object to implement the binding.
In this embodiment, the target service anchor point and the binding target protocol Cheng Zuoyong domain object are configured for the target dependency injection domain object, so as to quickly and efficiently determine the target service unit and create the target service unit.
Step S506And operating the target business unit under the target protocol Cheng Zuoyong domain object to manage the target business unit.
The target business unit completes creation and runs under the target protocol Cheng Zuoyong domain object, which is managed and limited by the target protocol Cheng Zuoyong domain object. For example, the target business unit automatically runs with the beginning of the target protocol Cheng Zuoyong domain object lifecycle and automatically terminates with the end of the target protocol Cheng Zuoyong domain object lifecycle.
In the embodiment, by operating the target service unit under the target protocol Cheng Zuoyong domain object, the self-operation and self-termination of the service logic based on the corresponding life cycle are realized, the management and control efficiency of the service is improved, and the service error risk is reduced.
The above embodiment describes that the construction of the target business unit under the corresponding business scope is completed through the dependency injection according to the target protocol Cheng Zuoyong domain object and the target dependency injection scope object. The service scope is further described below.
In an alternative embodiment, the number of services is plural, and plural of the services correspond to plural service scopes. The plurality of business scopes is divided into multiple levels of business scopes. In the multi-level business scope, the upper level business scope comprises one or more lower level business scopes. Wherein each business scope corresponds to a collaborative Cheng Zuoyong domain object and a dependency injection scope object. The hierarchy of the business scope and the hierarchy of the collaboration Cheng Zuoyong domain object have a corresponding relationship with the hierarchy of the dependency injection scope object.
For example, a page (such as a video playing page) is configured with multiple services, and multiple levels and multiple directions of association may exist between the services, so as to form a complex and huge service network. Each service has a life cycle, and the life cycles of the respective services may be the same or different. Thus, the complex service network in the page can be split into multiple independent service scopes according to the lifecycle. The service scope represents a set of services with an explicit lifecycle, all services under the set corresponding to the same service scope. The multiple business scopes have parent-child relationships, and can be divided into multiple levels of business scopes, and an upper level business scope can include one or more lower level business scopes. The lifecycle of the upper business scope must be greater than or equal to the lower business scope.
A corresponding dependency injection scope object and a covariant Cheng Zuoyong domain object are established for each business scope. For each service scope, the development of the service is completed based on the corresponding dependency injection scope object and the cooperative Cheng Zuoyong domain object, and the service logic is self-operated based on the corresponding life cycle.
The business scope, the dependency injection scope object and the protocol Cheng Zuoyong domain object have corresponding relations. Accordingly, the hierarchy of the business scope and the hierarchy of the protocol Cheng Zuoyong domain object also have correspondence with the hierarchy of the dependency injection scope object.
In this embodiment, the complex service network is split according to the lifecycle, so that a series of small service scope and corresponding service can be obtained. The developer of each service only needs to pay attention to the service scope associated with the service of the developer, and does not need to understand all service units, so that the development cost is reduced. Code isolation is realized through different service scopes, so that maintenance cost caused by establishing an error reference relation is reduced, and the risk of establishing the service dependency relation by mistake is reduced.
The above embodiments introduce the hierarchy and the correspondence of the service scope, and in the following, how to build the corresponding dependency injection scope object and the collaboration Cheng Zuoyong domain object when the service scope has multiple hierarchies, and how to complete the construction of the service units of the corresponding hierarchies.
In an alternative embodiment, the target corollary Cheng Zuoyong domain object corresponds to a first-level corollary Cheng Zuoyong domain object and the target dependency injection scope object corresponds to a first-level dependency injection scope object.
Correspondingly, the service processing method may further include steps S700 to S706, wherein:
in step S700, in response to the target event, a secondary protocol Cheng Zuoyong domain object is created under the primary protocol Cheng Zuoyong domain object.
In step S702, a secondary dependency injection scope object corresponding to the secondary collaboration Cheng Zuoyong domain object is created under the primary dependency injection scope object.
Step S704, creating the secondary service unit according to the secondary protocol Cheng Zuoyong domain object and the secondary dependency injection scope object.
Step S706, running the secondary service unit under the secondary protocol Cheng Zuoyong domain object to manage the life cycle of the secondary service unit.
For example, the business scope may include a primary business scope and a secondary business scope. The primary service scope is the upper service scope of the secondary service scope. The primary business scope may establish a corresponding primary collaboration Cheng Zuoyong domain object and primary dependency injection scope object.
The target event may be a user requesting the computer device 10000 to initiate a certain service unit in the secondary service scope. In response to the target event, a secondary collaboration Cheng Zuoyong domain object may be created under the primary collaboration Cheng Zuoyong domain object. The primary and secondary co-Cheng Zuoyong domain objects also have parent-child relationships. A secondary dependency injection scope object corresponding to the secondary collaboration Cheng Zuoyong domain object is created under the primary dependency injection scope object. Thus, corresponding secondary collaboration Cheng Zuoyong domain objects and secondary dependency injection scope objects are also established for the secondary business scope. The secondary service units may then be created and self-run and self-terminate based on the corresponding lifecycle.
In the embodiment, a corresponding secondary cooperative Cheng Zuoyong domain and a corresponding secondary dependency injection scope are established aiming at the secondary service scope, so that the creation, the self-operation and the destruction of the secondary service unit are efficiently realized, and the management and the control of the secondary service unit are refined.
In an alternative embodiment, the target service unit is used as a primary service unit for serving the secondary protocol Cheng Zuoyong domain object and its lower protocol Cheng Zuoyong domain objects.
The secondary protocol Cheng Zuoyong domain object is limited by the primary protocol Cheng Zuoyong domain object, and when the primary protocol Cheng Zuoyong domain object ends, the secondary protocol Cheng Zuoyong domain object must also end, otherwise it is not required.
The second-level protocol Cheng Zuoyong domain object may refer to the first-level business unit of the first-level protocol Cheng Zuoyong domain object, because the life cycle of the upper-level protocol Cheng Zuoyong domain object is greater than or equal to that of the lower-level protocol Cheng Zuoyong domain object, and vice versa. That is, the primary business unit may serve the secondary protocol Cheng Zuoyong domain object. If there is a third-level service scope under the second-level service scope, the corresponding created third-level collaboration Cheng Zuoyong domain object may also reference the first-level service element.
In this embodiment, the life cycle of the primary protocol Cheng Zuoyong domain object is greater than or equal to that of the secondary protocol Cheng Zuoyong domain object, so that the secondary protocol Cheng Zuoyong domain object can refer to and does not affect the primary service unit. I.e., the primary service element may serve the secondary protocol Cheng Zuoyong domain object and its lower protocol Cheng Zuoyong domain objects. The business logic of different levels is relatively independent, so that the maintenance cost can be reduced. The primary service unit can provide services for a plurality of secondary cooperative Cheng Zuoyong domain objects, so that the number of times of writing the same function is reduced, the code reusability is improved, and the development cost is reduced.
In an alternative embodiment, the target service unit is configured to provide a driving service event stream.
The target traffic unit may be configured to monitor and capture different operational events to provide a stream of driven traffic events. The operational events may be user operations, external system interactions, timed tasks, and the like. For example, the operational event may include a user request to initiate a service unit, a user request to switch a service unit, a user request to update a service content, and so on. The target service units may include an interface service unit and a driver service unit. The interface service unit may be configured to request data return from the server according to the current parameter. The driver service unit may be configured to subscribe to a return value of the interface service unit, i.e. to subscribe to the driver service event stream.
Through subscribing the driving business event stream, the corresponding business unit and business content can be timely started and switched. For example, a driver business unit may subscribe to a driver business event stream via collectitest, thereby creating a corresponding protocol Cheng Zuoyong domain object from the driver business event stream for subsequent creation and self-running of the corresponding business unit based on the protocol Cheng Zuoyong domain object. Therein, collectitest needs to run under one of the protocol Cheng Zuoyong domain objects, i.e. under the target protocol Cheng Zuoyong domain object of the target service element. Whenever a new result (new return value) driving the traffic event stream is received by the Collectlatest, the Collectlatest may create a subordinate protocol Cheng Zuoyong domain object of the current protocol Cheng Zuoyong domain object (target protocol Cheng Zuoyong domain object). Corresponding business logic may be run in the subordinate protocol Cheng Zuoyong domain object. It should be noted that, other methods may be used to subscribe to the driving business event stream, which is not limited herein.
In this embodiment, the target service unit is configured to provide a driving service event stream to create a subordinate protocol Cheng Zuoyong domain object. Based on real business, the business unit and the business scope are combined through subscription to the driving business event stream, and a corresponding driving relation is established. By driving the traffic event stream, the backpressure problem caused by frequent changes of the event can be solved. For example, when an event changes frequently, performance optimization is achieved because the driver traffic event stream generates a new protocol Cheng Zuoyong domain object each time and the last protocol Cheng Zuoyong domain object is unregistered.
How the target service unit serves the subordinate protocol Cheng Zuoyong domain object to accomplish the start, handoff and update of the corresponding service unit will be described in detail below in connection with various exemplary embodiments.
In an alternative embodiment, the target cooperative Cheng Zuoyong domain object is a first-level cooperative Cheng Zuoyong domain object corresponding to a play page, and the target dependency injection scope object is a first-level dependency injection scope object corresponding to the play page; wherein the playing page is configured with a first secondary service and a second secondary service.
Correspondingly, the service processing method may further include steps S800 to S804:
Step S800, in response to a selected event for a first secondary service, creating a first secondary collaboration Cheng Zuoyong field object under the primary collaboration Cheng Zuoyong field object and a first secondary dependency injection field object under the primary dependency injection field object.
Step S802, creating a first secondary service unit according to the first secondary protocol Cheng Zuoyong domain object and the first secondary dependency injection scope object.
Step S804, running the first secondary service unit under the first secondary protocol Cheng Zuoyong domain object to manage the life cycle of the first secondary service unit.
Referring to fig. 2-4, upon entering a play page, a first level collaboration Cheng Zuoyong field object (pagecoretinescope) may be created that is the same as the life cycle of the play page, and a first level dependency injection scope object (pagecoretinescope) corresponding to the first level collaboration Cheng Zuoyong field object may be created in the dependency injection framework. A first level business unit is created by dependent injection based on pagecoretinescope and PageScope. The primary service unit operates under the primary protocol Cheng Zuoyong domain object, and the life cycle is limited by the primary protocol Cheng Zuoyong domain object. When the playing page is closed, the primary cooperative Cheng Zuoyong domain object is destroyed, and the primary service unit stops running and is released, so that the memory leakage can be reduced.
The play page may be configured with a plurality of services, including: UGC, OGV, etc. For example, a play page may be configured with a first secondary service and a second secondary service.
The selected event may be a user selected operation for a service in the play page. In the event that the user selects a first secondary service, a first secondary collaboration Cheng Zuoyong field object is created under the primary collaboration Cheng Zuoyong field object in response to the selected event (BizCorou tineScope). For example, when the user selects UGC business, the first secondary protocol Cheng Zuoyong domain object can be UGCBizCor outineScope. A first secondary dependency injection scope object (ugcbizscope) is created under the primary dependency injection scope object. Based on the first secondary collaboration Cheng Zuoyong domain object and the first secondary dependency injection scope object, a first secondary service unit running under the first secondary collaboration Cheng Zuoyong domain object is created through dependency injection, so that the first secondary service logic self-runs based on the corresponding lifecycle.
In this embodiment, a first secondary collaboration Cheng Zuoyong field object is created under the primary collaboration Cheng Zuoyong field object according to user requirements, based on which the lifecycle of the first secondary service element is created and managed. When the page is destroyed, the first-level cooperative Cheng Zuoyong domain object is destroyed, the lower-level (first-level) cooperative Cheng Zuoyong domain object is also destroyed, and the first-level service unit can automatically stop running and release. Conversely, destruction of the first secondary association Cheng Zuoyong domain object does not affect the primary association Cheng Zuoyong domain object, i.e., operation and termination of the first secondary service element does not affect normal operation of the playout page. It can be known that the service logic is relatively independent and the maintenance cost is reduced by using a plurality of cooperative Cheng Zuoyong domain objects to respectively manage the corresponding service units according to the life cycle.
In an alternative embodiment, the first secondary service and the second secondary service are mutually exclusive.
The service processing method may further include steps S900 to S904:
in step S900, in response to a selected event for a second level of service, destroying the first level of collaboration Cheng Zuoyong domain object, and creating a second level of collaboration Cheng Zuoyong domain object under the first level of collaboration Cheng Zuoyong domain object and a second level of dependency injection scope object under the first level of dependency injection scope object.
In step S902, a second level service unit is created according to the second level collaboration Cheng Zuoyong domain object and the second level dependency injection scope object.
Step S904, running the second-level service unit under the second-level protocol Cheng Zuoyong domain object to manage the life cycle of the second-level service unit.
The first secondary service and the second secondary service can be set to be in mutual exclusion relation, and only one secondary service can exist on the same playing page at the same time. The primary service unit may determine the secondary service to be started according to the subscribed driving service event stream. If the current playing page already has the secondary service protocol Cheng Zuoyong domain object, the current secondary service protocol Cheng Zuoyong domain object and the lower protocol Cheng Zuoyong domain object thereof need to be destroyed to close the current secondary service, so that a new secondary service can be started.
For example, the first secondary service is a UGC service. Accordingly, running in the first secondary protocol Cheng Zuoyong domain object is a service unit unique to the UGC service, such as a UGC multi-P logic, a UGC screen comment, and the like. The second level service may be an OGV service, where the UGC service and the OGV service have mutually exclusive relationships. In the case where the first secondary service already exists on the play page, when the user selects the second secondary service, a service switching is required.
Specific: the selected event is sent to the driving business event stream, the first secondary protocol Cheng Zuoyong domain object and the lower protocol Cheng Zuoyong domain object thereof can be destroyed based on the new event, the corresponding first secondary business unit is also terminated and released, the business error risk is reduced, and the memory leakage problem is relieved. A second level of collaboration Cheng Zuoyong field object is created under the first level of collaboration Cheng Zuoyong field object (OGVB izCoroutineScope). A second level dependency injection scope object (OG VBizScope) is created under the first level dependency injection scope object. Based on the second-level cooperative Cheng Zuoyong domain object and the second-level dependent injection scope object, a second-level service unit running under the second-level cooperative Cheng Zuoyong domain object is created through dependent injection, so that the second-level service logic self-runs based on the corresponding life cycle and service switching operation is completed.
In this embodiment, the current first secondary service protocol Cheng Zuoyong domain object is terminated based on the new selected event, thereby stopping all first secondary service units under the current first secondary service protocol Cheng Zuoyong domain object. Then a new second-level protocol Cheng Zuoyong domain object is created to create and manage a new second-level service unit, so that service switching is efficiently realized, and service error risk is reduced.
In an alternative embodiment, the first secondary service is associated with a first tertiary service, wherein the first tertiary service is used to play one or more media objects.
Correspondingly, the service processing method may further include steps S1000 to S1004:
step S1000, in response to a selected event for a first media object in the first tertiary service, creates a first tertiary collaboration Cheng Zuoyong field object under the first secondary collaboration Cheng Zuoyong field object, corresponding to the first media object, and creates a first tertiary dependency injection scope object under the first secondary dependency injection scope, corresponding to the first media object.
Step S1002 creates the first tertiary service unit corresponding to the first media object according to the first tertiary protocol Cheng Zuoyong domain object corresponding to the first media object and the first tertiary dependency injection scope object corresponding to the first media object.
Step S1004, running the first tertiary service unit corresponding to the first media object under the first tertiary protocol Cheng Zuoyong domain object corresponding to the first media object to manage the life cycle of the first tertiary service unit corresponding to the first media object.
For example, if the first secondary service is a UGC service, the first secondary service may be a UGC video playback service associated therewith. In practical applications, UGC video may have multiple P (parts) in a play page, each P corresponding to a separate video feed. The user selects different partitions p and the playing page will present different UGC videos. Thus, the first level service may be used to play one or more media objects. The media objects may include video, audio, animation, etc., without limitation.
The user may select a score P (first media object) in the UGC video list presented by the playlist. In response to the selected event, a first tertiary protocol Cheng Zuoyong domain object (ugcecapontine) corresponding to the first media object is created under the first secondary protocol Cheng Zuoyong domain object (ugcbizcorouitinescope). A first level three dependency injection scope object (UGCEPScope) corresponding to the first media is created under the first level two dependency injection scope. Based on UGCEPCoroutineSco pe and ugcecepoutipes, a first tertiary service unit running under a first tertiary protocol Cheng Zuoyong domain object is created by dependency injection, thereby enabling the first tertiary service logic to run itself, i.e. play, the first media object based on the corresponding lifecycle.
In an alternative embodiment, the service processing method may further include steps S1100 to S1104:
step S1100, in response to a selected event for a second media object in the first tertiary service, destroys the first tertiary protocol Cheng Zuoyong domain object corresponding to the first media object, creates a first tertiary protocol Cheng Zuoyong domain object corresponding to the second media object under the first secondary protocol Cheng Zuoyong domain object, and creates a first tertiary dependent injection scope object corresponding to the second media object under the first secondary dependent injection scope.
In step S1102, the first tertiary service unit corresponding to the second media object is created according to the first tertiary protocol Cheng Zuoyong domain object corresponding to the second media object and the first tertiary dependency injection scope object corresponding to the second media object.
Step S1104, running the first tertiary service unit corresponding to the second media object under the first tertiary protocol Cheng Zuoyong domain object corresponding to the second media object to manage the life cycle of the first tertiary service unit corresponding to the second media object.
Because UGC video corresponds to independent video feeds per P, both manual switching of video by the user and automatic switching of video by the system require creation of a first tertiary protocol Cheng Zuoyong domain object and a first tertiary business unit corresponding to the new video (second media object).
Specific: selected events for the second media object are sent into the driven business event stream, and the first tertiary protocol Cheng Zuoyong domain object corresponding to the first media object may be destroyed based on the new event. Correspondingly, the first-level service unit corresponding to the first media object is also terminated and released, so that the service error risk and the code complexity are reduced.
A first tertiary protocol Cheng Zuoyong domain object is created under the first secondary protocol Cheng Zuoyong domain object that corresponds to a second media object. A first tertiary dependency injection scope object corresponding to the second media object is created under the first secondary dependency injection scope object. The first tertiary service unit running under the first tertiary protocol Cheng Zuoyong domain object corresponding to the second media object is created through the dependent injection, so that the first tertiary service logic corresponding to the second media object automatically runs based on the corresponding life cycle, and video switching operation is completed.
In practical applications, the primary service unit may also be configured to subscribe to the video play data stream, and when a new video object (second media object) exists in the video play data stream, the first tertiary protocol Cheng Zuoyong domain object corresponding to the first media object may be created again based on the second media object ending the first tertiary protocol Cheng Zuoyong domain object corresponding to the second media object.
To make the application easier to understand, an exemplary application is provided below in connection with fig. 12.
S10, initializing a playing page.
S11, creating a page protocol Cheng Zuoyong domain object (PageCoroutinEScope).
S12, creating a page dependency injection scope object (PageScope) in the dependency injection framework.
In the Dagger dependency injection framework, pageScope can be created by creating PageComponent, which in turn creates PageScope.
It should be noted that in other dependency injection frameworks, the PageComponent may not be needed to create the PageScope.
S13, binding the page collaboration Cheng Zuoyong domain object to the page dependency injection scope object.
S14, constructing a PageAnchor object through page dependency injection scope object, thereby creating a page service unit.
The page service unit may include a page interface service unit and a driving service unit.
The page interface service unit is used for transmitting the parameters of the current page and requesting the data of the server to return.
The driving business unit is used for subscribing the return value of the page interface business unit.
S15, the page service unit subscribes to the page interface through the collectiLatest to return a value flow, so that a service protocol Cheng Zuoyong domain object (BizCoroutineStope) corresponding to the service type is created.
S16, creating a corresponding business dependence injection scope object according to the BizCoroutineCope and the page interface return value, and creating a business unit running under the current BizCoroutineCope.
S17, subscribing the video playing flow of the current service through the collectiLatest according to the page service unit, thereby creating a corresponding video playing protocol Cheng Zuoyong domain object (EPCoroutineScope).
S18, creating a corresponding business dependency injection scope object according to the EPCoroutinEScope and the page interface return value, and creating a business unit running under the current EPCoroutinEScope.
S19, monitoring whether a video switching event occurs.
If yes, go to S20; if not, S21 is entered.
And S20, sending a new video object to the video playing flow of the current service, ending the video playing protocol Cheng Zuoyong domain object of the current video, and entering S17.
S21, monitoring whether a service switching event occurs.
If yes, go to S22; if not, S17 is entered.
S22, a new interface return value is sent to the page interface flow by calling the page interface, so that the business protocol Cheng Zuoyong domain object of the current business is ended, and S15 is entered.
In this exemplary application, (1) the complex and huge business network is broken down into multiple independent business scopes according to different lifecycles and corresponding dependency injection scopes and covariant Cheng Zuoyong domains are established; (2) Aiming at each service scope, completing the development of the service unit based on the corresponding cooperative Cheng Zuoyong domain and the dependency injection; (3) Based on real service, combining the service unit and the service action domain through subscription to the driving service event stream, and establishing a corresponding driving relation; (4) And creating a service unit through event subscription-driven dependency injection, so that the service logic is self-operated based on the corresponding life cycle.
Example two
Fig. 14 schematically shows a block diagram of a service processing device according to a second embodiment of the present application, which may be divided into one or more program modules, which are stored in a storage medium and executed by one or more processors, to complete the embodiment of the present application. Program modules in accordance with the embodiments of the present application are directed to a series of computer program instruction segments capable of performing the specified functions, and the following description describes each program module in detail. As shown in fig. 13, the apparatus 1300 may include: a first creation module 1310, a second creation module 1320, a third creation module 1330, a run module 1340, wherein:
a first creating module 1310, configured to create a target protocol Cheng Zuoyong domain object;
a second creating module 1320, configured to create a target dependency injection scope object corresponding to the target protocol Cheng Zuoyong domain object in a dependency injection framework;
a third creating module 1330 configured to create the target service unit according to the target protocol Cheng Zuoyong domain object and the target dependency injection scope object;
an operation module 1340 is configured to operate the target service unit under the target protocol Cheng Zuoyong domain object to manage the target service unit.
As an alternative embodiment, the target dependency injection scope object declares a target service anchor, the target service anchor comprising a plurality of service units;
correspondingly, the third creating module 1330 is further configured to:
binding the target protocol Cheng Zuoyong domain object to the target dependency injection scope object;
and creating a target service unit in the target dependency injection scope object through the target protocol Cheng Zuoyong domain object and the target service anchor point.
As an optional embodiment, the number of the services is multiple, and multiple services correspond to multiple service scopes;
the plurality of business scopes are divided into multiple levels of business scopes;
in the multi-level service scope, the upper level service scope comprises one or more lower level service scopes;
wherein, each business scope corresponds to a cooperative Cheng Zuoyong domain object and a dependency injection scope object;
the hierarchy of the business scope and the hierarchy of the collaboration Cheng Zuoyong domain object have a corresponding relationship with the hierarchy of the dependency injection scope object.
As an alternative embodiment, the target cooperative Cheng Zuoyong domain object corresponds to a first-level cooperative Cheng Zuoyong domain object, and the target dependent injection scope object corresponds to a first-level dependent injection scope object;
The service processing apparatus 1300 is further configured to:
creating a secondary collaboration Cheng Zuoyong field object under the primary collaboration Cheng Zuoyong field object in response to a target event;
creating a secondary dependency injection scope object corresponding to the secondary cooperative Cheng Zuoyong domain object in a dependency injection framework;
creating the secondary service unit according to the secondary cooperative Cheng Zuoyong domain object and the secondary dependency injection scope object;
and operating the secondary service unit under the secondary protocol Cheng Zuoyong domain object to manage the life cycle of the secondary service unit.
As an alternative embodiment, the target service unit is used as a primary service unit, and is used for serving the secondary protocol Cheng Zuoyong domain object and the subordinate protocol Cheng Zuoyong domain object thereof.
As an alternative embodiment, the target service unit is configured to provide a driving service event stream.
As an optional embodiment, the target cooperative Cheng Zuoyong domain object is a first-level cooperative Cheng Zuoyong domain object corresponding to a play page, and the target dependency injection scope object is a first-level dependency injection scope object corresponding to the play page; the play page is configured with a first secondary service and a second secondary service; correspondingly, the service processing apparatus 1300 is further configured to:
Creating a first secondary collaboration Cheng Zuoyong field object under the primary collaboration Cheng Zuoyong field object and a first secondary dependency injection scope object under the primary dependency injection scope object in response to a selected event for a first secondary service;
creating a first secondary service unit according to the first secondary collaboration Cheng Zuoyong domain object and the first secondary dependency injection scope object;
the first secondary service unit is operated under the first secondary protocol Cheng Zuoyong domain object to manage a lifecycle of the first secondary service unit.
As an alternative embodiment, the first secondary service and the second secondary service are mutually exclusive, and the service processing apparatus 1300 is further configured to:
destroying the first secondary collaboration Cheng Zuoyong domain object in response to a selected event for a second secondary service, and creating a second secondary collaboration Cheng Zuoyong domain object under the primary collaboration Cheng Zuoyong domain object and a second secondary dependency injection scope object under the primary dependency injection scope object;
creating a second-level service unit according to the second-level cooperative Cheng Zuoyong domain object and the second-level dependency injection scope object;
And running the second-level service unit under the second-level cooperative Cheng Zuoyong domain object to manage the life cycle of the second-level service unit.
As an alternative embodiment, the first secondary service is associated with a first tertiary service, wherein the first tertiary service is used to play one or more media objects; correspondingly, the service processing apparatus 1300 is further configured to:
in response to a selected event for a first media object in the first tertiary service, creating a first tertiary collaboration Cheng Zuoyong field object under the first secondary collaboration Cheng Zuoyong field object corresponding to the first media object, and creating a first tertiary dependency injection scope object under the first secondary dependency injection scope corresponding to the first media object;
creating the first tertiary service unit corresponding to the first media object according to the first tertiary protocol Cheng Zuoyong domain object corresponding to the first media object and the first tertiary dependent injection scope object corresponding to the first media object;
the first tertiary service unit corresponding to the first media object is run under the first tertiary protocol Cheng Zuoyong domain object corresponding to the first media object to manage a lifecycle of the first tertiary service unit corresponding to the first media object.
As an alternative embodiment, the service processing apparatus 1300 is further configured to:
destroying the first tertiary co-Cheng Zuoyong domain object corresponding to the first media object and creating a first tertiary co-Cheng Zuoyong domain object corresponding to the second media object under the first secondary co-Cheng Zuoyong domain object and creating a first tertiary dependent injection scope object corresponding to the second media object under the first secondary dependent injection scope in response to a selected event for the second media object in the first tertiary service;
creating the first tertiary service unit corresponding to the second media object according to the first tertiary protocol Cheng Zuoyong domain object corresponding to the second media object and the first tertiary dependent injection scope object corresponding to the second media object;
the first tertiary service unit corresponding to the second media object is run under the first tertiary protocol Cheng Zuoyong domain object corresponding to the second media object to manage the lifecycle of the first tertiary service unit corresponding to the second media object.
Example III
Fig. 14 schematically shows a hardware architecture diagram of a computer device 10000 adapted to implement a service processing method according to a third embodiment of the present application. In some embodiments, computer device 10000 may be a smart phone, a wearable device, a tablet, a personal computer, a vehicle terminal, a gaming machine, a virtual device, a workstation, a digital assistant, a set top box, a robot, or the like. In other embodiments, the computer device 10000 may be a rack server, a blade server, a tower server, or a rack server (including a stand-alone server, or a server cluster composed of multiple servers), or the like. As shown in fig. 14, the computer device 10000 includes, but is not limited to: the memory 10010, processor 10020, network interface 10030 may be communicatively linked to each other via a system bus. Wherein:
Memory 10010 includes at least one type of computer-readable storage medium including flash memory, hard disk, multimedia card, card memory (e.g., SD or DX memory), random Access Memory (RAM), static Random Access Memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, and the like. In some embodiments, memory 10010 may be an internal storage module of computer device 10000, such as a hard disk or memory of computer device 10000. In other embodiments, the memory 10010 may also be an external storage device of the computer device 10000, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card) or the like, which are provided on the computer device 10000. Of course, the memory 10010 may also include both an internal memory module of the computer device 10000 and an external memory device thereof. In this embodiment, the memory 10010 is typically used for storing an operating system installed on the computer device 10000 and various application software, such as program codes of a service processing method. In addition, the memory 10010 may be used to temporarily store various types of data that have been output or are to be output.
The processor 10020 may be a central processing unit (Central Processing Unit, CPU), controller, microcontroller, microprocessor, or other chip in some embodiments. The processor 10020 is typically configured to control overall operation of the computer device 10000, such as performing control and processing related to data interaction or communication with the computer device 10000. In this embodiment, the processor 10020 is configured to execute program codes or process data stored in the memory 10010.
The network interface 10030 may comprise a wireless network interface or a wired network interface, which network interface 10030 is typically used to establish a communication link between the computer device 10000 and other computer devices. For example, the network interface 10030 is used to connect the computer device 10000 to an external terminal through a network, establish a data transmission channel and a communication link between the computer device 10000 and the external terminal, and the like. The network may be a wireless or wired network such as an Intranet (Intranet), the Internet (Internet), a global system for mobile communications (Global System of Mobile communication, abbreviated as GSM), wideband code division multiple access (Wideband Code Division Multiple Access, abbreviated as WCDMA), a 4G network, a 5G network, bluetooth (Bluetooth), wi-Fi, etc.
It should be noted that fig. 14 only shows a computer device having components 10010-10030, but it should be understood that not all of the illustrated components are required to be implemented, and that more or fewer components may be implemented instead.
In this embodiment, the service processing method stored in the memory 10010 may be further divided into one or more program modules and executed by one or more processors (such as the processor 10020) to complete the embodiment of the present application.
Example IV
The embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps of the service processing method in the embodiment.
In this embodiment, the computer-readable storage medium includes a flash memory, a hard disk, a multimedia card, a card memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, and the like. In some embodiments, the computer readable storage medium may be an internal storage unit of a computer device, such as a hard disk or a memory of the computer device. In other embodiments, the computer readable storage medium may also be an external storage device of a computer device, such as a plug-in hard disk, smart Media Card (SMC), secure Digital (SD) Card, flash memory Card (Flash Card), etc. that are provided on the computer device. Of course, the computer-readable storage medium may also include both internal storage units of a computer device and external storage devices. In this embodiment, the computer readable storage medium is typically used to store an operating system and various types of application software installed on a computer device, such as program codes of the service processing method in the embodiment, and the like. Furthermore, the computer-readable storage medium may also be used to temporarily store various types of data that have been output or are to be output.
It will be apparent to those skilled in the art that the modules or steps of the embodiments of the application described above may be implemented in a general purpose computer device, they may be concentrated on a single computer device, or distributed over a network of multiple computer devices, they may alternatively be implemented in program code executable by a computer device, so that they may be stored in a storage device for execution by the computer device, and in some cases, the steps shown or described may be performed in a different order than what is shown or described, or they may be separately made into individual integrated circuit modules, or a plurality of modules or steps in them may be made into a single integrated circuit module. Thus, embodiments of the application are not limited to any specific combination of hardware and software.
It should be noted that the foregoing is only a preferred embodiment of the present application, and is not intended to limit the scope of the present application, and all equivalent structures or equivalent processes using the descriptions of the present application and the accompanying drawings, or direct or indirect application in other related technical fields, are included in the scope of the present application.

Claims (13)

1. A method of service processing, the method comprising:
creating a target protocol Cheng Zuoyong domain object;
creating a target dependency injection scope object corresponding to the target protocol Cheng Zuoyong domain object in a dependency injection framework;
creating the target business unit according to the target protocol Cheng Zuoyong domain object and the target dependency injection scope object;
and operating the target business unit under the target protocol Cheng Zuoyong domain object to manage the target business unit.
2. The method of claim 1, wherein the target dependency injection scope object declares a target service anchor, the target service anchor comprising a plurality of service units;
correspondingly, creating the target business unit according to the target protocol Cheng Zuoyong domain object and the target dependency injection scope object comprises:
binding the target protocol Cheng Zuoyong domain object to the target dependency injection scope object;
and creating a target service unit in the target dependency injection scope object through the target protocol Cheng Zuoyong domain object and the target service anchor point.
3. The method of claim 1, wherein the step of determining the position of the substrate comprises,
The number of the services is multiple, and the multiple services correspond to multiple service scopes;
the plurality of business scopes are divided into multiple levels of business scopes;
in the multi-level service scope, the upper level service scope comprises one or more lower level service scopes;
wherein, each business scope corresponds to a cooperative Cheng Zuoyong domain object and a dependency injection scope object;
the hierarchy of the business scope and the hierarchy of the collaboration Cheng Zuoyong domain object have a corresponding relationship with the hierarchy of the dependency injection scope object.
4. A method according to claim 3, wherein the target-co-Cheng Zuoyong domain object corresponds to a first-level co-Cheng Zuoyong domain object and the target-dependent injection scope object corresponds to a first-level dependent injection scope object;
the method further comprises the steps of:
creating a secondary collaboration Cheng Zuoyong field object under the primary collaboration Cheng Zuoyong field object in response to a target event;
creating a secondary dependency injection scope object corresponding to the secondary cooperative Cheng Zuoyong domain object under the primary dependency injection scope object;
creating the secondary service unit according to the secondary cooperative Cheng Zuoyong domain object and the secondary dependency injection scope object;
And operating the secondary service unit under the secondary protocol Cheng Zuoyong domain object to manage the life cycle of the secondary service unit.
5. The method according to claim 4, wherein:
the target service unit is used as a primary service unit for serving the secondary protocol Cheng Zuoyong domain object and the lower protocol Cheng Zuoyong domain object thereof.
6. The method according to any one of claims 1 to 5, wherein:
the target service unit is configured to provide a driving service event stream.
7. A method according to claim 3, wherein the target-assisted Cheng Zuoyong domain object is a first-level-assisted Cheng Zuoyong domain object corresponding to a play page, and the target-dependent injection scope object is a first-level-dependent injection scope object corresponding to the play page; the play page is configured with a first secondary service and a second secondary service; correspondingly, the method further comprises:
creating a first secondary collaboration Cheng Zuoyong field object under the primary collaboration Cheng Zuoyong field object and a first secondary dependency injection scope object under the primary dependency injection scope object in response to a selected event for a first secondary service;
Creating a first secondary service unit according to the first secondary collaboration Cheng Zuoyong domain object and the first secondary dependency injection scope object;
the first secondary service unit is operated under the first secondary protocol Cheng Zuoyong domain object to manage a lifecycle of the first secondary service unit.
8. The method of claim 7, wherein the first secondary service and the second secondary service are mutually exclusive, the method further comprising:
destroying the first secondary collaboration Cheng Zuoyong domain object in response to a selected event for a second secondary service, and creating a second secondary collaboration Cheng Zuoyong domain object under the primary collaboration Cheng Zuoyong domain object and a second secondary dependency injection scope object under the primary dependency injection scope object;
creating a second-level service unit according to the second-level cooperative Cheng Zuoyong domain object and the second-level dependency injection scope object;
and running the second-level service unit under the second-level cooperative Cheng Zuoyong domain object to manage the life cycle of the second-level service unit.
9. The method of claim 7, wherein the first secondary service is associated with a first tertiary service, wherein the first tertiary service is used to play one or more media objects; correspondingly, the method further comprises:
In response to a selected event for a first media object in the first tertiary service, creating a first tertiary collaboration Cheng Zuoyong field object under the first secondary collaboration Cheng Zuoyong field object corresponding to the first media object, and creating a first tertiary dependency injection scope object under the first secondary dependency injection scope corresponding to the first media object;
creating the first tertiary service unit corresponding to the first media object according to the first tertiary protocol Cheng Zuoyong domain object corresponding to the first media object and the first tertiary dependent injection scope object corresponding to the first media object;
the first tertiary service unit corresponding to the first media object is run under the first tertiary protocol Cheng Zuoyong domain object corresponding to the first media object to manage a lifecycle of the first tertiary service unit corresponding to the first media object.
10. The method according to claim 9, wherein the method further comprises:
destroying the first tertiary co-Cheng Zuoyong domain object corresponding to the first media object and creating a first tertiary co-Cheng Zuoyong domain object corresponding to the second media object under the first secondary co-Cheng Zuoyong domain object and creating a first tertiary dependent injection scope object corresponding to the second media object under the first secondary dependent injection scope in response to a selected event for the second media object in the first tertiary service;
Creating the first tertiary service unit corresponding to the second media object according to the first tertiary protocol Cheng Zuoyong domain object corresponding to the second media object and the first tertiary dependent injection scope object corresponding to the second media object;
the first tertiary service unit corresponding to the second media object is run under the first tertiary protocol Cheng Zuoyong domain object corresponding to the second media object to manage the lifecycle of the first tertiary service unit corresponding to the second media object.
11. A service processing apparatus, the apparatus comprising:
the first creation module is used for creating a target protocol Cheng Zuoyong domain object;
the second creating module is used for creating a target dependency injection scope object corresponding to the target cooperative Cheng Zuoyong domain object in the dependency injection framework;
a third creating module, configured to create the target service unit according to the target protocol Cheng Zuoyong domain object and the target dependency injection scope object;
and the operation module is used for operating the target business unit under the target protocol Cheng Zuoyong domain object so as to manage the target business unit.
12. A computer device, comprising:
At least one processor; and
A memory communicatively coupled to the at least one processor; wherein:
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1 to 10.
13. A computer readable storage medium having stored therein computer instructions which when executed by a processor implement the method of any one of claims 1 to 10.
CN202311055149.5A 2023-08-21 2023-08-21 Service processing method and device Pending CN117111897A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311055149.5A CN117111897A (en) 2023-08-21 2023-08-21 Service processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311055149.5A CN117111897A (en) 2023-08-21 2023-08-21 Service processing method and device

Publications (1)

Publication Number Publication Date
CN117111897A true CN117111897A (en) 2023-11-24

Family

ID=88799520

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311055149.5A Pending CN117111897A (en) 2023-08-21 2023-08-21 Service processing method and device

Country Status (1)

Country Link
CN (1) CN117111897A (en)

Similar Documents

Publication Publication Date Title
CN109597814B (en) Online rapid delivery system of background management information system
JP7013466B2 (en) Application data processing methods, equipment, and computer programs
CN105474206A (en) Virtual synchronization with on-demand data delivery
US20090037724A1 (en) Server method and system for rendering content on a wireless device
CN109800135B (en) Information processing method and terminal
CN105224343A (en) A kind of renewal reminding method of application program and device
CN105072461A (en) Data processing method and device
CN110321131B (en) Service component packaging method, system and server
CN104704468A (en) Cross system installation of WEB applications
EP4210053A1 (en) Application program control method and apparatus, electronic device, and storage medium
CN114064024A (en) Method, apparatus, device, storage medium, and program product for developing micro-application
CN102523102A (en) Unified policy over heterogenous device types
CN108958843A (en) Plug-in unit construction method, system, equipment and medium based on lightweight script
CN104423961A (en) Method and system for generating testing script
CN110928935A (en) Data access command processing method, device and system
CN112394932A (en) Automatic browser webpage skin changing method and device
CN101295382A (en) Method and device for implementing service logical relation between business object properties
JP6002302B2 (en) Web application generation system, Web application generation system control method, Web application generation system program, Web application generation device, Web application generation device control method, and Web application generation device program
CN102541544A (en) Method, device and system for processing tree control
US10929121B2 (en) Method, device and related system for dynamically repairing application
JP5504168B2 (en) Method and apparatus for controlling display of information area on standby screen of mobile terminal
CN117873597A (en) Method and system for realizing API arrangement through visual configuration mode
CN117111897A (en) Service processing method and device
CN111752454A (en) Skin control method, device, terminal and medium for application program interface
CN110908644A (en) Configuration method and device of state node, computer equipment and storage medium

Legal Events

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