Message processing method and device, electronic equipment and computer storage medium

By defining a plugin with a standard interface specification in the browser system, the problem of low integration efficiency of different message queue services is solved, achieving efficient system development and message service scalability, and supporting seamless integration of multiple message queues.

CN122019205APending Publication Date: 2026-05-12BEIJING HONGTENG INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING HONGTENG INTELLIGENT TECH CO LTD
Filing Date
2024-11-12
Publication Date
2026-05-12

AI Technical Summary

Technical Problem

In the private deployment of browser systems, existing technologies suffer from low efficiency when developers integrate message queue services due to differences in the interfaces and functions of different message queue services.

Method used

By defining standard interface specifications to compile target plugins, detecting whether there are plugins to be loaded in the target service, and sending or receiving messages by calling the message service interface through the plugin after it is loaded, the standardization and seamless integration of plugins are achieved.

Benefits of technology

It improves system development efficiency and message service scalability, supports seamless integration and flexible adaptation of different message queues, and reduces the coupling of the system's core logic.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122019205A_ABST
    Figure CN122019205A_ABST
Patent Text Reader

Abstract

The invention provides a message processing method and device, electronic equipment and a computer storage medium, and the method comprises the steps: judging whether a to-be-loaded target plug-in corresponding to a target service exists or not when the starting of the target service is detected, and the target plug-in is compiled based on a preset standard interface specification; if yes, loading the target plug-in; under the condition that loading of the target plug-in is completed, if it is detected that a message processing instruction is triggered, a corresponding message service interface is called through the target plug-in to send or receive a message, and the message processing instruction comprises a message sending instruction or a message receiving instruction. According to the embodiment provided by the scheme, the system development efficiency and the expandability of the message service can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of message processing technology, and in particular to a message processing method, apparatus, electronic device, and computer storage medium. Background Technology

[0002] In related technologies, when deploying a browser system privately, it is usually necessary to integrate the browser system with the client's existing message queue service. However, due to the existence of various message queue service types, each service's application programming interface and functionality may differ, resulting in low development efficiency for developers when determining the appropriate system for the client's existing message queue service. Summary of the Invention

[0003] This application provides a message processing method, apparatus, electronic device, and computer storage medium, which can improve system development efficiency and enhance the scalability of message services. The above technical solutions are as follows:

[0004] In a first aspect, embodiments of this application provide a message processing method, the method comprising:

[0005] When the target service is detected to be running, it is determined whether there is a target plugin to be loaded corresponding to the target service. The target plugin is compiled based on a preset standard interface specification.

[0006] If so, then load the target plugin mentioned above;

[0007] Once the target plugin is loaded, if a message processing instruction is detected to be triggered, the corresponding message service interface will be called through the target plugin to send or receive messages. The message processing instruction includes a message sending instruction or a message receiving instruction.

[0008] In one possible implementation, the determination of whether a target plugin corresponding to the target service exists includes:

[0009] Obtain the configuration file corresponding to the target service;

[0010] The plugin directory included in the above configuration file is scanned to determine whether the target plugin corresponding to the target service exists.

[0011] In one possible implementation, the above method also includes:

[0012] Check if there are any target plugins that need to be updated for the aforementioned target services;

[0013] If so, then obtain the updated target plugin corresponding to the target plugin to be updated mentioned above;

[0014] Replace the target plugin to be updated mentioned above with the updated target plugin mentioned above.

[0015] In one possible implementation, the above-mentioned message service interface is called through the target plugin to send or receive messages, including:

[0016] If the above message processing instruction is the above message sending instruction, then service data is received from the data sender based on the above message sending instruction;

[0017] Generate a message to be sent based on the above business data;

[0018] The target plugin calls the message service interface to send the message to be sent to the preset message queue.

[0019] In one possible implementation, the generation of the message to be sent based on the aforementioned business data includes:

[0020] The above business data is parsed to obtain the parsed target data corresponding to the above business data.

[0021] The target data is encapsulated into a message to be sent according to the preset message structure information. The message to be sent includes a message body and metadata.

[0022] In one possible implementation, the above-mentioned message service interface is called through the target plugin to send or receive messages, including:

[0023] If the above message processing instruction is the above message receiving instruction, then the above message service interface is called through the above target plugin to generate a message channel;

[0024] Based on the above message receiving instructions, the message to be received is determined from the preset message queue;

[0025] The message to be received is transmitted to the data receiver corresponding to the message through the aforementioned message channel.

[0026] In one possible implementation, the above method also includes:

[0027] If a message receiving stop instruction is detected for the above message channel, it is determined whether the message to be received in the above message channel has been transmitted completely.

[0028] Once the transmission of the message to be received in the aforementioned message channel is complete, the aforementioned message service interface is invoked through the aforementioned target plugin to disconnect the aforementioned message channel.

[0029] Secondly, embodiments of this application provide a message processing apparatus, the apparatus comprising:

[0030] The first judgment module is used to determine whether there is a target plugin to be loaded corresponding to the target service when the target service is detected to be running. The target plugin is compiled based on a preset standard interface specification.

[0031] The loading module is used to load the target plugin when there is a target plugin to be loaded corresponding to the target service mentioned above.

[0032] The processing module is used to call the corresponding message service interface through the target plugin to send or receive messages if a message processing instruction is detected after the target plugin has been loaded. The message processing instruction includes a message sending instruction or a message receiving instruction.

[0033] In one possible implementation, the first judgment module mentioned above includes:

[0034] The acquisition unit is used to retrieve the configuration file corresponding to the target service.

[0035] The first determining unit is used to scan the plugin directory included in the above configuration file to determine whether there is a target plugin to be loaded corresponding to the above target service.

[0036] In one possible implementation, the above-mentioned device further includes:

[0037] The detection module is used to detect whether there are any target plugins that need to be updated for the aforementioned target services.

[0038] The second acquisition unit is used to acquire the updated target plugin corresponding to the target plugin to be updated when there is a target plugin to be updated corresponding to the target service.

[0039] The replacement unit is used to replace the target plugin to be updated with the updated target plugin.

[0040] In one possible implementation, the above processing module includes:

[0041] The sending unit is configured to receive service data from the data sender based on the message sending instruction when the message processing instruction is the message sending instruction.

[0042] The generation unit is used to generate a message to be sent based on the aforementioned business data.

[0043] The first calling unit is used to call the message service interface through the target plugin to send the message to be sent to the preset message queue.

[0044] In one possible implementation, the above-mentioned generating unit includes:

[0045] The parsing subunit is used to parse the above business data to obtain the parsed target data corresponding to the above business data;

[0046] The encapsulation subunit is used to encapsulate the target data into a message to be sent according to the preset message structure information. The message to be sent includes a message body and metadata.

[0047] In one possible implementation, the above processing module includes:

[0048] The second calling unit is used to call the message service interface through the target plugin to generate a message channel when the message processing instruction is the message receiving instruction.

[0049] The second determining unit is used to determine the message to be received from the preset message queue based on the above message receiving instruction.

[0050] The transmission unit is used to transmit the message to be received to the data receiver corresponding to the message to be received through the message channel.

[0051] In one possible implementation, the above-mentioned device further includes:

[0052] The second judgment module is used to determine whether the message to be received in the message channel has been transmitted completely if a message stop receiving instruction for the message channel is detected.

[0053] The disconnect module is used to disconnect the message channel by calling the message service interface through the target plugin after the transmission of the message to be received in the message channel has been completed.

[0054] Thirdly, embodiments of this application provide an electronic device, including: a processor and a memory;

[0055] The aforementioned memory stores a computer program adapted to be loaded by the aforementioned processor and execute the steps of the method provided by the first aspect of the embodiments of this application or any possible implementation thereof.

[0056] Fourthly, embodiments of this application provide a computer storage medium storing a plurality of instructions adapted for loading by a processor and executing the steps of the method provided by the first aspect of the embodiments of this application or any possible implementation thereof.

[0057] This application embodiment determines whether a target plugin corresponding to the target service exists when the target service is detected to be running. The target plugin is compiled based on a preset standard interface specification. If so, the target plugin is loaded. Once the target plugin is loaded, if a message processing instruction is triggered, the corresponding message service interface is called through the target plugin to send or receive messages. The message processing instruction includes a message sending instruction or a message receiving instruction. The plugin implements standardized message service interfaces (e.g., message sending and receiving interfaces), allowing direct invocation of the message service without needing to understand the underlying message queue implementation. This decoupling of business logic and technical implementation enables seamless integration of different message queues. Only different plugins need to be developed to implement the corresponding interfaces, without modifying the core business logic of the system. This facilitates easy replacement and expansion of message queue services, allowing the system to easily adapt to different business scenarios, improving system development efficiency and the scalability of the message service. Attached Figure Description

[0058] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0059] Figure 1 A schematic diagram of the structure of a message processing system provided in an exemplary embodiment of this application;

[0060] Figure 2 A flowchart illustrating a message processing method provided for an exemplary embodiment of this application;

[0061] Figure 3 A detailed flowchart of a message processing method provided for an exemplary embodiment of this application;

[0062] Figure 4 A flowchart illustrating a plug-in switching method provided for an exemplary embodiment of this application;

[0063] Figure 5 A schematic diagram of the structure of a message processing apparatus provided for an exemplary embodiment of this application;

[0064] Figure 6 This is a schematic diagram of the structure of an electronic device provided as an exemplary embodiment of this application. Detailed Implementation

[0065] The technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings.

[0066] The terms "first," "second," "third," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or apparatuses.

[0067] Please refer to the following. Figure 1 The example illustrates a schematic diagram of the structure of a message processing system provided in an embodiment of this application. Figure 1 As shown, the system includes a target device 110 and a server device 120.

[0068] The target device 110 and the server device 120 can be connected directly or indirectly through wired or wireless communication, and this application does not impose any restrictions on this.

[0069] In some embodiments, the target device 110 may be a smartphone, tablet, laptop, desktop computer, smart speaker, smart home appliance, etc., but is not limited to these. The server device 120 is the backend server for the aforementioned application. The target device 110 may send requests to the server device 120, and the server device 120 may process the requests and return responses.

[0070] Those skilled in the art will understand that the number of the aforementioned target devices 110 can be more or less. For example, there may be only one target device 110, or there may be dozens or hundreds of target devices 110, or even more. This application does not limit the number or type of target devices 110.

[0071] In some embodiments, server device 120 may be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), big data, and artificial intelligence platforms. Server device 120 is used to provide backend services for applications.

[0072] In some embodiments, the target device 110 is used to perform the following steps: when the target service is detected to be enabled, it determines whether there is a target plugin to be loaded corresponding to the target service, wherein the target plugin is compiled based on a preset standard interface specification; if so, the target plugin is loaded; when the target plugin is loaded, if a message processing instruction is detected to be triggered, the corresponding message service interface is called through the target plugin to send or receive messages, wherein the message processing instruction includes a message sending instruction or a message receiving instruction.

[0073] Optionally, the target service mentioned above can be a business system or application installed on the target device 110.

[0074] Optionally, the message queue described above is middleware that can be used to pass messages between systems or different components.

[0075] Optionally, message processing instructions can be sent from server device 120 to target device 110.

[0076] An exemplary embodiment of this application provides a message processing method. This message processing method can be applied to the target device described above. Please refer to [reference needed] for details. Figure 2 The example illustrates a flowchart of a message processing method provided in an embodiment of this application. Figure 2 As shown, the message processing method includes the following S21-S23:

[0077] S21. When the target service is detected to be running, determine whether there is a target plugin to be loaded corresponding to the target service. The target plugin is compiled based on a preset standard interface specification.

[0078] In some embodiments, the target service can be a business system or application, specifically accessible through a browser. The target service requires the use of a message queue service for message passing. When the target service is detected as running, it is first determined whether there are any target plugins corresponding to that service that need to be loaded. These target plugins can correspond to different message queue implementations.

[0079] In some embodiments, the message queue described above is middleware that can be used to pass messages between systems or different components. The target plugin can be an adapter for the message queue service. When using different message queues, it is not necessary to modify the system code; only the plugin adapted to the message queue needs to be dynamically loaded, thereby improving the system's flexibility and scalability.

[0080] In some embodiments, the message queue service can be any of the following message queue types: Kafka (a high-throughput distributed publish-subscribe messaging system), Rocke Message Queue (RocketMQ), Pulsar (an open-source distributed messaging system based on a publish-subscribe model), Active Message Queue (an open-source message middleware, ActiveMQ), Rabbit Message Queue (an open-source message broker software, RabbitMQ), Redis (a remote dictionary service), and N Squared Queues (a real-time distributed messaging platform, NSQ).

[0081] S22. If there is a target plugin to be loaded corresponding to the above target service, then load the above target plugin.

[0082] Loading the target plugin enables the target service to have the necessary functional extensions at runtime, especially message processing capabilities. By loading the target plugin, the target service can dynamically gain integration capabilities with a specific message queue system, thus providing a foundation for subsequent processing.

[0083] S23. If a message processing instruction is detected to be triggered after the target plugin is loaded, the corresponding message service interface is called through the target plugin to send or receive messages. The message processing instruction includes a message sending instruction or a message receiving instruction.

[0084] Message processing instructions are those used to trigger message sending or receiving operations. They notify the system when message transmission is needed, enabling the target plugin to support message sending and receiving. Specifically, message sending instructions trigger message sending operations, causing the system to send messages to a specified target via the target plugin; message receiving instructions trigger message receiving operations, causing the system to receive messages from a specified source via the target plugin.

[0085] This application embodiment determines whether a target plugin corresponding to the target service exists when the target service is detected to be running. The target plugin is compiled based on a preset standard interface specification. If so, the target plugin is loaded. Once the target plugin is loaded, if a message processing instruction is triggered, the corresponding message service interface is called through the target plugin to send or receive messages. The message processing instruction includes a message sending instruction or a message receiving instruction. The plugin implements standardized message service interfaces (e.g., message sending and receiving interfaces), allowing direct invocation of the message service without needing to understand the underlying message queue implementation. This decoupling of business logic and technical implementation enables seamless integration of different message queues. Only different plugins need to be developed to implement the corresponding interfaces, without modifying the core business logic of the system. This facilitates easy replacement and expansion of message queue services, allowing the system to easily adapt to different business scenarios, improving system development efficiency and the scalability of the message service.

[0086] In some embodiments, the compilation method of the target plugin described above may include S01-S02:

[0087] S01. Define the message structure and message service interface.

[0088] Specifically, S01, defining the message service interface can be implemented using the following Go language code:

[0089] / / Message structure

[0090] type Message struct{

[0091] Body[]byte

[0092] ID int

[0093] }

[0094] / / MQ message service interface

[0095] type MQ interface{

[0096] Init(confData[]byte)error / / Initialize message service configuration

[0097] SendMessage(topic string, msg*Message) error / / Send message

[0098] GetMessage(topic string) <- chan*Message / / Get the message

[0099] Close()error / / Shut down the service

[0100] }

[0101] The code above defines the Message structure and the MQ message service interface. In the Message structure, Body[]byte represents the message content, stored as a byte array; ID int represents the unique identifier for each message. In the MQ message service interface, Init(confData[]byte)error is used to initialize the message service and accept configuration data; SendMessage(topic string, msg*Message)error indicates sending a message to the specified topic; GetMessage(topic string)<-chan*Message indicates retrieving a message from the specified topic and returns a chan channel, indicating that messages can be received asynchronously; lose()error indicates closing the message service.

[0102] The above process embodies the abstraction of different message queue services, so that the system only needs to call according to the defined interface, without having to care about the specific message queue service type used, thus achieving flexible adaptation and management.

[0103] S02. Compile the plugin program according to the message service interface to obtain the dynamic plugin file.

[0104] Specifically, S02, compiling the plugin program according to the message service interface to obtain the dynamic plugin file can be implemented using the following Go language code:

[0105] package main

[0106] import(

[0107] "encoding / json"

[0108] "mq / model" )

[0110] / / Define configuration information

[0111] type Config struct{

[0112] Addr stringˋjson:"addr"ˋ / / The service address of the nsqd message service

[0113] AuthSecret stringˋjson:"auth_secret"ˋ / / Communication verification key

[0114] }

[0115] / / Plugin implementation details

[0116] type Nsq struct{

[0117] conf*Config

[0118] msg chan*model.Message

[0119] }

[0120] func(n*Nsq)Init(confData[]byte)error{

[0121] n.conf = &Config{}

[0122] n.msg=make(chan*model.Message,1000)

[0123] err:=json.Unmarshal(confData,n.conf)

[0124] if err! = nil{

[0125] return err

[0126] }

[0127] return nil

[0128] }

[0129] func(n*Nsq)SendMessage(topic string,m*model.Message)error{

[0130] / / Message sending logic implementation

[0131] return nil

[0132] }

[0133] func(n*Nsq)GetMessage(topic string)<-chan*model.Message{

[0134] return n.msg

[0135] }

[0136] func(n*Nsq)Close()error{

[0137] close(n.msg)

[0138] return nil

[0139] }

[0140] / / Example of plugin export message service

[0141] var MyMQ Nsq

[0142] The code above illustrates how to implement a target plugin (NSQ plugin). This plugin conforms to the message queue service interface specification, enabling adaptation to different message queue services. Specifically, by defining unified interfaces (such as Init, SendMessage, GetMessage, and Close), the system can seamlessly call these methods of the plugin regardless of the underlying message queue service used, achieving good decoupling and extensibility.

[0143] Here, `package main` indicates that this is an executable program; `encoding / json` is used to convert JSON-formatted configuration information into Go language structs, and to deserialize and serialize JSON data. `mq / model` is used to import message models (`model.Message`).

[0144] The Config structure defines the basic configuration information of the message queue service; Addr represents the address of the nsqd message service (i.e., the server address where the message queue service is located); AuthSecret represents the authentication key used for communication and security authentication; the tags json:"addr" and json:"auth_secret" indicate that these fields will be matched with the corresponding JSON keys during JSON serialization / deserialization.

[0145] Nsq is the specific structure of the plugin that implements the message queue service; conf*Config is a pointer to the Config structure, used to store the plugin's configuration information; msg chan*model.Message is a message channel (chan), which is used in Go for asynchronous data transfer and can be used to buffer and transmit messages.

[0146] The `init` function initializes the message service; `confData[]byte` represents the passed configuration data as a byte array (usually in JSON format); `json.Unmarshal` deserializes the passed JSON data into a `Config` structure and assigns it to `n.conf`; `n.msg = make(chan*model.Message, 1000)` creates a message channel with a buffer of 1000 messages. If configuration parsing fails, the `init` function returns an error; otherwise, it returns `nil`, indicating successful initialization.

[0147] The SendMessage function is used to send a message to a specified topic; topic string is the name of the specified message topic; m*model.Message represents the message to be sent. Currently, this function is a placeholder and the specific sending logic has not yet been implemented.

[0148] The GetMessage function returns a message channel through which messages on a specified topic can be retrieved asynchronously; topicstring is the topic on which the message is to be retrieved; <- chan*model.Message indicates that a read-only message channel is returned, and other parts of the code can read messages from this channel.

[0149] Additionally, the `Close` function is used to close the message service, shut down the message channel `n.msg`, and returns `nil` to indicate successful operation. `MyMQ` is a global instance of the `Nsq` structure; it is a message service instance exported by the plugin. When the plugin is loaded, the system can directly call `MyMQ` to use the defined message service interface.

[0150] In this embodiment, a unified standard interface specification is defined, which all message queue services must adhere to. The standard interface abstracts the functionality of different message queues, unifying it into similar methods (such as SendMessage, GetMessage, etc.). Regardless of the underlying message queue used, the system only needs to interact with the interface, without needing to concern itself with the specific implementation details. This interface-driven design decouples the system from the message queue service implementation, allowing the implementation to be replaced or extended without affecting other parts of the system. The plug-in mechanism enables the system to support hot-swapping, allowing the addition or replacement of message queue implementations without restarting or recompiling the entire system. The plugin loading process is independent of the core system logic, further reducing coupling.

[0151] In practical applications, the system unifies the message service interface, allowing the system to call its own implementation methods without needing to know which message queue service is being used. This effectively improves system development efficiency and the scalability of the message service.

[0152] In some embodiments, in S21 above, determining whether there is a target plugin to be loaded corresponding to the target service includes S211-S212:

[0153] S211. Obtain the configuration file corresponding to the target service.

[0154] In some embodiments, the configuration file corresponding to the target service is used to provide the target service with key information and parameters required during operation. Specifically, the configuration file corresponding to the target service may include key information such as the plugin directory and plugin names required by the target service.

[0155] In some embodiments, the configuration file corresponding to the target service can be obtained from a preset storage location, or the configuration file related to the target service can be obtained through a service registry.

[0156] S212. Scan the plugin directory included in the above configuration file to determine whether there is a target plugin to be loaded corresponding to the target service mentioned above.

[0157] In some embodiments, the path information of the plugin directory included in the configuration file can be read automatically, and then the plugin directory in the path information can be scanned to query whether there is a plugin that matches the target service. If a matching plugin is found, the plugin can be identified as the target plugin to be loaded corresponding to the target service, that is, there exists a target plugin to be loaded corresponding to the target service. If no matching plugin is found, it is determined that there is no target plugin to be loaded corresponding to the target service.

[0158] In this embodiment, plugins can be automatically scanned and identified by reading the plugin directory path in the configuration file, without manual intervention, thus improving efficiency. In addition, loading is only performed when the existence of the target plugin to be loaded is determined, avoiding unnecessary resource consumption and improving system performance.

[0159] The above message processing method will be described below with reference to specific embodiments. Figure 3 A detailed flowchart of a message processing method provided for an exemplary embodiment of this application is shown below. Figure 3 The message processing method includes:

[0160] S31. Target service detected to be running.

[0161] S32. Obtain the configuration file corresponding to the target service.

[0162] S33. Scan the plugin directories included in the configuration file.

[0163] The above S31-S33 are the same as those above S211-S212, and will not be repeated here.

[0164] S34. Determine if there is a target plugin to be loaded corresponding to the target service. If yes, execute S35. If no, continue to determine if there is a target plugin to be loaded corresponding to the target service in the preset first cycle.

[0165] S35, Load the target plugin.

[0166] S34-S35 are the same as S22 above, and will not be repeated here.

[0167] S36. Determine whether a message processing command has been triggered. If yes, execute S37. If no, continue to determine whether a message processing command has been triggered in the preset second cycle.

[0168] S37. Call the corresponding message service interface through the target plugin to send or receive messages.

[0169] S36-S37 are the same as S23 above, and will not be repeated here.

[0170] In this embodiment, by determining whether there are plugins to be loaded, unnecessary resource consumption is avoided. Plugins are only loaded when needed, reducing the consumption of memory and computing resources. When the target service is detected to be starting, the relevant plugins can be loaded quickly and the service can be started, reducing the system startup time and improving the response speed.

[0171] In some embodiments, in S23 above, the target plugin calls the message service interface to send or receive messages, including S231-S233:

[0172] S231. If the above message processing instruction is the above message sending instruction, then service data is received from the data sender based on the above message sending instruction.

[0173] In some embodiments, the data sender is an entity that provides business data. For example, the data sender may be an application module, service, user interface, or external system that generates or holds the business data that needs to be sent.

[0174] In some embodiments, business data refers to data content related to specific business operations. The specific content of business data depends on the specific business scenario. For example, in an e-commerce scenario, business data may include order information, user information, transaction records, etc.

[0175] Specifically, when a message needs to be sent, the data sender provides business data to the system. This might be triggered by a business event, such as a user placing an order or a status update. For example, in an e-commerce platform, when a user places an order, the order information needs to be sent to the inventory system for inventory updates. In this case, the data sender could be the order processing module, and the business data could include order information such as order number, product identifier, and quantity.

[0176] S232. Generate a message to be sent based on the above business data.

[0177] The business data is the core content of the message to be sent. In step S232, the system parses and encapsulates the business data to generate a message to be sent that conforms to a preset message structure, so that it can be sent to the message queue through the message service interface.

[0178] In some embodiments, in S232, a message to be sent is generated based on the aforementioned business data, including S2321-S2322:

[0179] S2321. Parse the above business data to obtain the parsed target data corresponding to the above business data.

[0180] In some embodiments, parsing the aforementioned business data can extract key information from the business data, thereby obtaining the parsed target data to ensure that the data conforms to the expected format. Extracting key information from the business data may include extracting necessary fields, such as user identifiers, order numbers, and product details.

[0181] S2322. The target data is encapsulated into a message to be sent according to the preset message structure information. The message to be sent includes a message body and metadata.

[0182] In some embodiments, the parsed target data can be encapsulated into a message to be sent based on preset message structure information to generate a standardized message that meets the requirements of the message service interface, facilitating subsequent transmission and processing.

[0183] The message body can contain the actual business data content, i.e., the parsed target data. Metadata consists of additional information, such as message identifier, timestamp, message type, priority, etc., used for message routing, tracking, and management.

[0184] In this embodiment, parsing and encapsulation convert business data into a unified message format, facilitating interaction between different systems. Furthermore, the preset message structure information can be configured according to business needs, supporting different message types and various business scenarios. The modular parsing and encapsulation steps allow the system to easily adapt to new business requirements or data formats.

[0185] S233. Call the message service interface through the target plugin to send the message to be sent to the preset message queue.

[0186] In some embodiments, the message service interface is an application programming interface provided by a message queue service (e.g., Kafka, RabbitMQ, ActiveMQ, etc.) for sending, receiving, and managing messages. By calling these interfaces, one can communicate with the message service and perform operations such as sending and receiving messages.

[0187] The default message queue is a predefined queue (or topic) in the message queue service used to store sent messages. Other systems or components can consume messages from this queue. The process of sending messages to the message queue is asynchronous, meaning that the message sender and receiver do not need to be online simultaneously, improving the system's decoupling and scalability.

[0188] For example, suppose an order system needs to send new order information to an inventory system to update inventory. The process is as follows: After a user places an order, the order system, as the data sender, generates order information (business data); the system detects a new order that needs processing and triggers a message sending command; it then parses the order information, extracting target data such as order number, product identifier, and quantity, and encapsulates the target data into a message to be sent according to a preset message structure, including the message body (order information) and metadata (such as timestamp and message type). The target plugin then calls the message service interface to send the message to a preset message queue. The inventory system, as the message receiver, can consume the message from the message queue and update its inventory.

[0189] In this embodiment, the coupling between the system and the message service is reduced through plug-ins and standard interfaces, enhancing the maintainability and scalability of the system; sending messages to the message queue realizes asynchronous processing and system decoupling, which helps to build a high-performance, highly available distributed system.

[0190] In some embodiments, in S23 above, the target plugin calls the message service interface to send or receive messages, including S234-S236:

[0191] S234. If the above message processing instruction is the above message receiving instruction, then the above message service interface is called through the above target plugin to generate a message channel.

[0192] In some embodiments, a message channel serves as a communication bridge between the system and a message service, used to receive messages. Specifically, the message channel can detect a preset message queue, and when a new message arrives, it triggers the corresponding processing logic.

[0193] Specifically, in S234, the target plugin calls the interface methods provided by the message service (such as createConsumer, subscribe, etc.) to generate a message channel.

[0194] In this embodiment, through the use of a plug-in mechanism and message channels, the system can adapt to different message services and business scenarios, effectively receive and process messages from the target service, and meet business needs. S235: Determine the message to be received from the preset message queue based on the above message receiving instruction.

[0195] In some embodiments, the content of the message receiving instruction can be used to identify which messages need to be retrieved from a preset message queue as messages to be received. Specifically, messages that meet the requirements can be selected from the message queue according to preset conditions or filtering rules (such as message type, priority, tags, etc.).

[0196] S236. Transmit the message to be received to the data receiver corresponding to the message to be received through the above message channel.

[0197] The data receiver is a module, service, or component within the system responsible for processing the received messages.

[0198] This message channel allows messages retrieved from the message queue to be transmitted to the data receiver. Upon receiving the message, the data receiver can perform relevant parsing and business processing, such as updating the database or triggering business processes.

[0199] In some embodiments, after the data receiver has completed processing, it can send an acknowledgment to the message service to mark that the message has been successfully consumed, thus avoiding duplicate processing.

[0200] In this embodiment, the data sender and data receiver communicate through a message queue, are independent of each other and do not depend on each other directly, which helps in the modular design and maintenance of the system; and the sending and receiving of messages can be carried out asynchronously, so the data sender does not need to wait for the receiver to complete processing, thus improving the response speed.

[0201] In some embodiments, the above method further includes S24-S25:

[0202] S24. If a message receiving stop instruction is detected for the above message channel, determine whether the message to be received in the above message channel has been transmitted completely.

[0203] In some embodiments, a message stop receiving instruction is used to instruct the cessation of receiving new messages through the message channel.

[0204] In some embodiments, the completion of message transmission in the aforementioned message channel means that the message has been retrieved from the message queue, successfully delivered to the data receiver, and processed.

[0205] S25. When the transmission of the message to be received in the above message channel is completed, the above message service interface is called through the above target plugin to disconnect the above message channel.

[0206] In some embodiments, if the transmission of messages to be received in the aforementioned message channel is not yet complete, no processing may be performed temporarily. Once it is determined that all messages to be received in the message channel have been successfully transmitted and processed, the message service interface is called through the target plugin to formally disconnect the message channel. This means stopping all message receiving activities in the channel and releasing related resources, such as threads and network connections, to prevent resource leaks.

[0207] In this embodiment, before closing the message channel, it is ensured that all pending messages have been processed to avoid messages being left in the queue or processing being interrupted; and the integrity of the business process is ensured so that data inconsistency or business anomalies will not occur due to interruption of message processing. In addition, the connection and disconnection of the message channel are managed through plugins and standard interfaces, reducing system complexity and facilitating maintenance and expansion.

[0208] Figure 4 A flowchart illustrating a plug-in switching method provided as an exemplary embodiment of this application is shown below. Figure 4 As shown, the above message processing method also includes S41-S43:

[0209] S41. Check if there is a target plugin to be updated corresponding to the above target service.

[0210] In some embodiments, the target plugin to be updated may include plugins marked as needing an update, plugins with outdated versions, or plugins for which an update is already available.

[0211] In some embodiments, the existence of a target plugin to be updated corresponding to the aforementioned target service can be detected by comparing the version number of the target plugin, checking update notifications, or analyzing timestamps, or by any one or more of these methods.

[0212] S42. If there is a target plugin to be updated corresponding to the above target service, then obtain the updated target plugin corresponding to the above target plugin to be updated.

[0213] In some embodiments, in S42, the updated target plugin corresponding to the target plugin to be updated can be obtained in any of the following ways: downloading the updated plugin from a preset central repository, pulling it from a remote server, or retrieving the stored updated target plugin from local storage. The updated target plugin is compatible with the target service and conforms to a preset interface specification.

[0214] S43. Replace the target plugin to be updated with the updated target plugin.

[0215] In some embodiments, in S43, replacing the target plugin to be updated with the updated target plugin includes: uninstalling or disabling the target plugin to be updated, and loading or enabling the updated target plugin without interrupting the target service.

[0216] In this embodiment, the target plugin is automatically detected and updated, reducing manual workload; and the target plugin can be updated independently without affecting other system components, enabling the system to maintain better performance, security and reliability.

[0217] Please refer to the following. Figure 5 This is a schematic diagram of the structure of a message processing device provided in an exemplary embodiment of this application. Figure 5 As shown, the message processing device 500 includes:

[0218] The first judgment module 501 is used to determine whether there is a target plugin to be loaded corresponding to the target service when the target service is detected to be running. The target plugin is compiled based on a preset standard interface specification.

[0219] Loading module 502 is used to load the target plugin when there is a target plugin to be loaded corresponding to the target service.

[0220] The processing module 503 is used to call the corresponding message service interface through the target plugin to send or receive messages if a message processing instruction is detected when the target plugin has been loaded. The message processing instruction includes a message sending instruction or a message receiving instruction.

[0221] In one possible implementation, the first judgment module 501 mentioned above includes:

[0222] The acquisition unit is used to retrieve the configuration file corresponding to the target service.

[0223] The first determining unit is used to scan the plugin directory included in the above configuration file to determine whether there is a target plugin to be loaded corresponding to the above target service.

[0224] In one possible implementation, the device 500 further includes:

[0225] The detection module is used to detect whether there are any target plugins that need to be updated for the aforementioned target services.

[0226] The acquisition module is used to acquire the updated target plugin corresponding to the target plugin to be updated when there is a target plugin to be updated corresponding to the target service mentioned above.

[0227] The replacement module is used to replace the target plugin to be updated with the updated target plugin.

[0228] In one possible implementation, the processing module 503 includes:

[0229] The sending unit is configured to receive service data from the data sender based on the message sending instruction when the message processing instruction is the message sending instruction.

[0230] The generation unit is used to generate a message to be sent based on the aforementioned business data.

[0231] The first calling unit is used to call the message service interface through the target plugin to send the message to be sent to the preset message queue.

[0232] In one possible implementation, the above-mentioned generating unit includes:

[0233] The parsing subunit is used to parse the above business data to obtain the parsed target data corresponding to the above business data;

[0234] The encapsulation subunit is used to encapsulate the target data into a message to be sent according to the preset message structure information. The message to be sent includes a message body and metadata.

[0235] In one possible implementation, the processing module 503 includes:

[0236] The second calling unit is used to call the message service interface through the target plugin to generate a message channel when the message processing instruction is the message receiving instruction.

[0237] The second determining unit is used to determine the message to be received from the preset message queue based on the above message receiving instruction.

[0238] The transmission unit is used to transmit the message to be received to the data receiver corresponding to the message to be received through the message channel.

[0239] In one possible implementation, the device 500 further includes:

[0240] The second judgment module is used to determine whether the message to be received in the message channel has been transmitted completely if a message stop receiving instruction for the message channel is detected.

[0241] The disconnect module is used to disconnect the message channel by calling the message service interface through the target plugin after the transmission of the message to be received in the message channel has been completed.

[0242] The division of modules in the message processing device 500 described above is for illustrative purposes only. In other embodiments, the message processing device can be divided into different modules as needed to complete all or part of the functions of the message processing device described above. The implementation of each module in the message processing device provided in the embodiments of this specification can be in the form of a computer program. This computer program can run on a terminal or server. The program modules constituted by this computer program can be stored in the memory of the terminal or server. When the computer program is executed by a processor, it implements all or part of the steps of the message processing method described in the embodiments of this specification.

[0243] Please refer to the following. Figure 6 This is a schematic diagram of the structure of an electronic device provided in an exemplary embodiment of this application. Figure 6 As shown, the electronic device 600 may include a processor 610 and a memory 620, and may also include a user interface 630, a network interface 640 and a communication bus 650.

[0244] The processor 610 may include one or more processing cores. The processor 610 connects to various parts within the electronic device 600 using various interfaces and lines, and performs various functions and processes data by running or executing instructions, programs, code sets, or instruction sets stored in the memory 620, and by calling data stored in the memory 620. Optionally, the processor 610 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The processor 610 may integrate one or a combination of several of the following: Central Processing Unit (CPU), Graphics Processing Unit (GPU), and modem. The CPU primarily handles the operating system and applications; the GPU is responsible for rendering and drawing the content required for display on the screen; and the modem handles wireless communication. It is understood that the modem may also not be integrated into the processor 610 and may be implemented as a separate chip.

[0245] The memory 620 may include random access memory (RAM) or read-only memory. Optionally, the memory 620 may include a non-transitory computer-readable storage medium. The memory 620 may be used to store instructions, programs, code, code sets, or instruction sets. The memory 620 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as receiving functions, control functions, etc.), instructions for implementing the various method embodiments described above, etc.; the data storage area may store data involved in the various method embodiments described above, etc. Optionally, the memory 620 may also be at least one storage device located remotely from the aforementioned processor 610. Figure 6 As shown, the memory 620, which serves as a computer storage medium, may include an operating system, a network communication module, a user interface module, and program instructions.

[0246] Optionally, the communication bus 650 is used to realize the connection and communication between these components. The user interface 630 may include a display screen, a camera, and may also include standard wired interfaces and wireless interfaces. The network interface 640 may optionally include standard wired interfaces and wireless interfaces (such as WIFI interfaces).

[0247] exist Figure 6 In the illustrated electronic device 600, the processor 610 can be used to call program instructions stored in the memory 620 and specifically perform the following operations:

[0248] When the target service is detected to be running, it is determined whether there is a target plugin to be loaded corresponding to the target service. The target plugin is compiled based on a preset standard interface specification.

[0249] If so, then load the target plugin mentioned above;

[0250] Once the target plugin is loaded, if a message processing instruction is detected to be triggered, the corresponding message service interface will be called through the target plugin to send or receive messages. The message processing instruction includes a message sending instruction or a message receiving instruction.

[0251] In one possible implementation, the determination of whether a target plugin corresponding to the target service exists includes:

[0252] Obtain the configuration file corresponding to the target service;

[0253] The plugin directory included in the above configuration file is scanned to determine whether the target plugin corresponding to the target service exists.

[0254] In one possible implementation, the above method also includes:

[0255] Check if there are any target plugins that need to be updated for the aforementioned target services;

[0256] If so, then obtain the updated target plugin corresponding to the target plugin to be updated mentioned above;

[0257] Replace the target plugin to be updated mentioned above with the updated target plugin mentioned above.

[0258] In one possible implementation, the above-mentioned message service interface is called through the target plugin to send or receive messages, including:

[0259] If the above message processing instruction is the above message sending instruction, then service data is received from the data sender based on the above message sending instruction;

[0260] Generate a message to be sent based on the above business data;

[0261] The target plugin calls the message service interface to send the message to be sent to the preset message queue.

[0262] In one possible implementation, the generation of the message to be sent based on the aforementioned business data includes:

[0263] The above business data is parsed to obtain the parsed target data corresponding to the above business data.

[0264] The target data is encapsulated into a message to be sent according to the preset message structure information. The message to be sent includes a message body and metadata.

[0265] In one possible implementation, the above-mentioned message service interface is called through the target plugin to send or receive messages, including:

[0266] If the above message processing instruction is the above message receiving instruction, then the above message service interface is called through the above target plugin to generate a message channel;

[0267] Based on the above message receiving instructions, the message to be received is determined from the preset message queue;

[0268] The message to be received is transmitted to the data receiver corresponding to the message through the aforementioned message channel.

[0269] In one possible implementation, the above method also includes:

[0270] If a message receiving stop instruction is detected for the above message channel, it is determined whether the message to be received in the above message channel has been transmitted completely.

[0271] Once the transmission of the message to be received in the aforementioned message channel is complete, the aforementioned message service interface is invoked through the aforementioned target plugin to disconnect the aforementioned message channel.

[0272] This application also provides a computer-readable storage medium storing instructions that, when executed on a computer or processor, cause the computer or processor to perform one or more steps in the above embodiments. If the constituent modules of the above-described message processing apparatus are implemented as software functional units and sold or used as independent products, they can be stored in the aforementioned computer-readable storage medium.

[0273] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions. When these computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in or transmitted through a computer-readable storage medium. The computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The aforementioned available media can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., digital versatile discs (DVDs)), or semiconductor media (e.g., solid-state drives (SSDs)).

[0274] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the methods described above. The aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks. Unless otherwise specified, the technical features of this embodiment and its implementation can be combined arbitrarily.

[0275] The above-described embodiments are merely preferred embodiments of this application and are not intended to limit the scope of this application. Any modifications and improvements made by those skilled in the art to the technical solutions of this application without departing from the spirit of this application should fall within the protection scope defined by the claims of this application.

Claims

1. A message processing method, characterized in that, include: When the target service is detected to be running, it is determined whether there is a target plugin to be loaded corresponding to the target service, wherein the target plugin is compiled based on a preset standard interface specification; If so, then load the target plugin; Once the target plugin is loaded, if a message processing instruction is detected to be triggered, the corresponding message service interface is called through the target plugin to send or receive messages. The message processing instruction includes a message sending instruction or a message receiving instruction.

2. The method as described in claim 1, characterized in that, The determination of whether there is a target plugin to be loaded corresponding to the target service includes: Obtain the configuration file corresponding to the target service; The plugin directory included in the configuration file is scanned to determine whether the target plugin corresponding to the target service exists.

3. The method as described in claim 1, characterized in that, The method further includes: Check if there is a target plugin for the target service that needs to be updated; If so, then obtain the updated target plugin corresponding to the target plugin to be updated; Replace the target plugin to be updated with the updated target plugin.

4. The method as described in claim 1, characterized in that, The step of calling the message service interface through the target plugin to send or receive messages includes: If the message processing instruction is the message sending instruction, then service data is received from the data sender based on the message sending instruction; Generate a message to be sent based on the aforementioned business data; The target plugin calls the message service interface to send the message to be sent to a preset message queue.

5. The method as described in claim 4, characterized in that, The process of generating a message to be sent based on the business data includes: The business data is parsed to obtain the parsed target data corresponding to the business data; The target data is encapsulated into a message to be sent according to the preset message structure information. The message to be sent includes a message body and metadata.

6. The method as described in claim 1, characterized in that, The step of calling the message service interface through the target plugin to send or receive messages includes: If the message processing instruction is the message receiving instruction, then the message service interface is called through the target plugin to generate a message channel; The message to be received is determined from the preset message queue based on the message receiving instruction; The message to be received is transmitted to the data receiver corresponding to the message through the message channel.

7. The method as described in claim 6, characterized in that, The method further includes: If a message receiving stop instruction is detected for the message channel, it is determined whether the message to be received in the message channel has been transmitted completely. Once the transmission of the message to be received in the message channel is complete, the message service interface is invoked by the target plugin to disconnect the message channel.

8. A message processing device, characterized in that, include: The first judgment module is used to determine whether there is a target plugin to be loaded corresponding to the target service when the target service is detected to be running. The target plugin is compiled based on a preset standard interface specification. A loading module is used to load the target plugin when a target plugin corresponding to the target service exists. The processing module is used to, when the target plugin has been loaded, if a message processing instruction is detected to be triggered, call the corresponding message service interface through the target plugin to send or receive messages. The message processing instruction includes a message sending instruction or a message receiving instruction.

9. An electronic device, characterized in that, include: Processor and memory; The memory stores a computer program adapted to be loaded by the processor and to execute the steps of the method as described in any one of claims 1 to 7.

10. A computer storage medium, characterized in that, The computer storage medium stores a plurality of instructions adapted for loading by a processor and executing the steps of the method as described in any one of claims 1 to 7.