Message transmission system, method and equipment and storage medium

By using the message processing component in the application to identify the class identity of the class instance and create corresponding message channels, the inaccurate message transmission problem caused by channel identification errors is solved, and higher message transmission accuracy is achieved.

CN119902909APending Publication Date: 2025-04-29BEIJING 58 INFORMATION TTECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411977902.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-30
Publication Date
2025-04-29

AI Technical Summary

Technical Problem

In an application, message transmission between different components tends to reduce accuracy due to channel identification errors, resulting in messages being sent incorrectly to incorrect channels.

Method used

The class identity of the class instance is identified through the message processing component and a corresponding message channel is created in the message bus to ensure that the message object is transmitted on the correct channel.

Benefits of technology

Improve the accuracy of message transmission and avoid message transmission errors caused by irregular string identification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119902909A_ABST
    Figure CN119902909A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a message transmission system, method and device and a storage medium. The system comprises a message bus, a message processing component, a data storage component, a first component serving as a publisher and a second component serving as a subscriber. The first component creates a first type instance with a first type identifier and generates a first message object. The message processing component executes the inline function to identify the first class identification of the first class instance. And if the message channel corresponding to the first type of identifier does not exist, the message bus uses the first type of identifier as a channel identifier, creates a first message channel, and stores the first message object in a data storage component. And the second component obtains the first message object from the data storage component by utilizing the first message channel. Visibly, the class identifier can be extracted from the class instance more easily and more accurately through the message processing component, so that the message object can be transmitted in a correct channel, and the accuracy of message transmission is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a message transmission system, method, device and storage medium. Background Art

[0002] In an application (Application, referred to as APP), message transmission between components is the key to ensure the efficient operation of the application. In practice, message transmission between different components can be achieved through a message bus.

[0003] In actual applications, messages transmitted between different components can be transmitted through different transmission channels provided by the message bus, and different channels can be used to transmit different types of messages. However, this may easily lead to the problem that messages are mistakenly sent to incorrect channels due to channel identification errors, thereby reducing the accuracy of message transmission.

[0004] Based on the above description, how to improve the accuracy of message transmission becomes a technical problem that needs to be solved urgently. Summary of the invention

[0005] In view of this, embodiments of the present invention provide a message transmission system, method, device and storage medium to improve the accuracy of message transmission.

[0006] In a first aspect, an embodiment of the present invention provides a message transmission system, including: a message bus, a message processing component, a data storage component, a first component as a publisher, and a second component as a subscriber;

[0007] The first component is used to determine first declaration information; create a first class instance having the first class identifier according to the first class identifier in the first declaration information; and generate a first message object encapsulating the first class instance;

[0008] The message processing component is used to execute an inline function to identify the first class identifier of the first class instance;

[0009] The message bus is used to obtain the first message object; if there is no message channel corresponding to the first category identifier, the first category identifier is used as a channel identifier to create a first message channel corresponding to the first category identifier; and the first message object is stored in a data storage component corresponding to the first message channel;

[0010] The second component is used to obtain the first message object from the data storage component by using the first message channel.

[0011] In a second aspect, an embodiment of the present invention provides a message transmission method, including:

[0012] Obtain a message object encapsulating a class instance, where the class instance is created by the first component according to the class identifier in the declaration information;

[0013] executing an inline function in the message bus integrator to identify the class identifier of the class instance;

[0014] If there is no message channel corresponding to the class identifier, use the class identifier as a channel identifier and create a message channel corresponding to the class identifier;

[0015] The message object is stored in a data storage component corresponding to the message channel, so that the second component obtains the message object from the data storage component by using the message channel, and the data storage component is included in the message bus integrator.

[0016] In a third aspect, an embodiment of the present invention provides a message transmission device, including:

[0017] An acquisition module, used to acquire a message object encapsulating a class instance, where the class instance is created by the first component according to the class identifier in the declaration information;

[0018] An execution module, used for executing an inline function in the message bus integrator to identify the class identifier of the class instance;

[0019] A creation module, configured to use the class identifier as a channel identifier to create a message channel corresponding to the class identifier if the message channel corresponding to the class identifier does not exist;

[0020] The storage module is used to store the message object in a data storage component corresponding to the message channel, so that the second component can obtain the message object from the data storage component using the message channel. The data storage component is included in the message bus integrator.

[0021] In a fourth aspect, an embodiment of the present invention provides an electronic device, comprising a processor and a memory, wherein the memory is used to store one or more computer instructions, wherein the one or more computer instructions, when executed by the processor, implement the message transmission method in the second aspect. The electronic device may also include a communication interface for communicating with other devices or communication systems.

[0022] In a fifth aspect, an embodiment of the present invention provides a non-temporary machine-readable storage medium having executable code stored thereon. When the executable code is executed by a processor of an electronic device, the processor can at least implement the message transmission method as described in the second aspect above.

[0023] In a sixth aspect, an embodiment of the present invention provides a computer program product, which includes a computer program or instructions. When the computer program or instructions are executed by a processor, the processor is enabled to implement the message transmission method as described in the second aspect above.

[0024] In the message transmission system provided by an embodiment of the present invention, the system includes a message bus, a message processing component, a data storage component, a first component as a publisher, and a second component as a subscriber. Among them, the first component can first determine the first declaration information, and create a first class instance with a first class identifier according to the first class identifier in the first declaration information, and then generate a first message object encapsulating the first class instance. Then, the message processing component can execute an inline function to identify the first class identifier of the first class instance. After that, the message bus can obtain the first message object. If there is no message channel corresponding to the first class identifier in the message bus, the message bus can use the first class identifier as a channel identifier, create a first message channel corresponding to the first class identifier, and store the first message object in the data storage component corresponding to the first message channel. Finally, the second component can use the first message channel to obtain the first message object from the data storage component.

[0025] It can be seen that in the above scheme, the first class identifier of the first class instance itself is first identified with the help of the message processing component, and then the first class identifier is directly used as the channel identifier through the message bus, and finally the message object can be transmitted from the message channel with this channel identifier. Compared with the scheme of first extracting the string identifier from the class instance, then adding an additional string identifier to the class instance, and using the string identifier as the channel identifier, the message processing component in this scheme can more easily and accurately extract the class identifier from the class instance, which can ensure that the message object can be transmitted on the correct channel, avoiding the problem of the message object being transmitted on the wrong channel due to non-standard string identifiers, thereby improving the accuracy of message transmission. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0027] Figure 1 A schematic diagram of the structure of a message transmission system provided by an embodiment of the present invention;

[0028] Figure 2A schematic diagram of a message transmission process provided by an embodiment of the present invention;

[0029] Figure 3 A schematic diagram of a message publishing and subscription process provided by an embodiment of the present invention;

[0030] Figure 4 A schematic diagram of another message transmission process provided by an embodiment of the present invention;

[0031] Figure 5 A flowchart of a message transmission method provided by an embodiment of the present invention;

[0032] Figure 6 A schematic diagram of the structure of a message transmission device provided by an embodiment of the present invention;

[0033] Figure 7 For Figure 6 A schematic structural diagram of an electronic device corresponding to the message transmission device provided in the illustrated embodiment. DETAILED DESCRIPTION

[0034] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are 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.

[0035] The terms used in the embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit the present invention. The singular forms "a", "said" and "the" used in the embodiments of the present invention and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings, and "multiple" generally includes at least two, but does not exclude the inclusion of at least one.

[0036] It should be understood that the term "and / or" used in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.

[0037] As used herein, the words "if" and "if" may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to identifying", depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is identified" may be interpreted as "when determining" or "in response to determining" or "when identifying (stated condition or event)" or "in response to identifying (stated condition or event)", depending on the context.

[0038] It should be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a product or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such product or system. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the product or system including the elements.

[0039] It should also be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in the present invention are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0040] Before describing in detail the message transmission system and the message transmission method provided by the following embodiments of the present invention, the related concepts involved in the following embodiments may be explained first:

[0041] LiveData is a data holding container class with lifecycle awareness, which can also be called a data storage component. LiveData implements the observer pattern, which allows registered observers to receive notifications when messages change. Observers include components that need to receive message updates, such as Activity components or Fragment components in applications.

[0042] Generics are a feature in programming languages ​​that allow developers to write code without specifying a specific type, but instead use a placeholder (called a type parameter) to represent any type. <t>express.

[0043] A generic class is a class defined using generic features. The LiveData mentioned above is essentially a generic class that can store message objects of any type. For example, LiveData <user>Indicates that the message object of type User is stored, LiveData <message>Indicates that the message object stored is of the Message type.

[0044] Before describing in detail the message transmission system and the message transmission method provided by each embodiment of the present invention, an application scenario of message transmission may be schematically described:

[0045] As described in the background technology, in order to ensure that the application can run efficiently, messages can be transmitted between components. Among them, the components in the application can include core components such as Activity or Fragment for building a user interface. Among them, the Fragment component can be a part of the Activity component, and it can also be regarded as a subcomponent of the Activity.

[0046] In practical applications, messages transmitted between different components can usually be transmitted with the help of different transmission channels provided by the message bus, and different channels can be used to transmit different types of messages.

[0047] For example, the message bus can add different string identifiers for different types of messages, and use the string identifiers as channel identifiers to distinguish different message channels. However, if the string identifier is added incorrectly, the message will not be sent to the correct message channel, and when the number of message channels is large, it will become more difficult to use string identifiers to distinguish message channels. Therefore, it is easy to cause the message to be mistakenly sent to an incorrect channel due to channel identification errors, thereby reducing the accuracy of message transmission. In order to improve the above problems, the message transmission system and message transmission method provided by the following embodiments of the present invention can be used.

[0048] It should be noted that this solution does not limit the scenario for message transmission, and the message transmission between components in the above application is only an illustration.

[0049] Based on the above description, some embodiments of the present invention are described in detail below in conjunction with the accompanying drawings. In the case where there is no conflict between the embodiments, the following embodiments and the features in the embodiments can be combined with each other. In addition, the step sequence in the following method embodiments is only an example and not a strict limitation.

[0050] Figure 1 The structure diagram of a message transmission system provided by an embodiment of the present invention is shown in FIG. 1 , and the message transmission system can be deployed in an application program. Figure 1 As shown, the message transmission system includes a message bus, a message processing component, a data storage component, a first component as a publisher, and a second component as a subscriber.

[0051] Before describing in detail the specific working process of each part of the message transmission system provided by the embodiment of the present invention, the overall working process of the message transmission system may also be described first:

[0052] In practical applications, the message bus can provide functions of publishing messages and subscribing messages. Then, the first component as a publisher can first generate a first message object encapsulating a first class instance, and publish the first message object to the message bus.

[0053] Then, the message processing component can execute the inline function to identify the first class identifier of the first class instance. Then, the message bus can determine whether there is a message channel corresponding to the first class identifier in itself. If there is no message channel corresponding to the first class identifier in the message bus, the message bus can use the first class identifier as a channel identifier, create a first message channel corresponding to the first class identifier, and store the first message object in a data storage component corresponding to the first message channel. Optionally, the data storage component can be included in the message bus.

[0054] Finally, the second component can use the first message channel to obtain the first message object from the data storage component corresponding to the first message channel to implement message transmission between the first component and the second component.

[0055] The specific working process of the first component publishing messages to the message bus can be combined with Figure 2 Optionally, the first component as the publisher may include the Activity component or Fragment component mentioned above.

[0056] Specifically, if Figure 2 As shown, the first component can first determine the first declaration information, and create a first class instance with the first class identifier according to the first class identifier in the first declaration information. The first declaration information includes a class that defines the properties and methods of the message. The first class instance refers to a specific instance created according to the first class identifier in the first declaration information, that is, the specific message content that the first component wants to pass to the second component, which can implement the properties and methods of the message defined in the first declaration information.

[0057] Next, the first component can generate a first message object encapsulating the first class instance according to the preset message format. After that, the first component can call a message sending method (such as setValue( <t>) method) to send the first message object to the message bus. Optionally, the message sending method includes a generic method, wherein, <t>It can generally refer to the type parameter of the first message object.

[0058] Optionally, different declaration information may include different class identifiers, and different class identifiers may correspond to different Class types. Class type refers to a data type defined by the Class keyword, which may specifically include a User type for representing a publisher type or a Message type for representing a message type, and the like.

[0059] The message processing component can execute the inline function included in itself to <t>, identifying the first class identifier of the first class instance. Optionally, the message processing component may specifically include a Kotlin compiler.

[0060] The message bus may first obtain the first message object. Then, the message bus may determine whether there is a message channel corresponding to the first type of identifier in the message bus. If there is no message channel corresponding to the first type of identifier in the message bus, the message bus may use the first type of identifier as a channel identifier to create a first message channel corresponding to the first type of identifier. Afterwards, the message bus may store the first message object it obtains in the data storage component corresponding to the first message channel.

[0061] Optionally, a message channel may correspond to a data storage component, and a data storage component is used to store a message object. Optionally, the data storage component may specifically include a LiveData component.

[0062] In actual applications, optionally, in addition to the storage function, the data storage component may also have a message update notification function. Specifically, the storage component may send a message update notification to the second component in response to the storage of the first message object. Among them, the second component is the component that needs to receive the message update. Then, in response to the reception of the message update notification, the second component may use the first message channel to obtain the first message object from the data storage component corresponding to the first message channel, thereby realizing the message transmission between the first component and the second component. Optionally, the second component as a subscriber may also include the Activity component or Fragment component mentioned above.

[0063] In this embodiment, the first class identifier of the first class instance itself is first identified by means of the message processing component, and then the first class identifier is directly used as the channel identifier through the message bus, and finally the message object can be transmitted from the message channel with this channel identifier. Compared with the scheme of first extracting the string identifier from the class instance, then adding the string identifier to the class instance, and using the string identifier as the channel identifier, the message processing component in this scheme can more easily and accurately extract the class identifier from the class instance, so as to ensure that the message object can be transmitted on the correct channel, avoiding the problem of the message object being transmitted on the wrong channel due to the non-standard string identifier, thereby improving the accuracy of message transmission.

[0064] It should be noted that in actual applications, the message bus may receive message objects sent by multiple components as publishers at the same time. In this case, the message processing component can identify the class identifiers of different class instances contained in different message objects by executing inline functions. Furthermore, the message bus can create different message channels according to different class identifiers.

[0065] For example, if Figure 3 As shown, the component as publisher 1, the component as publisher 2, the component as subscriber 1, and the component as subscriber 2 can communicate through the message bus without directly establishing contact. Optionally, the message bus can use a mapping (MAP) set to store the mapping relationship between the name of the message channel (such as message channel 1, message channel 2, or message channel N, etc.) and the data storage component. Among them, the name of the message channel corresponds to the class identifier of the class instance.

[0066] Above Figure 1 The first component mentioned in the illustrated embodiment is in the publishing stage. In practical applications, before publishing a message, the first component may also be in the registration stage. Specifically, the message bus may obtain a registration event generated by the first component to register the first component. Optionally, the message bus may include a registration center, which may be used to manage components that publish and subscribe to messages. After obtaining the registration event generated by the first component, the message bus may register the first component in the registration center.

[0067] Regarding the generation of the registration event, specifically, the first component may obtain component information, and generate a registration event according to the component information. Optionally, the component information may include the name of the component, a component identifier for distinguishing different components, an intent filter, etc. Among them, the intent filter can be understood as a set of rules that define the type of message objects that the first component can respond to.

[0068] In this embodiment, by registering the first component in the message bus, the message bus can better manage the component that publishes the message, that is, the first component, to ensure the consistency and reliability of message transmission.

[0069] According to the above Figure 1-2 As can be seen from the description in the illustrated embodiment, the first component needs to generate a first message object first, and then send the first message object to the message bus. Also, before the first component publishes a message, the first component needs to send a registration event generated by itself to the message bus.

[0070] Based on this, the first target object can be processed by means of the message processing component to reduce the sending operation of the first component. The first target object includes the above-mentioned registration event and / or the first message object.

[0071] Specifically, the message processing component can execute the extension function contained in itself to add the second class instance to the first target object. Then, the message processing component can execute the second class instance to automatically send the first target object to the message bus.

[0072] Among them, the extension function provides a flexible way to add a new class instance to an existing target object without modifying the target object, so that developers can easily extend the functionality of the target object without destroying the structure of the existing target object.

[0073] In this embodiment, with the help of a message processing component, a second type instance is added to the first target object generated by the first component, and the second type instance is executed, so that the first target object can be automatically sent to the message bus, reducing the sending operation of the first component, thereby improving the efficiency of message transmission.

[0074] In the above embodiments, it has been mentioned that the second component can use the first message channel to directly obtain the first message object from the data storage component corresponding to the first message channel. In actual applications, there may also be a situation where the first component may not have published the message to the message bus, that is, the message channel has not been established in the message bus, so that the second component cannot directly obtain the message it wants to obtain from the message bus.

[0075] The second component can first subscribe to the message from the message bus, and then transmit the message to the second component after the message bus obtains the message. Figure 4 understand.

[0076] Specifically, if Figure 4 As shown, the second component can first determine the second declaration information, and create a third type instance with the second type identifier according to the second type identifier in the second declaration information. The second type instance refers to a specific instance created according to the second type identifier in the second declaration information, that is, the specific message content that the second component wants to subscribe to, which can implement the properties and methods of the message defined in the second declaration information.

[0077] Then, the second component can generate a second message object encapsulating the third class instance according to the preset format. After that, the second component can call the message receiving method (such as observe( <t>) method), to send the second message object to the message bus, that is, to complete the subscription of the second message object. Optionally, the message receiving method includes a generic method, wherein, <t>It can generally refer to the type parameter of the second message object.

[0078] The message processing component can execute the inline function contained in it to receive the second message object according to the type parameter passed in the message receiving method. <t>, identifying the second type of identifier of the third type of instance. The second type of identifier is different from the first type of identifier, that is, the Class type corresponding to the second type of identifier is different from the Class type corresponding to the first type of identifier.

[0079] The message bus may first obtain the second message object. Then, the message bus may determine whether there is a message channel corresponding to the second type of identifier in the message bus. If there is no message channel corresponding to the second type of identifier in the message bus, the message bus may use the second type of identifier as a channel identifier and create a second message channel corresponding to the second type of identifier.

[0080] Afterwards, if the message bus determines that the third class instance contained in the third message object sent by the first component has the second class identifier, the third message object can be stored in the data storage component corresponding to the second message channel. The second message channel corresponds to the second class identifier. In other words, the data storage component corresponding to the second message channel can store the third message object generated by the first component, and the third message object includes the third class instance with the second class identifier.

[0081] And the data storage component can send a message update notification to the second component in response to the storage of the third message object. Then the second component can obtain the third message object from the data storage component using the second message channel in response to the reception of the message update notification. The third message object and the second message object each contain the same message content, that is, the message transmission is realized between the first component and the second component.

[0082] In this embodiment, the second type identifier of the third type instance itself is first identified by means of the message processing component, and then the second type identifier is directly used as the channel identifier through the message bus, so that the second component can first subscribe to the second message object from the message bus, until the subsequent message bus obtains the third message object published by the first component, and then uses the message channel with this channel identifier to transmit the third message object to the second component. Since the second message object and the third message object each contain the same message content, the normal transmission of messages between the first component and the second component can be guaranteed.

[0083] And compared to the solution of first extracting the string identifier from the class instance, then adding an additional string identifier to the class instance, and using the string identifier as the channel identifier, the message processing component in this solution can extract the class identifier from the class instance more easily and accurately, thereby ensuring that the message object can be transmitted on the correct channel, avoiding the problem of message objects being transmitted on the wrong channel due to non-standard string identifiers, thereby improving the accuracy of message transmission.

[0084] Above Figure 4 The second component mentioned in the illustrated embodiment is in the subscription stage. In practical applications, before subscribing to the message object, the second component may also be in the registration stage. Specifically, the message bus may obtain the registration event generated by the second component to register the second component. Optionally, after obtaining the registration event generated by the second component, the message bus may register the second component in the registration center.

[0085] Regarding the generation of the registration event, specifically, the second component can obtain component information and generate a registration event based on the component information. Optionally, the component information can also include the name of the component, a component identifier for distinguishing different components, an intent filter, etc. The specific process can refer to the registration process of the first component above, which will not be repeated here.

[0086] In this embodiment, by registering the second component in the message bus, the message bus can better manage the component that subscribes to the message, that is, the second component, to ensure the consistency and reliability of message delivery.

[0087] And according to the above Figure 4 As can be seen from the description of the illustrated embodiment, the second component needs to generate the second message object first, and then send the second message object to the message bus. And before the second component subscribes to the message, the second component also needs to send the registration event generated by itself to the message bus.

[0088] Based on this, the second target object can be processed by means of the message processing component to reduce the sending operation of the second component. The second target object includes the above-mentioned registration event and / or the second message object.

[0089] Specifically, the message processing component can execute the extension function contained in itself to add the fourth class instance to the second target object. Then, the message processing component can execute the fourth class instance to automatically send the second target object to the message bus.

[0090] In this embodiment, with the help of the message processing component, a fourth type instance is added to the second target object generated by the second component, and the fourth type instance is executed, so that the second target object can be automatically sent to the message bus, reducing the sending operation of the second component, thereby further improving the efficiency of message transmission.

[0091] The above is a description of the message transmission process from the perspective of the system. In addition, the message transmission process can also be described from the perspective of a message bus integrator. The message bus integrator includes the message processing components and the message bus mentioned above.

[0092] but Figure 5 A flowchart of a message transmission method provided by an embodiment of the present invention. The message transmission method provided by an embodiment of the present invention can be executed by the message bus integrator. It can be understood that the message bus integrator can be implemented as software, or a combination of software and hardware. Optionally, the message bus integrator can be deployed in an application. And a first component as a publisher and a second component as a subscriber can also be deployed in the application. Then Figure 5 As shown, the method comprises the following steps:

[0093] 501. Obtain a message object encapsulating a class instance, where the class instance is created by the first component according to the class identifier in the declaration information.

[0094] 502 , executing an inline function in a message bus integrator to identify a class identifier of a class instance.

[0095] 503. If the message channel corresponding to the class identifier does not exist, the class identifier is used as the channel identifier to create a message channel corresponding to the class identifier.

[0096] 504, store the message object in a data storage component corresponding to the message channel, so that the second component can obtain the message object from the data storage component using the message channel, and the data storage component is included in the message bus integrator.

[0097] The message bus integrator may first obtain a message object encapsulating a class instance. The class instance may be pre-created by the first component according to the class identifier in the declaration information. The specific creation process may refer to the above Figure 1 Description of the illustrated embodiment.

[0098] Then, the message bus integrator can execute the inline function contained in itself to identify the class identifier of the class instance. Then, the message bus integrator can determine whether there is a message channel corresponding to the class identifier in itself. If there is no message channel corresponding to the class identifier in the message bus, the message bus can use the class identifier as the channel identifier to create a message channel corresponding to the class identifier.

[0099] Afterwards, the message bus integrator can store the message object in the data storage component corresponding to the message channel, so that the second component can use the message channel to obtain the message object from the data storage component corresponding to the message channel, thereby realizing the message transmission between the first component and the second component. Among them, the data storage component is included in the message bus integrator, which can specifically include a LiveData component. Optionally, one message channel can correspond to one data storage component.

[0100] In this embodiment, the class identifier of the class instance itself can be first identified by the message bus integrator, and then the class identifier is directly used as the channel identifier, so that the message object can be transmitted from the message channel with the channel identifier. Compared with the solution of first extracting the string identifier from the class instance, then adding the string identifier to the class instance, and using the string identifier as the channel identifier, this solution can more easily and accurately extract the class identifier from the class instance, so as to ensure that the message object can be transmitted on the correct channel, avoiding the problem of the message object being transmitted on the wrong channel due to the non-standard string identifier, thereby improving the accuracy of message transmission.

[0101] In addition, the contents not described in detail in this embodiment and the technical effects that can be achieved can also be referred to in Figure 1 The embodiments shown will not be described in detail here.

[0102] The message transmission device of one or more embodiments of the present invention will be described in detail below. Those skilled in the art will appreciate that these message transmission devices can be configured using commercially available hardware components through the steps taught in this solution.

[0103] Figure 6 A schematic diagram of a message transmission device provided by an embodiment of the present invention is shown in FIG. Figure 6 As shown, the device comprises:

[0104] The acquisition module 11 is used to acquire a message object encapsulating a class instance, where the class instance is created by the first component according to the class identifier in the declaration information.

[0105] The execution module 12 is used to execute the inline function in the message bus integrator to identify the class identifier of the class instance.

[0106] The creation module 13 is configured to use the class identifier as a channel identifier to create a message channel corresponding to the class identifier if there is no message channel corresponding to the class identifier.

[0107] The storage module 14 is used to store the message object in a data storage component corresponding to the message channel, so that the second component can obtain the message object from the data storage component using the message channel. The data storage component is included in the message bus integrator.

[0108] Figure 6 The device shown can perform Figure 5 For the method of the embodiment shown in the figure, the part not described in detail in this embodiment can be referred to Figure 5 The implementation process and technical effects of this technical solution refer to Figure 5 The description in the illustrated embodiment will not be repeated here.

[0109] In a possible design, the structure of the message transmission device can be implemented as an electronic device, such as Figure 7 As shown, the electronic device may include: a processor 21 and a memory 22. The memory 22 is used to store the electronic device to perform the above Figure 5 The program of the message transmission method provided in the illustrated embodiment, the processor 21 is configured to execute the program stored in the memory 22.

[0110] The program includes one or more computer instructions, wherein the one or more computer instructions can implement the following steps when executed by the processor 21:

[0111] Obtain a message object encapsulating a class instance, where the class instance is created by the first component according to the class identifier in the declaration information;

[0112] executing an inline function in the message bus integrator to identify the class identifier of the class instance;

[0113] If there is no message channel corresponding to the class identifier, use the class identifier as a channel identifier and create a message channel corresponding to the class identifier;

[0114] The message object is stored in a data storage component corresponding to the message channel, so that the second component obtains the message object from the data storage component by using the message channel, and the data storage component is included in the message bus integrator.

[0115] Optionally, the processor 21 is further configured to execute the aforementioned Figure 5 All or part of the steps in the illustrated embodiments.

[0116] The structure of the electronic device may further include a communication interface 23 for the electronic device to communicate with other devices or a communication network.

[0117] In addition, an embodiment of the present invention provides a non-transitory machine-readable storage medium for storing computer software instructions used by the above electronic device, which includes instructions for executing the above Figure 5 The procedures involved in the message transmission method shown.

[0118] In addition, an embodiment of the present invention provides a computer program product. The computer program product includes a computer program or an instruction. When the computer program or the instruction is executed by a processor, the processor is enabled to implement the above Figure 5 The steps or functions of the message transmission method shown.

[0119] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.< / t> < / t> < / t> < / t> < / t> < / t> < / message> < / user> < / t>

Claims

1. A message transmission system, characterized in that: Deployed in an application, including: a message bus, a message processing component, a data storage component, a first component as a publisher, and a second component as a subscriber; The first component is used to determine first declaration information; create a first class instance having the first class identifier according to the first class identifier in the first declaration information; and generate a first message object encapsulating the first class instance; The message processing component is used to execute an inline function to identify the first class identifier of the first class instance; The message bus is used to obtain the first message object; if there is no message channel corresponding to the first category identifier, the first category identifier is used as a channel identifier to create a first message channel corresponding to the first category identifier; and the first message object is stored in a data storage component corresponding to the first message channel; The second component is used to obtain the first message object from the data storage component by using the first message channel.

2. The system according to claim 1, characterized in that The data storage component is configured to send a message update notification to the second component in response to the storage of the first message object; The second component is used to obtain the first message object from the data storage component using the first message channel in response to receiving the message update notification.

3. The system according to claim 1, characterized in that The message bus is used to obtain the registration event generated by the first component to register the first component.

4. The system according to claim 3, characterized in that The message processing component is used to execute an extension function to add a second class instance to a first target object, wherein the first target object includes the registration event and / or the first message object; The second class instance is executed to send the first target object to the message bus.

5. The system according to claim 1, characterized in that The second component is used to determine the second declaration information; create a third class instance having the second class identifier according to the second class identifier in the second declaration information; and generate a second message object encapsulating the third class instance; The message processing component is used to execute an inline function to identify the second type of identifier of the third type instance; The message bus is used to obtain the second message object; if there is no message channel corresponding to the second class identifier, the second class identifier is used as the channel identifier to create a second message channel corresponding to the second class identifier, and the data storage component corresponding to the second message channel stores a third message object generated by the first component, and the third message object includes a third class instance with the second class identifier.

6. The system according to claim 5, characterized in that The message bus is used to obtain the registration event generated by the second component to register the second component.

7. The system according to claim 6, characterized in that The message processing component is used to execute an extension function to add a fourth class instance to a second target object, wherein the second target object includes the registration event and / or the second message object; The fourth class instance is executed to send the second target object to the message bus.

8. A message transmission method, characterized in that: The method is applied to a message bus integrator deployed in an application, wherein a first component as a publisher and a second component as a subscriber are also deployed in the application, and the method comprises: Obtain a message object encapsulating a class instance, where the class instance is created by the first component according to the class identifier in the declaration information; executing an inline function in the message bus integrator to identify the class identifier of the class instance; If there is no message channel corresponding to the class identifier, use the class identifier as a channel identifier and create a message channel corresponding to the class identifier; The message object is stored in a data storage component corresponding to the message channel, so that the second component obtains the message object from the data storage component by using the message channel, and the data storage component is included in the message bus integrator.

9. An electronic device, characterized in that: include: A memory and a processor; wherein the memory stores executable code, and when the executable code is executed by the processor, the processor executes the message transmission method as described in claim 8.

10. A non-transitory machine-readable storage medium, characterized in that: The non-transitory machine-readable storage medium stores executable code, and when the executable code is executed by a processor of an electronic device, the processor is caused to execute the message transmission method according to claim 8.