Data processing method and device, storage medium and electronic device
By determining the deployment strategy and selecting the execution container in the message middleware, generating and storing the data stream, and outputting the required data at the consumer end, the problem of low data processing efficiency in the existing technology is solved, and network traffic consumption is reduced.
Patent Information
- Application Number
- CN202110758037.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-05
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2041-07-05
AI Technical Summary
Existing message middleware cannot process data on the server side, causing the consumer side to consume the entire data stream to obtain the required data, resulting in unnecessary waste of network traffic.
Determine the deployment strategy in the server cluster and container cluster through the message middleware, select the execution container corresponding to the target function, generate the data stream and store it in the distributed storage system, trigger the container cluster to subscribe to the data stream, and start when the consumer sends a consumption instruction. The corresponding execution container output data stream.
It realizes simple processing and filtering of data in the message middleware, reducing the amount of data that the consumer needs to consume and reducing network traffic consumption.
Smart Images

Figure CN113342552B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of message middleware, and in particular to a data processing method and device, a storage medium and an electronic device. Background Art
[0002] Message middleware is widely used in our daily work. In daily applications, message middleware can be used to receive and publish large amounts of data to relieve network pressure.
[0003] In the current application process of conventional message middleware, we have no way to perform some common data processing operations on the server side. We can only perform some enhanced processing on the data before production or after consumption. For example, if there is a stream with 10 million data, we expect to obtain a part of the data. If there are 100,000 data that meet the conditions, the consumer side needs to extract the data in the entire data stream and then perform the corresponding data calculation to obtain the final required data. When the consumer side consumes data, the consumption of 9.9 million data is a waste of network traffic. Therefore, applying the method in the prior art is likely to increase the network traffic on the consumer side. Summary of the invention
[0004] In view of this, the present invention provides a data processing method, through which simple data processing is performed through message middleware, and corresponding data streams are output according to different functions, without the need for the consumer end to consume all the data and then perform a series of operations such as filtering.
[0005] The present invention also provides a data processing device to ensure the implementation and application of the above method in practice.
[0006] A data processing method is applied to a message middleware, wherein the message middleware includes a server cluster and a container cluster, wherein the server cluster includes at least one server, and the container cluster includes at least one execution container, and the method includes:
[0007] When it is detected that the client uploads the target function to the first server in the server cluster, determining a deployment strategy corresponding to the container cluster in the message middleware;
[0008] Based on the deployment strategy, selecting a first execution container corresponding to the target function in the container cluster;
[0009] Generate a data stream corresponding to the objective function, and store the data stream in a pre-set distributed storage system;
[0010] Generate an execution object corresponding to the data flow in the first execution container, and trigger all execution containers in the container cluster to subscribe to the data flow;
[0011] When it is detected that the consumer end sends a consumption instruction corresponding to the data flow to the second server in the server cluster, based on the deployment strategy, the second execution container corresponding to the consumption instruction is started, so that the second execution container triggers the execution object to output the data flow to the consumer end.
[0012] In the above method, optionally, determining the deployment strategy corresponding to the container cluster in the message middleware includes:
[0013] Detecting the deployment position of each of the execution containers in the container cluster in the message middleware;
[0014] When the deployment location of each execution container in the container cluster is built-in deployment, determining that the deployment strategy corresponding to the container cluster in the message middleware is built-in mode, the built-in deployment indicates that each execution container in the container cluster is deployed one-to-one in each server of the server cluster;
[0015] When the deployment location of each execution container in the container cluster is independently deployed, it is determined that the deployment strategy corresponding to the container cluster in the message middleware is an independent mode, and the independent mode indicates that each execution container in the container cluster is independently deployed outside the server cluster.
[0016] In the above method, optionally, selecting, in the container cluster, a first execution container corresponding to the target function based on the deployment strategy includes:
[0017] When the deployment strategy corresponding to the container cluster in the message middleware is a built-in mode, the execution container built into the first server is selected as the first execution container corresponding to the target function.
[0018] In the above method, optionally, selecting, in the container cluster, a first execution container corresponding to the target function based on the deployment strategy includes:
[0019] When the deployment strategy corresponding to the container cluster in the message middleware is an independent mode, any one execution container in the container cluster is selected as the first execution container corresponding to the target function.
[0020] Optionally, the method described above, starting the second execution container corresponding to the consumption instruction so that the second execution container triggers the execution object to output the data stream to the consumer end, includes:
[0021] When the deployment strategy is a built-in mode, setting the execution container set in the second server as a second execution container;
[0022] Detecting whether the running state of the second execution container is normal;
[0023] If the running state of the second execution container is normal, the second execution container is started, and the consumption instruction is forwarded to the second execution container, so that the second execution container triggers the execution object to output the data stream corresponding to the consumption instruction to the consumer end.
[0024] Optionally, the method described above, starting the second execution container corresponding to the consumption instruction so that the second execution container triggers the execution object to output the data stream to the consumer end, includes:
[0025] When the deployment strategy is an independent mode, any execution container in the container cluster whose running state is normal is selected as the second execution container;
[0026] The second execution container is started, and the consumption instruction is forwarded to the second execution container, so that the second execution container triggers the execution object to output the data stream corresponding to the consumption instruction to the consumer end.
[0027] The above method, optionally, after storing the data stream in a pre-set distributed storage system, further comprises:
[0028] Generate storage information corresponding to the data stream, and send the storage information to the client.
[0029] A data processing device, the device is applied to message middleware, the device comprises:
[0030] A determination unit, configured to determine a deployment strategy corresponding to the container cluster in the message middleware when detecting that a client uploads a target function to a first server in the server cluster;
[0031] A selection unit, configured to select, in the container cluster, a first execution container corresponding to the objective function based on the deployment strategy;
[0032] A first generating unit, configured to generate a data stream corresponding to the objective function, and store the data stream in a pre-set distributed storage system;
[0033] A second generating unit is configured to generate an execution object corresponding to the data flow in the first execution container, and trigger all execution containers in the container cluster to subscribe to the data flow;
[0034] The sending unit is used to start the second execution container corresponding to the consumption instruction based on the deployment strategy when it is detected that the consumer end sends the consumption instruction corresponding to the data flow to the second server in the server cluster, so that the second execution container triggers the execution object to output the data flow to the consumer end.
[0035] A storage medium includes stored instructions, wherein when the instructions are executed, the device where the storage medium is located is controlled to execute the above-mentioned data processing method.
[0036] An electronic device includes a memory and one or more instructions, wherein the one or more instructions are stored in the memory and are configured to be executed by one or more processors to perform the above data processing method.
[0037] Compared with the prior art, the present invention has the following advantages:
[0038] The present invention provides a data processing method, which is applied to a message middleware, wherein the message middleware includes a server cluster and a container cluster, wherein the server cluster includes at least one server, and the container cluster includes at least one execution container, wherein the method includes: when it is detected that a client uploads a target function to a first server in the server cluster, determining a deployment strategy corresponding to the container cluster in the message middleware; based on the deployment strategy, selecting a first execution container corresponding to the target function in the container cluster; generating a data stream corresponding to the target function, and storing the data stream in a pre-set distributed storage system; generating an execution object corresponding to the data stream in the first execution container, and triggering all execution containers in the container cluster to subscribe to the data stream; when it is detected that a consumer end sends a consumption instruction corresponding to the data stream to a second server in the server cluster, based on the deployment strategy, starting a second execution container corresponding to the consumption instruction, so that the second execution container triggers the execution object to output the data stream to the consumer end. Applying the method provided by the present invention, simple data processing is performed on the message middleware, and corresponding data is output according to different functions, without requiring the consumer end to consume all the data and then perform a series of operations such as filtering. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0040] Figure 1A method flow chart of a data processing method provided by an embodiment of the present invention;
[0041] Figure 2 A flowchart of another method of a data processing method provided by an embodiment of the present invention;
[0042] Figure 3a A schematic diagram of a structure in which a deployment strategy in a data processing method provided in an embodiment of the present invention is a built-in mode;
[0043] Figure 3b A schematic diagram of a structure in which a deployment strategy in an independent mode is provided in a data processing method according to an embodiment of the present invention;
[0044] Figure 4 A device structure diagram of a data processing device provided by an embodiment of the present invention;
[0045] Figure 5 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0046] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0047] In this application, relational terms such as first and second, etc. are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. The terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of more restrictions, the elements defined by the sentence "comprise one..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0048] The present invention can be used in many general or special computing device environments or configurations, such as personal computers, server computers, handheld or portable devices, tablet devices, multi-processor devices, distributed computing environments including any of the above devices or devices, etc.
[0049] An embodiment of the present invention provides a data processing method, which can be applied to a message middleware, wherein the message middleware includes a server cluster and a container cluster, wherein the server cluster includes at least one server, and wherein the container cluster includes at least one execution container. The method flow chart of the method is as follows: Figure 1 As shown, specifically including:
[0050] S101: When it is detected that a client uploads a target function to a first server in the server cluster, a deployment strategy corresponding to the container cluster in the message middleware is determined.
[0051] In the embodiment of the present invention, the container cluster in the message middleware has two different deployment strategies, specifically, a built-in mode and an independent mode.
[0052] It should be noted that the client is the producer of the target function. When the client completes writing the target function, it pushes the function-related information to the message middleware through the Sync-Data admin management tool. The relevant information of the pushed target function includes: jar, class name, uri, input topic, output topic and log topic, etc. Among them, jar is an executable code package, which is used to specify the running path of the jar package, class name is the class name of the running function, and the complete package name needs to be added, uri is the specified server cluster, input topic is the input data stream, out topic is the output data stream, and log topic is the log output data stream.
[0053] S102: Based on the deployment strategy, select a first execution container corresponding to the target function in the container cluster.
[0054] In the embodiment of the present invention, different deployment strategies correspond to different ways of selecting execution containers.
[0055] S103: Generate a data stream corresponding to the objective function, and store the data stream in a pre-set distributed storage system.
[0056] In an embodiment of the present invention, a data management tool is provided in the execution container of the message middleware, and the data management tool can be used to extract a meta-function in a target function, and generate a data stream corresponding to the target function based on the meta-function, and store the data stream in a distributed storage system.
[0057] S104: Generate an execution object corresponding to the data flow in the first execution container, and trigger all execution containers in the container cluster to subscribe to the data flow.
[0058] In the embodiment of the present invention, an operation management tool is also provided in the execution container, and the operation management tool is used to monitor whether a new data stream is generated and whether the data stream is in the server to which it belongs. If so, a corresponding execution object is created.
[0059] It should be noted that all execution containers in the container cluster subscribe to the data stream. When the consumer consumes data through any server or execution container, all execution containers can respond.
[0060] S105: When it is detected that the consumer end sends a consumption instruction corresponding to the data flow to the second server in the server cluster, based on the deployment strategy, start the second execution container corresponding to the consumption instruction, so that the second execution container triggers the execution object to output the data flow to the consumer end.
[0061] In an embodiment of the present invention, the consumer can consume data via any server. The second server can be the first server in S101 above, or other servers in the server cluster except the first server. The second execution container can be the first execution container above, or other container execution containers in the container cluster except the first execution container.
[0062] It is understandable that, during the upload and storage process of the data stream corresponding to the target function, all execution containers subscribe to the data stream, and when a consumer subsequently needs to consume the data stream, the consumption instruction corresponding to the data stream can be sent through any server. According to the deployment strategy, the second execution container corresponding to the consumption instruction is determined, and the second execution container determines the execution object that calls the data stream according to the consumption instruction, and the second execution container triggers the execution object to output the data stream to the consumer.
[0063] It should be noted that each execution container in the container cluster is a lightweight function running container, which is used to process functions and update related information, elect and run functions, etc. The execution object is an execution tool for the corresponding data stream of external data. When there is no consumer consuming the data stream, the execution object is not in the running state. When any execution container is called, the execution object is started in the execution container.
[0064] In the data processing method provided by the embodiment of the present invention, when it is detected that the client uploads the target function to the first server, the deployment strategy corresponding to the container cluster is determined. According to the deployment strategy, a first execution container for data processing is selected from the container cluster. At the same time, a data stream corresponding to the target function is generated, and the data is stored in a distributed storage system. The first execution container generates an execution object corresponding to the data stream, triggering all execution containers to subscribe to the data stream. When the consumer sends a consumption request corresponding to the data stream through any server, an execution container is selected as the second execution container according to the deployment strategy. After the second execution container is started, the second execution container triggers the execution object to output the data stream to the consumer.
[0065] By applying the method provided in the embodiment of the present invention, simple data processing is performed through the message middleware, and corresponding data is output according to different functions, without the need for the consumer end to consume all the data and then perform a series of operations such as filtering.
[0066] Optionally, based on the method provided in the embodiment of the present invention, after the data stream is stored in the distributed storage system, the following steps may be specifically included:
[0067] Generate storage information corresponding to the data stream, and send the storage information to the client.
[0068] Specifically, the storage information includes information such as the stream name, storage time, function upload time and corresponding execution object of the data stream.
[0069] refer to Figure 2 Based on the content of S101 above, determining the deployment strategy corresponding to the container cluster in the message middleware includes:
[0070] S201: Detecting the deployment location of each execution container in the container cluster in the message middleware.
[0071] In the embodiment of the present invention, for different deployment strategies, the deployment locations of various execution containers in the message middleware are different.
[0072] S202: When the deployment location of each execution container in the container cluster is a built-in deployment, determine that the deployment strategy corresponding to the container cluster in the message middleware is a built-in mode.
[0073] The built-in deployment indicates that each execution container in the container cluster is deployed in each server of the server cluster in a one-to-one correspondence.
[0074] Specifically, when it is determined that the deployment strategy is the built-in mode, S204 is continued to be executed.
[0075] refer to Figure 3a , Figure 3a This is a schematic diagram of the structure of the deployment strategy as built-in mode, which represents that each execution container in the container cluster is set in a one-to-one correspondence with each server in the server cluster. Among them, Data-Sync Broker refers to the server, and Function Container refers to the execution container.
[0076] S203: When the deployment locations of the execution containers in the container cluster are independent deployments, determining that the deployment strategy corresponding to the container cluster in the message middleware is an independent mode.
[0077] The independent mode indicates that each execution container in the container cluster is independently deployed outside the server cluster.
[0078] Specifically, when it is determined that the deployment strategy is the built-in mode, S205 is continued to be executed.
[0079] refer to Figure 3b , Figure 3b It is a structural diagram of a deployment strategy in independent mode, where each execution container in the container cluster is set outside each server.
[0080] S204: When the deployment strategy corresponding to the container cluster in the message middleware is a built-in mode, select an execution container built into the first server as a first execution container corresponding to the target function.
[0081] In the embodiment of the present invention, based on the content of S102 above, after the deployment strategy is determined, the first execution container corresponding to the target function is selected in the container cluster based on the deployment strategy. Therefore, when the deployment strategy is the built-in mode, it can be determined that the execution container in the first server is associated with the first server, so the execution container in the first server is the first execution container corresponding to the target function, and after the data flow is generated, the first execution container generates the execution object corresponding to the data flow.
[0082] S205: When the deployment strategy corresponding to the container cluster in the message middleware is an independent mode, select any one execution container in the container cluster as a first execution container corresponding to the target function.
[0083] In the embodiment of the present invention, based on the content of S102 above, after the deployment strategy is determined, the first execution container corresponding to the target function is selected in the container cluster based on the deployment strategy. Therefore, when the deployment strategy is the independent mode, it can be determined that there is no one-to-one correspondence between each server in the server cluster and each execution container in the container cluster, so any execution container in the container cluster is randomly selected as the first execution container, and after the data stream is generated, the first execution container generates the execution object corresponding to the data stream.
[0084] In the data processing method provided by the embodiment of the present invention, the deployment position of each execution container in the message middleware is detected. If they are deployed in each server in a one-to-one correspondence, the deployment strategy is a built-in mode. If the server cluster and the container cluster are deployed independently and there is no one-to-one correspondence between the two, the deployment strategy is an independent mode. In the built-in mode, the execution container set in the first server is selected as the first execution container; in the independent mode, any execution container is randomly selected as the first execution container.
[0085] By applying the method provided in the embodiment of the present invention, different execution containers are selected according to different deployment strategies to meet the requirements of lightweight data processing.
[0086] In the method provided by the embodiment of the present invention, based on the contents of S202 and S204 above, under different configuration strategies, the selected execution container may not be the same. When the consumer end needs to consume data later, the execution container may be selected according to the deployment strategy to trigger the corresponding execution object. Specifically, when the deployment strategy is the built-in mode, the second execution container corresponding to the consumption instruction is started, so that the second execution container triggers the execution object to output the data stream to the consumer end, including:
[0087] When the deployment strategy is a built-in mode, setting the execution container set in the second server as a second execution container;
[0088] Detecting whether the running state of the second execution container is normal;
[0089] If the running state of the second execution container is normal, the second execution container is started, and the consumption instruction is forwarded to the second execution container, so that the second execution container triggers the execution object to output the data stream corresponding to the consumption instruction to the consumer end.
[0090] It can be understood that when the deployment strategy is built-in mode, if the consumer sends a consumption request through any server, the execution container that calls the execution object is the execution container in the server. Among them, the second server is the server to which the consumer sends the consumption instruction, and the consumption instruction contains information such as the stream name of the data stream required by the consumer. The second server can be the above-mentioned first server. If the second server is the original first server, the second execution container is the original first execution container. If the second server is not the original first server, the second execution container is not the original first execution container. In order to avoid the consumer requesting no response during the consumption data request, it is necessary to detect the running status of the second execution container. If it is in a normal state, the second execution container is started, and the consumption instruction is forwarded to the second execution container. The second execution container parses the instruction to obtain the stream name. Since the execution containers are subscribed to all data streams in the message, the second execution container can determine the execution object corresponding to the data stream according to the stream name, and the second execution container triggers the second execution object to send the data stream to the consumer.
[0091] Optionally, when the running state of the second execution container is an abnormal state, an execution container whose running state is a normal state in a server closest to the second server is searched as the second execution container.
[0092] On the other hand, when the deployment strategy is the independent mode, starting the second execution container corresponding to the consumption instruction so that the second execution container triggers the execution object to output the data stream to the consumer end includes:
[0093] When the deployment strategy is an independent mode, any execution container in the container cluster whose running state is normal is selected as the second execution container;
[0094] The second execution container is started, and the consumption instruction is forwarded to the second execution container, so that the second execution container triggers the execution object to output the data stream corresponding to the consumption instruction to the consumer end.
[0095] It can be understood that, in independent mode, there is no association between each server and each execution container. Therefore, it is only necessary to select an execution container with a normal running state from all execution containers as the second execution container. Among them, when the second server is the above-mentioned first server, the second execution container may be the above-mentioned first execution container, or the second execution container may not be the above-mentioned first execution container. When the second server is not the above-mentioned second server, the second execution container may be the above-mentioned first execution container, or the second execution container may not be the above-mentioned first execution container. After determining the second execution container, start the second execution container, forward the consumption instruction to the second execution container, and the second execution container parses the instruction to obtain the stream name. Since the execution containers are subscribed to all data streams in the message, according to the stream name, the second execution container can determine the execution object corresponding to the data stream, and the second execution container triggers the second execution object to send the data stream to the consumer.
[0096] By applying the method provided in the embodiment of the present invention, simple data processing is performed through the message middleware, and corresponding data is output according to different functions, without the need for the consumer end to consume all the data and then perform a series of operations such as filtering.
[0097] The specific implementation processes and derivative methods of the above-mentioned embodiments are all within the protection scope of the present invention.
[0098] and Figure 1 Corresponding to the method described above, the embodiment of the present invention further provides a data processing device for Figure 1 The specific implementation of the method in the embodiment of the present invention, the data processing device provided by the embodiment of the present invention can be applied to the message middleware, and its structural diagram is as follows Figure 4 As shown, specifically including:
[0099] A determination unit 401 is configured to determine a deployment strategy corresponding to the container cluster in the message middleware when detecting that a client uploads a target function to a first server in the server cluster;
[0100] A selection unit 402 is configured to select, in the container cluster, a first execution container corresponding to the target function based on the deployment strategy;
[0101] A first generating unit 403 is used to generate a data stream corresponding to the objective function and store the data stream in a pre-set distributed storage system;
[0102] A second generating unit 404 is configured to generate an execution object corresponding to the data flow in the first execution container, and trigger all execution containers in the container cluster to subscribe to the data flow;
[0103] The sending unit 405 is used to start the second execution container corresponding to the consumption instruction based on the deployment strategy when it is detected that the consumer end sends the consumption instruction corresponding to the data flow to the second server in the server cluster, so that the second execution container triggers the execution object to output the data flow to the consumer end.
[0104] The data processing device provided by an embodiment of the present invention determines the deployment strategy corresponding to the container cluster when it is detected that the client uploads the target function to the first server. According to the deployment strategy, a first execution container for data processing is selected from the container cluster. At the same time, a data stream corresponding to the target function is generated, and the data is stored in a distributed storage system. The first execution container generates an execution object corresponding to the data stream, triggering all execution containers to subscribe to the data stream. When the consumer sends a consumption request corresponding to the data stream through any server, an execution container is selected as the second execution container according to the deployment strategy. After the second execution container is started, the second execution container triggers the execution object to output the data stream to the consumer.
[0105] By using the device provided by the embodiment of the present invention, simple data processing is performed through the message middleware, and corresponding data is output according to different functions, without the need for the consumer end to consume all the data and then perform a series of operations such as filtering.
[0106] In the device provided by the embodiment of the present invention, the determining unit 401 includes:
[0107] A first detection subunit, configured to detect a deployment position of each of the execution containers in the container cluster in the message middleware;
[0108] A first determining subunit is used to determine that the deployment strategy corresponding to the container cluster in the message middleware is a built-in mode when the deployment location of each execution container in the container cluster is a built-in deployment, and the built-in deployment indicates that each execution container in the container cluster is deployed one-to-one in each server of the server cluster;
[0109] The second determination subunit is used to determine that the deployment strategy corresponding to the container cluster in the message middleware is an independent mode when the deployment location of each execution container in the container cluster is an independent deployment, and the independent mode indicates that each execution container in the container cluster is independently deployed outside the server cluster.
[0110] In the device provided by the embodiment of the present invention, the selection unit 402 includes:
[0111] The first selection subunit is configured to select an execution container built into the first server as a first execution container corresponding to the target function when the deployment strategy corresponding to the container cluster in the message middleware is a built-in mode.
[0112] In the device provided by the embodiment of the present invention, the selection unit 402 includes:
[0113] The second selection subunit is used to select any one execution container in the container cluster as the first execution container corresponding to the target function when the deployment strategy corresponding to the container cluster in the message middleware is an independent mode.
[0114] In the device provided by the embodiment of the present invention, the sending unit 405 includes:
[0115] A setting subunit, configured to set the execution container set in the second server as a second execution container when the deployment strategy is a built-in mode;
[0116] A second detection subunit, configured to detect whether the running state of the second execution container is normal;
[0117] The first startup subunit is used to start the second execution container if the running state of the second execution container is normal, and forward the consumption instruction to the second execution container, so that the second execution container triggers the execution object to output the data stream corresponding to the consumption instruction to the consumer end.
[0118] In the device provided by the embodiment of the present invention, the sending unit 405 includes:
[0119] A third selection subunit is used to select any one execution container in the container cluster whose running state is normal as the second execution container when the deployment strategy is an independent mode;
[0120] The second initiator unit is configured to initiate the second execution container and forward the consumption instruction to the second execution container, so that the second execution container triggers the execution object to output a data stream corresponding to the consumption instruction to the consumer end.
[0121] The device provided in the embodiment of the present invention further includes:
[0122] The third generating unit is used to generate storage information corresponding to the data stream and send the storage information to the client.
[0123] For the specific working process of each unit and sub-unit in the data processing device disclosed in the above embodiment of the present invention, reference can be made to the corresponding content in the data processing method disclosed in the above embodiment of the present invention, and will not be repeated here.
[0124] An embodiment of the present invention further provides a storage medium, which includes stored instructions, wherein when the instructions are executed, the device where the storage medium is located is controlled to execute the above-mentioned data processing method.
[0125] The embodiment of the present invention further provides an electronic device, the structural diagram of which is shown in FIG. Figure 5 As shown, it specifically includes a memory 501 and one or more instructions 502, wherein the one or more instructions 502 are stored in the memory 501 and are configured to be executed by one or more processors 503 to perform the following operations:
[0126] When it is detected that the client uploads the target function to the first server in the server cluster, determining a deployment strategy corresponding to the container cluster in the message middleware;
[0127] Based on the deployment strategy, selecting a first execution container corresponding to the target function in the container cluster;
[0128] Generate a data stream corresponding to the objective function, and store the data stream in a pre-set distributed storage system;
[0129] Generate an execution object corresponding to the data flow in the first execution container, and trigger all execution containers in the container cluster to subscribe to the data flow;
[0130] When it is detected that the consumer end sends a consumption instruction corresponding to the data flow to the second server in the server cluster, based on the deployment strategy, the second execution container corresponding to the consumption instruction is started, so that the second execution container triggers the execution object to output the data flow to the consumer end.
[0131] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can refer to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system or system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can refer to the partial description of the method embodiment. The system and system embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without creative work.
[0132] Those skilled in the art may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein may be implemented by electronic hardware, computer software, or a combination of both.
[0133] In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present invention.
[0134] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A data processing method, characterized in that: The method is applied to a message middleware, the message middleware includes a server cluster and a container cluster, the server cluster includes at least one server, and the container cluster includes at least one execution container, and the method includes: When it is detected that the client uploads the target function to the first server in the server cluster, determining a deployment strategy corresponding to the container cluster in the message middleware; Based on the deployment strategy, selecting a first execution container corresponding to the target function in the container cluster; The message middleware processes the initial data stream, generates a data stream corresponding to the target function, and stores the data stream in a pre-set distributed storage system; Generate an execution object corresponding to the data stream in the first execution container, and trigger all execution containers in the container cluster to subscribe to the data stream; the execution object is used to output the corresponding data stream; When it is detected that the consumer end sends a consumption instruction corresponding to the data flow to the second server in the server cluster, based on the deployment strategy, the second execution container corresponding to the consumption instruction is started, so that the second execution container triggers the execution object to output the data flow to the consumer end.
2. The method according to claim 1, characterized in that The determining a deployment strategy corresponding to the container cluster in the message middleware includes: Detecting the deployment position of each of the execution containers in the container cluster in the message middleware; When the deployment location of each execution container in the container cluster is built-in deployment, determining that the deployment strategy corresponding to the container cluster in the message middleware is built-in mode, the built-in deployment indicates that each execution container in the container cluster is deployed one-to-one in each server of the server cluster; When the deployment location of each execution container in the container cluster is independently deployed, it is determined that the deployment strategy corresponding to the container cluster in the message middleware is an independent mode, and the independent mode indicates that each execution container in the container cluster is independently deployed outside the server cluster.
3. The method according to claim 2, characterized in that The selecting, in the container cluster, a first execution container corresponding to the target function based on the deployment strategy includes: When the deployment strategy corresponding to the container cluster in the message middleware is a built-in mode, the execution container built into the first server is selected as the first execution container corresponding to the target function.
4. The method according to claim 2, characterized in that: The selecting, in the container cluster, a first execution container corresponding to the target function based on the deployment strategy includes: When the deployment strategy corresponding to the container cluster in the message middleware is an independent mode, any one execution container in the container cluster is selected as the first execution container corresponding to the target function.
5. The method according to claim 2 or 3, characterized in that: The starting the second execution container corresponding to the consumption instruction so that the second execution container triggers the execution object to output the data stream to the consumer end includes: When the deployment strategy is a built-in mode, setting the execution container set in the second server as a second execution container; Detecting whether the running state of the second execution container is normal; If the running state of the second execution container is normal, the second execution container is started, and the consumption instruction is forwarded to the second execution container, so that the second execution container triggers the execution object to output the data stream corresponding to the consumption instruction to the consumer end.
6. The method according to claim 2 or 4, characterized in that: The starting the second execution container corresponding to the consumption instruction so that the second execution container triggers the execution object to output the data stream to the consumer end includes: When the deployment strategy is an independent mode, any execution container in the container cluster whose running state is normal is selected as the second execution container; The second execution container is started, and the consumption instruction is forwarded to the second execution container, so that the second execution container triggers the execution object to output the data stream corresponding to the consumption instruction to the consumer end.
7. The method according to claim 1, characterized in that After storing the data stream in a pre-set distributed storage system, the method further includes: Generate storage information corresponding to the data stream, and send the storage information to the client.
8. A data processing device, characterized in that: The device is applied to a message middleware, the message middleware includes a server cluster and a container cluster, the server cluster includes at least one server, the container cluster includes at least one execution container, and the device includes: A determination unit, configured to determine a deployment strategy corresponding to the container cluster in the message middleware when detecting that a client uploads a target function to a first server in the server cluster; A selection unit, configured to select, in the container cluster, a first execution container corresponding to the objective function based on the deployment strategy; A first generating unit, configured to process the initial data stream, generate a data stream corresponding to the objective function, and store the data stream in a pre-set distributed storage system; A second generating unit is used to generate an execution object corresponding to the data flow in the first execution container, and trigger all execution containers in the container cluster to subscribe to the data flow; the execution object is used to output the corresponding data flow; The sending unit is used to start the second execution container corresponding to the consumption instruction based on the deployment strategy when it is detected that the consumer end sends the consumption instruction corresponding to the data flow to the second server in the server cluster, so that the second execution container triggers the execution object to output the data flow to the consumer end.
9. A storage medium comprising stored instructions, wherein: When the instruction is executed, the device where the storage medium is located is controlled to execute the data processing method according to any one of claims 1 to 7.
10. An electronic device comprising a memory and one or more instructions, wherein the one or more instructions are stored in the memory and configured to be executed by one or more processors to perform the data processing method according to any one of claims 1 to 7.
