Message sending method, electronic equipment and storage medium
By determining the current status and priority of the message middleware and optimizing the sending order of the message queue, the problem of forwarding flexibility and low efficiency of the message sending system is solved, and more efficient message delivery is achieved.
Patent Information
- Application Number
- CN202410063869.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-16
- Publication Date
- 2025-07-18
AI Technical Summary
When the existing message sending system uses message middleware to forward message queues, there are problems of poor forwarding flexibility and low efficiency, especially when message middleware failure, multiple forwarding may occur, resulting in wasted time.
By obtaining the current state of the message middleware, including the connection status and the running status, the sending priority of the message queue, and sending the message queue in priority order, to improve the sending efficiency.
The efficiency of the message sending system sending message queues through message middleware is improved, and the time consumption is too long and other queues are failed due to poor state of a message middleware.
Smart Images

Figure CN120342827A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of information processing, and in particular, to a message sending method, an electronic device, and a storage medium. Background Art
[0002] When there are communication messages between different systems, message middleware is usually used to forward these communication messages to improve the communication efficiency between different systems. However, the message sending system usually directly uses the message middleware to forward the received message queue. When the message middleware fails, it may happen that the message middleware forwards the same message queue multiple times, wasting a lot of time. This results in the problems of poor forwarding flexibility and low forwarding efficiency in the current message sending system when using the message middleware to forward the message queue.
[0003] In view of the above problems, no effective solution has been proposed yet. Summary of the Invention
[0004] Embodiments of this application provide a message sending method, an electronic device, and a storage medium to at least solve the technical problem of low efficiency in sending message queues in related technologies.
[0005] According to one aspect of the embodiments of this application, a message sending method is provided, including: obtaining a plurality of message queues received by at least one message middleware; determining the current state of at least one message middleware, where the current state includes at least one of the following: connection state and running state, the connection state is used to represent whether the connection between the message middleware and the client is normal, and the running state is used to represent whether the message middleware is running normally; determining the sending priorities of the plurality of message queues based on the current state of at least one message middleware; and using at least one message middleware to send the plurality of message queues to a target client according to the sending priorities.
[0006] According to another aspect of the embodiments of this application, a message sending method is further provided, including: responding to an input instruction on an operation interface, and displaying a plurality of message queues received by at least one message middleware on the operation interface; responding to a sending instruction on the operation interface, and displaying the sending result of the message queue on the operation interface, where the sending result is used to represent the result of sending the plurality of message queues according to the sending priorities based on at least one message middleware, and the sending priorities are determined based on the current state of at least one message middleware, and the current state includes at least one of the following: connection state and running state, the connection state is used to represent whether the connection between the message middleware and the client is normal, and the running state is used to represent whether the message middleware is running normally.
[0007] According to another aspect of the embodiments of the present application, there is also provided a message sending method, including: obtaining a plurality of message queues received by at least one message middleware by invoking a first interface, where the first interface includes a first parameter, and the parameter value of the first parameter includes the message queue; determining the current state of at least one message middleware, where the current state includes at least one of the following: a connection state and an operating state, the connection state is used to represent whether the message middleware and the client are normally connected, and the operating state is used to represent whether the message middleware is operating normally; determining the sending priorities of the plurality of message queues based on the current state of at least one message middleware; using at least one message middleware to send the plurality of message queues to the target client according to the sending priorities; and outputting the sending result of the message queue by invoking a second interface, where the second interface includes a second parameter, and the parameter value of the second parameter includes the sending result.
[0008] According to another aspect of the embodiments of the present application, there is also provided an electronic device, including: a memory storing an executable program; and a processor configured to run the program, where when the program runs, it executes the method according to any one of the above.
[0009] According to another aspect of the embodiments of the present application, there is also provided a computer-readable storage medium, characterized in that the computer-readable storage medium includes a stored executable program, where when the executable program runs, it controls the device where the computer-readable storage medium is located to execute the method according to any one of the above.
[0010] In the embodiments of the present application, the following manner is adopted: obtaining a plurality of message queues received by at least one message middleware; determining the current state of at least one message middleware; determining the sending priorities of the plurality of message queues based on the current state of at least one message middleware; and using at least one message middleware to send the plurality of message queues to the target client according to the sending priorities. By determining the sending priorities of the plurality of message queues according to the current state of the message middleware corresponding to the message queue, the rationality of the determined order of sending message queues is improved, and the situation where the sending of other message queues is affected due to the poor current state of a certain message middleware, resulting in a long time consumption when using the message middleware to send the message queue, is avoided. Thus, the efficiency of the message sending system for sending message queues through the message middleware is improved, and the technical problem of low efficiency in sending message queues in the related art is solved.
[0011] It can be easily noted that the above general description and the following detailed description are only for exemplifying and explaining the present application, and do not constitute a limitation to the present application. Description of the Drawings
[0012] The accompanying drawings described herein are used to provide a further understanding of the present application and form a part of the present application. The schematic embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation to the present application. In the drawings:
[0013] Figure 1 is a hardware structural block diagram of a computer terminal (or mobile device) for implementing a message sending method according to an embodiment of the present application;
[0014] Figure 2 is a structural block diagram of a computing environment according to an embodiment of the present application;
[0015] Figure 3 is a structural block diagram of a service mesh according to an embodiment of the present application;
[0016] Figure 4 is a flowchart of a message sending method according to an embodiment of the present application;
[0017] Figure 5 is a schematic diagram of a message sending process according to an embodiment of the present application;
[0018] Figure 6 is a schematic diagram of a client selecting a message middleware according to an embodiment of the present application;
[0019] Figure 7 is another schematic diagram of a client selecting a message middleware according to an embodiment of the present application;
[0020] Figure 8 is a flowchart of a message sending method according to an embodiment of the present application;
[0021] Figure 9 is a flowchart of a message sending method according to an embodiment of the present application;
[0022] Figure 10 is a structural block diagram of a message sending device according to an embodiment of the present application;
[0023] Figure 11 is a structural block diagram of a message sending device according to an embodiment of the present application;
[0024] Figure 12 is a structural block diagram of a message sending device according to an embodiment of the present application;
[0025] Figure 13 is a structural block diagram of an electronic device according to an embodiment of the present application. Detailed implementation
[0026] To enable those skilled in the art to better understand the solution of this application, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of this application. Obviously, the described embodiments are only a part of the embodiments of this application, rather than all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the scope of protection of this application.
[0027] It should be noted that the terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily need to be used to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so that the embodiments of this application described here can be implemented in an order other than those illustrated or described here. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device that includes a series of steps or units does not necessarily need to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0028] First, some nouns or terms that appear during the description of the embodiments of this application are applicable to the following explanations:
[0029] broker: In computer science, a program or service that acts as an intermediary or middleman. It is a type of message middleware that can communicate between different systems and coordinate data exchange. For example, as a message broker, it is responsible for receiving, forwarding, and routing messages to ensure communication and coordination between different components or systems.
[0030] Message queue (queue): A data structure in computer science that can be used to store and access data in a first-in, first-out order. In a message passing system, a message queue is mainly used to store and deliver messages to ensure that messages are processed in a certain order.
[0031] Selection strategy: When a client sends a message, it is necessary to select a broker and a queue to send the message, and the selection strategy determines the client's selection and sending behavior. A suitable selection strategy can enable the sending end to immediately select a more reliable broker and queue when encountering problems, thereby avoiding being stuck in the original sending action all the time.
[0032] Reachability: It can refer to the smoothness of the connection between the client and the broker. If the connection is disconnected and cannot be accessed, it means that the broker lacks reachability.
[0033] Usability: It can refer to the running state of the broker. A normally running broker should be able to receive, process messages and send back responses normally. If the link is not working and the client fails to send messages, it means that the broker lacks usability.
[0034] Embodiment 1
[0035] According to an embodiment of the present application, a message sending method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. And although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order than here.
[0036] The method embodiment provided by the first embodiment of the present application can be executed on a mobile terminal, a computer terminal or a similar computing device. Figure 1 It is a hardware structure block diagram of a computer terminal (or mobile device) for implementing the message sending method shown according to an embodiment of the present application. As Figure 1 shown, the computer terminal 10 (or mobile device) may include one or more (shown as 102a, 102b,..., 102n in the figure) processors 102 (the processor 102 may include, but is not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 104 for storing data, and a transmission module 106 for communication functions. In addition, it may further include: a display, an input / output interface (I / O interface), a Universal Serial Bus (USB) port (which can be included as one of the ports of the BUS bus), a network interface, a power supply and / or a camera. Those of ordinary skill in the art can understand that Figure 1 the structure shown is only schematic and does not limit the structure of the above-mentioned electronic device. For example, the computer terminal 10 may further include more or fewer components than Figure 1 shown, or have a different configuration from Figure 1 shown.
[0037] It should be noted that the above one or more processors 102 and / or other data processing circuits are generally referred to as "data processing circuits" in this article. The data processing circuit can be embodied in whole or in part as software, hardware, firmware or any combination thereof. In addition, the data processing circuit can be a single independent processing module, or be incorporated in whole or in part into any one of the other elements in the computer terminal 10 (or mobile device). As involved in the embodiments of the present application, the data processing circuit is used for processor control (such as the selection of a variable resistor terminal path connected to an interface).
[0038] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the message sending method in the embodiments of the present application. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, implements the above-mentioned message sending method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memories, or other non-volatile solid-state memories. In some instances, the memory 104 may further include a memory remotely disposed relative to the processor 102, and these remote memories can be connected to the computer terminal 10 through a network. Examples of the above-mentioned network include but are not limited to the Internet, an enterprise intranet, a local area network, a mobile communication network, and combinations thereof.
[0039] The transmission device 106 is used to receive or send data via a network. Specific examples of the above-mentioned network may include a wireless network provided by a communication provider of the computer terminal 10. In one instance, the transmission device 106 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one instance, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0040] The display can be, for example, a touch-screen liquid crystal display (Liquid Crystal Display, LCD), and the liquid crystal display enables a user to interact with the user interface of the computer terminal 10 (or mobile device).
[0041] Figure 1 The shown hardware structure block diagram can not only be used as an exemplary block diagram of the above-mentioned computer terminal 10 (or mobile device), but also be used as an exemplary block diagram of the above-mentioned server. In an alternative embodiment, Figure 2 is shown in a block diagram using the above Figure 1 shown computer terminal 10 (or mobile device) as a computing node in a computing environment 201 in one embodiment. Figure 2 is a structural block diagram of a computing environment shown according to an embodiment of the present application, such as Figure 2As shown, the computing environment 201 includes multiple computing nodes (such as servers, shown as 210-1, 210-2, … in the figure) running on a distributed network. Each computing node contains local processing and memory resources, and end-users 202 can remotely run applications or store data in the computing environment 201. Applications can be provided as multiple services 220-1, 220-2, 220-3, and 220-4 in the computing environment 201, representing services “A”, “D”, “E”, and “H” respectively.
[0042] End-users 202 can provide and access services through a web browser or other software applications on the client side. In some embodiments, the provision and / or requests of end-users 202 can be provided to the ingress gateway 230. The ingress gateway 230 can include a corresponding proxy to handle the provision and / or requests for services (one or more services provided in the computing environment 201).
[0043] Services are provided or deployed according to various virtualization technologies supported by the computing environment 201. In some embodiments, services can be provided based on virtual machine (VM)-based virtualization, container-based virtualization, and / or similar methods. VM-based virtualization can simulate a real computer by initializing a virtual machine and execute programs and applications without directly accessing any actual hardware resources. While virtualizing the machine with a virtual machine, according to container-based virtualization, containers can be launched to virtualize the entire operating system (OS) so that multiple workloads can run on a single operating system instance.
[0044] In one embodiment of container-based virtualization, several containers of a service can be assembled into a Pod (e.g., Kubernetes Pod). For example, as Figure 2 shown, service 220-2 can be equipped with one or more Pods 240-1, 240-2, …, 240-N (collectively referred to as Pods). A Pod can include a proxy 245 and one or more containers 242-1, 242-2, …, 242-M (collectively referred to as containers). One or more containers in the Pod handle requests related to one or more corresponding functions of the service, and the proxy 245 generally controls network functions related to the service, such as routing, load balancing, etc. Other services can also be equipped with similar Pods.
[0045] During operation, executing user requests from end-users 202 may require invoking one or more services in the computing environment 201, and executing one or more functions of a service may require invoking one or more functions of another service. As Figure 2As shown, service "A" 220-1 receives a user request from end user 202 at ingress gateway 230. Service "A" 220-1 may invoke service "D" 220-2, and service "D" 220-2 may request service "E" 220-3 to perform one or more functions.
[0046] The computing environment described above may be a cloud computing environment, where the allocation of resources is managed by a cloud service provider, allowing for the development of functions without considering the implementation, adjustment, or expansion of servers. This computing environment allows developers to execute code in response to events without building or maintaining complex infrastructure. Services can be split into a set of functions that can scale automatically and independently, rather than scaling a single hardware device to handle potential loads.
[0047] In another alternative embodiment, Figure 3 is shown in block diagram form as an embodiment of a service mesh using the Figure 1 computer terminal 10 (or mobile device) shown above. Figure 3 is a structural block diagram of a service mesh shown according to an embodiment of the present application. As Figure 3 shown, the service mesh 300 is mainly used to facilitate secure and reliable communication between multiple microservices. A microservice refers to decomposing an application into multiple smaller services or instances and running them on different clusters / machines.
[0048] As Figure 3 shown, the microservices may include application service instance A and application service instance B. Application service instance A and application service instance B form the functional application layer of service mesh 300. In one implementation, application service instance A runs in the form of a container / process 308 on a machine / workload container group 314 (Pod), and application service instance B runs in the form of a container / process 310 on a machine / workload container group 316 (Pod).
[0049] In one implementation, application service instance A may be a product query service, and application service instance B may be a product order placement service.
[0050] As Figure 3As shown, application service instance A and mesh proxy (sidecar) 303 coexist in machine workload container group 314, and application service instance B and mesh proxy 305 coexist in machine workload container 316. Mesh proxy 303 and mesh proxy 305 form the data plane layer of service mesh 300. Among them, mesh proxy 303 and mesh proxy 305 run in the form of container / process 304 and container / process 306 respectively, and can receive requests 312 for commodity query services. Moreover, two-way communication is possible between mesh proxy 303 and application service instance A, and between mesh proxy 305 and application service instance B. In addition, two-way communication is also possible between mesh proxy 303 and mesh proxy 305.
[0051] In one implementation, the traffic of application service instance A is routed to the appropriate destination through mesh proxy 303, and the network traffic of application service instance B is routed to the appropriate destination through mesh proxy 305. It should be noted that the network traffic mentioned here includes but is not limited to forms such as Hyper Text Transfer Protocol (abbreviated as HTTP), Representational State Transfer (abbreviated as REST), google Remote Procedure Call (gRPC), an open-source in-memory data structure storage system (Redis), etc.
[0052] In one implementation, the function of extending the data plane layer can be achieved by writing custom filters (Filters) for the Envoy in service mesh 300. The service mesh proxy configuration can be used to correctly proxy service traffic in the service mesh, realizing service intercommunication and service governance. Mesh proxy 303 and mesh proxy 305 can be configured to perform at least one of the following functions: service discovery, health checking, routing, load balancing, authentication and authorization, and observability.
[0053] As Figure 3 shown, this service mesh 300 also includes a control plane layer. Among them, the control plane layer can be a set of services running in a dedicated namespace, and these services are hosted by the managed control plane component 301 in machine / workload container group (machine / Pod) 302. As Figure 3As shown in the figure, the managed control plane component 301 communicates bidirectionally with the mesh agents 303 and 305. The managed control plane component 301 is configured to perform some control management functions. For example, the managed control plane component 301 receives the telemetry data transmitted by the mesh agents 303 and 305, and can further aggregate this telemetry data. For these services, the managed control plane component 301 can also provide user-facing application programming interfaces (APIs) to more easily manipulate network behavior and provide configuration data to the mesh agents 303 and 305, etc.
[0054] In the above operating environment, the present application provides a message sending method as shown in Figure 4 the figure. Figure 4 It is a flowchart of a message sending method shown according to an embodiment of the present application. As shown in Figure 4 the figure, the steps of the method include:
[0055] Step S402, obtain a plurality of message queues received by at least one message middleware.
[0056] The above message middleware may refer to middleware for forwarding communication messages between different systems, and may refer to broker middleware. The above message queues may refer to message queues that need to be forwarded by the message middleware, and may be composed of communication messages received by the message middleware. For example, they can be obtained by dividing the communication messages according to the time when the message middleware receives the communication messages, or by dividing the communication messages according to the message identifiers of the received communication messages. The specific division method of the message queues can be selected according to the actual situation and is not limited here.
[0057] In an alternative solution of this embodiment, in order to be able to reasonably send the message queues received by the message middleware and improve the stability of the message middleware forwarding communication messages, the message sending system may first obtain a plurality of message queues received by at least one message middleware.
[0058] Step S404, determine the current state of at least one message middleware.
[0059] Among them, the current state includes at least one of the following: connection state and running state. The connection state is used to characterize whether the message middleware and the client are connected normally, and the running state is used to characterize whether the message middleware is running normally.
[0060] The above current state may refer to a state that can reflect the availability and reachability of the message middleware. The current state of the message middleware may include: connection state and / or running state. Among them, the connection state may refer to whether the connection between the message middleware and the client is normal. For example, whether the client can stably send the message queue to the message middleware, which may refer to the reachability of the message middleware; the running state may refer to whether the message middleware is running normally. For example, whether it can normally send the message queue, which may refer to the availability of the message middleware.
[0061] In an alternative solution of this embodiment, in order to stably use the message middleware to forward the message queue, the message sending system may determine the current state of the message middleware currently used to forward the message queue, that is, whether the communication between the message middleware and the client is smooth, whether the message middleware can stably send the message queue and other states. Through these states, it can be reflected whether the message middleware can currently stably send the message queue. Based on this, after obtaining multiple message queues that need to be sent currently, the message sending system may further obtain the current states of the message middleware corresponding to different message queues respectively, that is, determine whether the connection between the message middleware and the client is unobstructed, whether the message middleware can normally send the message queue, etc.
[0062] Step S406, based on the current states of at least one message middleware, determine the sending priorities of multiple message queues.
[0063] In an alternative solution of this embodiment, considering that the message queue is forwarded by the message middleware, and since the current states of different message middleware may be different, and the current state can reflect whether different message middleware can stably and efficiently send the received message queue. If the message queue is sent using the message middleware corresponding to the message queue in a random order or in the order of receiving the message queue, there may be a situation where the stability and efficiency of sending the message queue using the message middleware are relatively low. For example, if message queue A is preferentially sent currently, and the sending ability of message middleware A corresponding to message queue A is unstable, such as the reachability of the message middleware is relatively low. At this time, the message sending system may continuously send message queue A multiple times using message middleware A, resulting in other message queues, such as message queue B, message queue C, etc., being unable to enter the message sending state all the time, thereby affecting the entire message queue sending process, and the stability and efficiency of the message sending system using the message middleware to send the message queue are relatively low. Therefore, in order to improve the stability and efficiency of sending the message queue using the message middleware, the message sending system can first determine the sending order of different message queues, that is, determine the sending priorities of multiple message queues. For example, preferentially send the message queues received by the message middleware with higher stability, and then send the message queues received by the message middleware with lower stability. Considering that the current state of the message middleware obtained above can effectively reflect whether the message middleware can stably and smoothly send the received message queue, therefore, the message sending system can determine the sending priorities of the multiple received message queues according to the current state of at least one obtained message middleware. For example, considering that the above current state may include: connection state and / or running state. Therefore, when determining the priorities of different message queue sendings, a higher priority can be set for the message queues received by the message middleware with a stable connection state and a stable running state, then a lower priority can be set for the message queues received by the message middleware with only a stable connection state or only a stable running state, and finally the lowest priority can be set for the message queues received by the message middleware with an unstable connection state and an unstable running state, so as to avoid the situation where the message sending system spends a long time sending the message queue with the lowest priority, resulting in too long sending time or sending failure of the remaining message queues.
[0064] Step S408, use at least one message middleware to send multiple message queues to the target client according to the sending priorities.
[0065] In an alternative solution of this embodiment, after determining the sending priorities of different message queues, the message sending system may use the corresponding message middleware to send the above-mentioned multiple message queues according to the sending priorities. For example, it preferentially uses the message middleware corresponding to the message queue with a higher sending priority to send the message queue, and then uses the message middleware corresponding to the message queue with a lower sending priority to send the message queue to the target client, so as to ensure that the message queue can be sent smoothly and stably.
[0066] In the embodiment of the present application, the method includes obtaining multiple message queues received by at least one message middleware; determining the current state of at least one message middleware; determining the sending priorities of the multiple message queues based on the current state of at least one message middleware; and using at least one message middleware to send the multiple message queues to the target client according to the sending priorities. By determining the sending priorities of the multiple message queues according to the current state of the message middleware corresponding to the message queues, the rationality of the determined order of sending message queues is improved, and the situation that the sending of other message queues is affected due to the long time consumed when using a message middleware with a poor current state to send a message queue is avoided. Thus, the efficiency of the message sending system for sending message queues through message middleware is improved, and the technical problem of low efficiency in sending message queues in the related art is solved.
[0067] In the embodiment of the present application, determining the sending priorities of the multiple message queues based on the current state of at least one message middleware includes: screening the multiple message queues remaining after being screened by the previous queue selector based on the current state by at least one serially connected queue selector to obtain the queue selection results of at least one queue selector; and determining the sending priorities of the multiple message queues based on the connection order and queue selection results of at least one queue selector.
[0068] The above-mentioned queue selector may refer to a selector for determining the priorities of different message queues. At least one screening condition or selection strategy is configured in the queue selector. Using the above-mentioned queue selector, the message queues to be sent preferentially can be screened out from the multiple message queues. The sending priorities of the corresponding screened message queues are generally higher than those of the un-screened message queues.
[0069] In an alternative solution of this embodiment, in order to improve the efficiency of determining the sending priorities of different message queues, it may be preset to set at least one queue selector in the message sending system to screen multiple message queues, and determine the sending priorities of different message queues according to the screening results. Considering that the sending priorities of different message queues can be determined according to the current status of the message middleware corresponding to the message queues, therefore, at least one screening condition configured in the above queue selector may refer to a condition related to the current status of the message middleware. For example, the screening condition may include, but is not limited to: screening out the message queues received by the message middleware with a connection status of normal connection between the message middleware and the client and a running status of normal operation of the message middleware; screening out the message queues received by the message middleware with a connection status of normal connection between the message middleware and the client or a running status of normal operation of the message middleware; screening out the message queues received by the message middleware with a connection status of abnormal connection between the message middleware and the client and a running status of abnormal operation of the message middleware, etc.
[0070] As shown above, considering that there is more than one current status of the message middleware corresponding to the message queues, correspondingly, there may be more than one screening condition that can be configured in the queue selector. Therefore, multiple queue selectors can be configured in the message sending system during actual use. In order to stably determine the sending priorities of different message queues and avoid the situation where one message corresponds to multiple sending priorities, the above multiple queue selectors can be configured in series in the message sending system. The message sending system can, through at least one queue selector connected in series, on the basis of the current status of the message middleware corresponding to the message queues, have the current queue selector screen the multiple message queues remaining after the previous queue selector's screening to obtain the queue selection result corresponding to the current queue selector. Finally, according to the connection order and queue selection results of at least one queue selector, determine the sending priorities corresponding to different message queues respectively. For example, if there are currently two queue selectors, where queue selector 1 is used to screen out the message queues received by the message middleware with a connection status of normal connection between the message middleware and the client, and queue selector 2 is used to screen out the message queues with a running status of normal operation of the message middleware, and queue selector 1 is before queue selector 2, then when using these two queue selectors to determine the sending priorities of different message queues, first screen out the message queues with a connection status of normal connection between the message middleware and the client corresponding to the message middleware from multiple message queues, and set the sending priority of this message queue to a higher sending priority. Then, screen out the message queues with a running status of normal operation of the message middleware corresponding to the message middleware from the remaining message queues, and set the sending priority of this message queue to a lower sending priority. Finally, set the sending priorities of the remaining message queues to the lowest sending priority.
[0071] In an embodiment of the present application, at least one queue selector connected in series filters a plurality of message queues remaining after being filtered by the previous queue selector based on the current state, and obtains the queue selection result of at least one queue selector, including: determining the selector identifier of the queue selector, and determining a target state matching the selector identifier from the current state; obtaining a queue filtering condition matching the selector identifier; when the target state meets the queue filtering condition and the match is successful, storing the message queue received by the message middleware corresponding to the target state into the queue selection result.
[0072] The above-mentioned target state may refer to the state determined in the current state that needs to be used during the process of filtering message queues by the queue selector. For example, if the queue selector filters out the message queues received by available message middleware from a plurality of message queues, the corresponding target state is the running state in the current state. The above-mentioned filtering condition may refer to the condition that needs to be used during the process of filtering message queues by the queue selector. For example, if the queue selector filters out the message queues received by available message middleware from a plurality of message queues, the corresponding queue filtering condition may refer to that the message middleware corresponding to the message queue is available.
[0073] In an alternative solution of this embodiment, in order to facilitate the configuration of queue selectors in the message sending system and avoid configuring queue selectors with the same filtering conditions at different positions in the message sending system, different selector identifiers can be configured for different types of queue selectors, for example, queue selectors with different filtering conditions. When filtering message queues using the queue selectors connected in series, the message sending system can first determine the selector identifier of the queue selector with a higher order according to the connection order of the queue selectors, then determine the target state matching the selector identifier from the above-mentioned current state, and obtain the queue filtering condition matching the selector identifier. Finally, match the target state and the queue filtering condition. If the two match successfully, it means that the message queue received by the message middleware corresponding to the target state meets the filtering condition of the queue selector. At this time, the message queue can be stored into the queue selection result; if the two do not match, it means that the message queue received by the message middleware corresponding to the target state does not meet the filtering condition of the queue selector. At this time, the message queue can be retained and applied to the filtering of subsequent other queue selectors. It should be noted that since there is no direct connection between the queue filtering condition and the target state, and both are determined according to the selector identifier, the order of obtaining the queue filtering condition and obtaining the target state is not specifically limited.
[0074] In the embodiment of the present application, based on the connection order and queue selection results of at least one queue selector, the transmission priorities of multiple message queues are determined, including: based on the connection order of at least one queue selector, determining the transmission priorities of the message queues included in the queue selection results; determining the transmission priority of the target message queue among the multiple message queues as a preset priority, where the target message queue is used to represent the message queues among the multiple message queues that are not included in the queue selection results, and the preset priority is lower than the transmission priorities of the message queues included in the queue selection results.
[0075] In an alternative solution of this embodiment, considering that in the actual use process, there may be a situation where the message queues do not meet the screening conditions of multiple queue selectors, that is, the above-mentioned target message queues. At this time, the transmission priorities of these target message queues cannot be determined according to the connection order of the queue selectors. Therefore, in order to ensure the configuration of transmission priorities for message queues, when determining the transmission priorities of different message queues, the message sending system can first determine the transmission priorities of the message queues included in different queue selection results according to the connection order between the queue selectors and the queue selection results selected by different queue selectors, and then determine the transmission priority of the above-mentioned target message queue as a preset priority. Considering that the target message queue does not meet the screening conditions of the queue selector, the preset priority can be set to be lower than the transmission priorities of the message queues included in the queue selection results.
[0076] In the embodiment of the present application, at least one queue selector includes a first queue selector, a second queue selector, a third queue selector, and a fourth queue selector connected in series. Among them, through the at least one queue selector connected in series, based on the current state, the multiple message queues remaining after being screened by the previous queue selector are screened to obtain the queue selection results of at least one queue selector, including: screening the multiple message queues through the first queue selector based on the connection state and operating state to obtain the queue selection results of the first queue selector; screening the multiple message queues through the second queue selector based on the operating state to obtain the queue selection results of the second queue selector; screening the multiple message queues through the third queue selector based on the connection state to obtain the queue selection results of the third queue selector; adding the target message queue among the multiple message queues to the queue selection results of the fourth queue selector through the fourth queue selector, where the target message queue is used to represent the message queues among the multiple message queues that are not included in the queue selection results of the first queue selector, the queue selection results of the second queue selector, and the queue selection results of the third queue selector.
[0077] For the convenience of understanding the process of selecting a message queue using a queue selector, taking the queue selector including a first queue selector, a second selector, a third selector, and a fourth queue selector connected in series as an example, assume that the screening condition of the first queue selector is to screen the message queue based on both the connection status and the running status. The screening condition of the second queue selector is to screen the message queue only based on the running status. The third queue selector is to screen the message queue only based on the connection status. The fourth queue selector is a queue selector for screening the aforementioned target message queue. When screening the message queue using the above queue selector, the screening condition included in the first queue selector can be used first to screen the multiple message queues based on the connection status and the running status of the message middleware corresponding to the multiple message queues. For example, screen out the message queues received by the message middleware with a normal connection status between the message middleware and the client and a normal running status of the message middleware to obtain the queue selection result of the first queue selector; then use the screening condition included in the second queue selector to screen the remaining message queues based on the connection status of the message middleware corresponding to the multiple message queues. For example, screen out the message queues received by the message middleware with a normal connection status between the message middleware and the client to obtain the queue selection result of the second queue selector; then use the screening condition included in the third queue selector to screen the remaining message queues based on the running status of the message middleware corresponding to the multiple message queues. For example, screen out the message queues received by the message middleware with a normal running status of the message middleware to obtain the queue selection result of the third queue selector; finally, use the fourth queue selector to add the remaining target message queues after being screened by the first queue selector, the second queue selector, and the third queue selector to the queue selection result of the fourth queue selector.
[0078] In the embodiment of the present application, based on the connection order and the queue selection result of at least one queue selector, determining the sending priorities of multiple message queues includes: determining that the sending priority of the message queues included in the queue selection result of the first queue selector is determined as the first priority; determining that the sending priority of the message queues included in the queue selection result of the second queue selector is determined as the second priority, where the first priority is greater than the second priority; determining that the sending priority of the message queues included in the queue selection result of the third queue selector is determined as the third priority, where the second priority is greater than the third priority; determining that the sending priority of the message queues included in the queue selection result of the fourth queue selector is the fourth priority, where the third priority is greater than the fourth priority.
[0079] Continuing with the example of the four queue selectors connected in series above, when determining the sending priorities of different message queues, the sending priority of the message queue included in the queue selection result of the first queue selector can be determined as the first priority, the sending priority of the message queue included in the queue selection result of the second queue selector can be determined as the second priority, the sending priority of the message queue included in the queue selection result of the third queue selector can be determined as the third priority, and the sending priority of the message queue included in the queue selection result of the fourth queue selector can be determined as the fourth priority. Among them, based on the connection order of these four queue selectors, it can be determined that the first priority is greater than the second priority, the second priority is greater than the third priority, and the third priority is greater than the fourth priority.
[0080] In the embodiment of the present application, the above method further includes: outputting at least one queue selector on an interaction interface in a client; in response to detecting an adjustment operation for adjusting at least one queue selector in the interaction interface, adjusting at least one queue selector based on the adjustment operation to obtain an adjusted queue selector; screening a plurality of message queues based on the current state by the adjusted queue selector to obtain a queue selection result of the adjusted queue selector.
[0081] In an alternative solution of this embodiment, the queue selector for screening a plurality of message queues can also be set by the user himself. Specifically, the queue selector can be displayed on a preset interaction interface in the client for the user to view the currently set queue selector by himself. The user can adjust the queue selector according to his own needs, such as performing operations such as adding, deleting, and moving the position of the queue selector. The message sending system can adjust the above queue selector according to the adjustment operation performed by the user on the interaction interface to obtain an adjusted queue selector and re-perform the foregoing operations to screen a plurality of message queues based on the current state of the message middleware to obtain a queue selection result of the adjusted queue selector.
[0082] In the embodiment of the present application, the above method further includes: sending a probe message to the message middleware at a preset period; obtaining the response time and response result of the message middleware in response to the probe message; determining the current state of the message middleware based on the response time and response result.
[0083] In an alternative solution of this embodiment, the current state of the message middleware can be quickly obtained by the message sending system from the middleware status table that stores the current state. If the corresponding current state is not stored in the middleware status table, the message system can detect the current state of the message middleware in real time. Specifically, the message sending system can send a probe message to the message middleware at a preset period, and obtain the response time and response result of the message middleware to the probe message. Finally, based on the response time and response result, the current state of the message middleware is determined.
[0084] In the embodiment of this application, determining the current state of the message middleware based on the response time and response result includes: determining the connection state of the message middleware based on the response result; determining the running state of the message middleware based on the response time.
[0085] When determining the current state according to the response time and response result, the connection state of the message middleware can be determined according to the response result, and the running state of the message middleware can be determined according to the response time.
[0086] In the embodiment of this application, determining the connection state of the message middleware based on the response result includes: when the response result is that the message middleware successfully responds to the probe message, determining that the connection state is that the message middleware and the client are normally connected; when the response result is that the message middleware fails to respond to the probe message, determining that the connection state is that the message middleware and the client are abnormally connected.
[0087] When determining the connection state according to the response result, it can be determined that the above connection state is that the message middleware and the client are normally connected when the response result is that the message middleware successfully responds to the probe message; it can be determined that the above connection state is that the message middleware and the client are abnormally connected when the response result is that the message middleware fails to respond to the probe message.
[0088] In the embodiment of this application, determining the running state of the message middleware based on the response time includes: when the response time is less than or equal to the preset time threshold, determining that the running state is that the message middleware is running normally; when the response time is greater than the preset time threshold, determining that the running state is that the message middleware is running abnormally.
[0089] When determining the running state according to the response time, it can be determined that the above running state is that the message middleware is running normally when the response time is less than or equal to the preset time threshold; it can be determined that the above running state is that the message middleware is running abnormally when the response time is greater than the preset time threshold.
[0090] To facilitate the understanding of the current state of the message middleware obtained by the message sending system from the middleware status table, for example, assume that there is currently a message middleware A. When determining the current state of the message middleware A according to the above process, if it is detected that the message middleware A successfully responds to the probe message and the response time is less than the preset time threshold, then it can be determined at this time that the message middleware is reachable and available. At this time, what can be stored in the middleware status table is "Message middleware A: reachable, available". At this time, the message sending system can directly obtain the current state of the message middleware A from the intermediate status table as: the connection between the client and the message middleware is normal, and the message middleware is running normally.
[0091] Or, if the status already stored in the middleware status table contains "Message middleware A: reachable, available", and it is detected that the message middleware A successfully responds to the probe message, but the time to respond to the probe message is greater than the preset time threshold, then it can be determined at this time that the message middleware is reachable but not available, and the middleware status table can be updated to "Message middleware A: reachable, not available". At this time, the current state of the message middleware A obtained by the message sending system from the intermediate status table is: the connection between the client and the message middleware is normal, and the message middleware is running abnormally.
[0092] Or, if the status already stored in the middleware status table contains "Message middleware A: reachable, available", and it is detected that the message middleware A does not receive the probe message, since it is impossible to directly determine whether the message middleware A can operate normally, then it can only be determined at this time that the message middleware is unreachable, and the middleware status can be correspondingly updated to "Message middleware A: unreachable, available". At this time, the current state of the message middleware A obtained by the message sending system from the intermediate status table is: the connection between the client and the message middleware is abnormal, and the message middleware is running normally.
[0093] Alternatively, if the status already stored in the middleware status table contains "Message Middleware A: reachable, unavailable" and it is detected that Message Middleware A has not received the probe message, since it is not possible to directly determine whether Message Middleware A can operate normally, it can only be determined at this time that the message middleware is unreachable. Correspondingly, the middleware status can be updated to "Message Middleware A: unreachable, unavailable". At this time, the current status of Message Middleware A obtained by the message sending system from the intermediate status table is: the connection between the client and the message middleware is abnormal, and the message middleware is operating abnormally. In the embodiments of the present application, the above method further includes: in response to the running status being that the message middleware is operating normally, storing the running status and the connection status into the middleware status table based on the middleware identifier of the message middleware, where the middleware status table is deployed in the client; in response to the running status being that the message middleware is operating abnormally, obtaining the first time node when it is detected that the message middleware is operating abnormally, and the second time node when it will operate normally next time, and storing the running status, the first time node, the second time node, and the connection status into the middleware status table based on the middleware identifier.
[0094] In an alternative solution of this embodiment, after detecting the current status of the message middleware, the message sending system can store the detected current status into a preset middleware status table. Specifically, if the running status of the message middleware is normal, the middleware identifier, the connection status, and the running status of the message middleware can be correspondingly stored in the middleware status table according to the middleware identifier of the message middleware; if the running status of the message middleware is abnormal, the message sending system can also obtain the first time node when it is detected that the message middleware is operating abnormally, and then predict the second time node when the message middleware will operate normally next time according to this first time point, for example, predict based on the historical data of the message middleware from abnormal operation to normal operation, or predict this second time point according to a preset time period. Finally, the corresponding running status, connection status, first time point, and second time point are stored into the above middleware status table to facilitate the user to view and at the same time facilitate the message sending system to obtain the current status of the message middleware.
[0095] In the embodiment of the present application, the above method further includes: in response to the failure of the message queue sending, updating the running state of the message middleware to abnormal message middleware operation, and obtaining other message middleware based on the middleware state table, where the current state of the other message middleware is that the other message middleware and the client are normally connected, and / or the other message middleware is running normally; in response to successfully obtaining other message middleware, sending the message queue to the other message middleware; in response to the failure of obtaining other message middleware, re-determining the current state of the message middleware according to a preset period, and in the case of determining that the current state of the target message middleware is that the target message middleware and the client are normally connected, and / or the target message middleware is running normally, sending the message queue to the target message middleware.
[0096] In an alternative solution of this embodiment, if the message queue sending fails when using the message middleware to send the message queue, the message sending system can timely update the running state of the failed message queue to abnormal operation, and re-obtain other message middleware based on the above middleware state table, such as other message middleware that is normally connected to the client and / or running normally, and send the failed message queue to the other message middleware to re-send the message queue. If there is no other message middleware available to send the message queue currently, the message sending system can detect the current state of the message middleware in real time according to the above preset period, and in the case of detecting that the running state of any message middleware is normal message middleware operation, and / or the connection state is that the message middleware and the client are normally connected, the message middleware can be used as the target message middleware, and the message sending system can send the failed message queue to the target message middleware to send the message queue through the target message middleware, so as to avoid the situation of missed sending of the message queue, and further improve the sending stability and success rate of the message queue.
[0097] For ease of understanding, Figure 5 is a schematic diagram of a message sending process shown according to an embodiment of the present application, as Figure 5As shown in the figure, the entire sending process can include three parts. Part one represents the process in which the message middleware receives multiple message queues. In the message sending system, multiple message middleware can be configured, such as broker1, broker2, etc. The message queues received by different message middleware can be different. For example, the message queues received by broker1 can be message queue 1-1, message queue 1-2, message queue 1-3, etc., and the message queues received by broker2 can be message queue 2-1, message queue 2-2, message queue 2-3, etc. Part two represents the message queue selection process. A pipelined message queue filter composed of multiple queue selectors, such as selector 1, selector 2, selector 3, etc., can screen and filter multiple message queues to obtain corresponding multiple selection results, such as selection result 1, selection result 2, selection result 3, etc., to determine the sending priorities of different message queues. Part three represents the process of sending the message queue. The message queue can be sent using the corresponding message middleware according to the determined sending priority. If the message queue sending fails, the message sending system can also update the message middleware of this message queue to other message middleware and resend this message queue, thereby avoiding missed sending or affecting the overall message sending due to multiple failures of a message queue.
[0098] Figure 6 is a schematic diagram of a client selecting message middleware according to an embodiment of the present application. When sending a message, the client can actively select the message middleware for sending the message, and its selection conditions can be the same as the foregoing screening conditions, such as Figure 6 shown in the figure. The client can preferentially select the message middleware that can operate normally and send the message to be sent to this message middleware. For example, if broker1 and broker2 are unavailable and broker3 and broker4 are available, then broker3 and broker4 can be selected to forward the message at this time. Figure 7 is another schematic diagram of a client selecting message middleware according to an embodiment of the present application. As Figure 7 shown in the figure, in addition to selecting the message queues corresponding to the message middleware with normal operating status, the message middleware with normal connection between the message middleware and the client can also be selected. For example, on the basis of Figure 6 if broker1 is unreachable and unavailable, broker2 is unavailable but reachable, and broker3 and broker4 are reachable, then broker2, broker3, and broker4 can be selected to forward the message at this time.
[0099] Table 1
[0100]
[0101] Compare the message sending situation before being processed by the queue selector with that after being processed by the queue selector. As can be seen from Table 1, when the message middleware broker is closed at a preset time interval, when sending message queues through the message sending method proposed in this application, the number of message queues with sending failures significantly decreases, and the sending success rate significantly increases, greatly ensuring the stability and success rate of the message sending process.
[0102] It should be noted that for the foregoing method embodiments, for the sake of simple description, they are all expressed as a series of action combinations. However, those skilled in the art should know that this application is not limited by the described action sequence, because according to this application, certain steps can be in other sequences or performed simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to this application.
[0103] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on such an understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to enable a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods of various embodiments of this application.
[0104] Embodiment 2
[0105] According to an embodiment of this application, a message sending method is also provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order than here.
[0106] Figure 8 is a flowchart of a message sending method shown according to an embodiment of this application. As Figure 8 shown, the method may include the following steps:
[0107] Step S802, in response to an input instruction acting on the operation interface, display at least one of the multiple message queues received by the message middleware on the operation interface.
[0108] The above input instruction may refer to an instruction for inputting and reading the message queue to be sent.
[0109] In an alternative solution of this embodiment, when an input instruction on the scope operation interface is received, the message sending system may display, in the above operation interface, multiple message queues received by at least one message middleware, so as to facilitate the user to view.
[0110] Step S804, in response to a sending instruction acting on the operation interface, display the sending result of the message queue on the operation interface.
[0111] Wherein, the sending result is used to characterize the result of sending multiple message queues according to the sending priority based on at least one message middleware, and the sending priority is determined based on the current state of at least one message middleware. The current state includes at least one of the following: connection state and running state. The connection state is used to characterize whether the message middleware and the client are normally connected, and the running state is used to characterize whether the message middleware is running normally.
[0112] The above sending instruction may refer to an instruction to send a message queue through the message middleware.
[0113] In an alternative solution of this embodiment, when a sending instruction is received, the message sending system may first obtain the reading state of the message middleware, such as the connection state and the running state. Among them, the connection state may refer to whether the connection between the message middleware and the client is normal. For example, whether the client can stably send the message queue to the message queue may refer to the reachability of the message middleware; the running state may refer to whether the message middleware is running normally. For example, whether it can normally send the message queue may refer to the availability of the message middleware. Then, the sending priority of the message queue is determined according to the current state, and finally, the above message queue is sent through the message middleware according to the sending priority.
[0114] It should be noted that the preferred implementation schemes involved in the above embodiments of the present application are the same as the schemes, application scenarios, and implementation processes provided in Embodiment 1, but are not limited to the schemes provided in Embodiment 1.
[0115] Embodiment 3
[0116] According to an embodiment of the present application, there is also provided a message sending method. It should be noted that the steps shown in the flowchart of the accompanying drawings may be executed in a computer system such as a set of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than here.
[0117] Figure 9 is a flowchart of a message sending method shown according to an embodiment of the present application. As Figure 9 shown, the method may include the following steps:
[0118] Step S902: Obtain multiple message queues received by at least one message middleware by calling the first interface.
[0119] Among them, the first interface includes a first parameter, and the parameter value of the first parameter includes the message queue.
[0120] The above-mentioned first interface may refer to an interface for obtaining message queues.
[0121] In an alternative solution of this embodiment, when sending a message queue, the message sending system may first obtain the first parameter by calling the above-mentioned first interface, that is, obtain multiple message queues received by at least one message middleware.
[0122] Step S904: Determine the current status of at least one message middleware.
[0123] Among them, the current status includes at least one of the following: connection status and running status. The connection status is used to represent whether the message middleware and the client are connected normally, and the running status is used to represent whether the message middleware is running normally;
[0124] The above-mentioned current status may refer to a status that can reflect the availability and reachability of the message middleware. The current status of the message middleware may include: connection status and / or running status. Among them, the connection status may refer to whether the connection between the message middleware and the client is normal. For example, whether the client can stably send the message queue to the message queue, which may refer to the reachability of the message middleware; the running status may refer to whether the message middleware is running normally. For example, whether it can normally send the message queue, which may refer to the availability of the message middleware.
[0125] After obtaining multiple message queues, the message sending system can determine the current status of the message middleware currently used to forward the message queue, that is, whether the communication between the message middleware and the client is smooth, whether the message middleware can stably send the message queue, etc.
[0126] Step S906: Determine the sending priority of multiple message queues based on the current status of at least one message middleware.
[0127] In an alternative solution of this embodiment, considering that the message queue is forwarded by the message middleware, and since the current states of different message middleware may be different, and the current state can reflect whether different message middleware can stably and efficiently send the received message queue. If the message queue is sent using the message middleware corresponding to the message queue in a random order or in the order of receiving the message queue, the situation of low stability and low efficiency of sending the message queue using the message middleware may occur. For example, if message queue A is preferentially sent currently, and the sending ability of message middleware A corresponding to message queue A is unstable, such as the reachability of the message middleware is low. At this time, the message sending system may continuously send message queue A multiple times using message middleware A, resulting in other message queues, such as message queue B, message queue C, etc., being unable to enter the message sending state all the time, thereby affecting the entire message queue sending process, and the stability and efficiency of the message sending system using the message middleware to send the message queue are low. Therefore, in order to improve the stability and efficiency of using the message middleware to send the message queue, the message sending system can first determine the sending order of different message queues, that is, determine the sending priorities of multiple message queues. For example, preferentially send the message queues received by the message middleware with higher stability, and then send the message queues received by the message middleware with lower stability. Considering that the current state of the message middleware obtained above can effectively reflect whether the message middleware can stably and smoothly send the received message queue, therefore, the message sending system can determine the sending priorities of the multiple received message queues according to the current state of at least one obtained message middleware.
[0128] Step S908, use at least one message middleware to send multiple message queues to the target client according to the sending priorities.
[0129] In an alternative solution of this embodiment, after determining the sending priorities of different message queues, the message sending system can use the corresponding message middleware to send the above-mentioned multiple message queues according to the sending priorities. For example, preferentially use the message middleware corresponding to the message queue with a higher sending priority to send the message queue, and then use the message middleware corresponding to the message queue with a lower sending priority to send the message queue, so as to ensure that the message queue can be sent out smoothly and stably.
[0130] Step S910, output the sending result of the message queue by calling the second interface.
[0131] Among them, the second interface includes a second parameter, and the parameter value of the second parameter includes the sending result.
[0132] The above-mentioned second interface may refer to an interface for outputting the sending result.
[0133] In an alternative solution of this embodiment, when sending a message queue using a message middleware, the message sending system can also obtain the sending result of the message queue in real time by calling the above-mentioned second interface, so as to facilitate the user to view the sending situation of the message queue.
[0134] Embodiment 4
[0135] According to an embodiment of the present application, there is also provided a message sending device for implementing the above message sending method. Figure 10 is a structural block diagram of a message sending device shown according to an embodiment of the present application, as Figure 10 shown, the device includes: a first message queue obtaining module 1002, a first current state determining module 1004, a first sending priority determining module 1006, and a first message queue sending module 1008.
[0136] Among them, the first message queue obtaining module 1002 is used to obtain a plurality of message queues received by at least one message middleware; the first current state determining module 1004 is used to determine the current state of at least one message middleware, where the current state includes at least one of the following: a connection state and an operating state, the connection state is used to represent whether the message middleware and the client are normally connected, and the operating state is used to represent whether the message middleware is operating normally; the first sending priority determining module 1006 is used to determine the sending priority of a plurality of message queues based on the current state of at least one message middleware; the first message queue sending module 1008 is used to send a plurality of message queues to a target client using at least one message middleware according to the sending priority.
[0137] In an embodiment of the present application, the first sending priority determining module 1006 includes: a message queue screening unit, which is used to screen the remaining multiple message queues after being screened by the previous queue selector based on the current state through at least one serially connected queue selector to obtain the queue selection result of at least one queue selector; a sending priority determining unit, which is used to determine the sending priority of a plurality of message queues based on the connection order and the queue selection result of at least one queue selector.
[0138] In an embodiment of the present application, the message queue screening unit is further used to: determine the selector identifier of the queue selector, determine the target state matching the selector identifier from the current state; obtain the queue screening condition matching the selector identifier; and store the message queue received by the message middleware corresponding to the target state into the queue selection result when the target state meets the queue screening condition match.
[0139] In the embodiment of the present application, the transmission priority determination unit is further configured to: determine the transmission priority of the message queues included in the queue selection result based on the connection order of at least one queue selector; determine that the transmission priority of the target message queue in the multiple message queues is a preset priority, where the target message queue is used to represent the message queues in the multiple message queues that are not included in the queue selection result, and the preset priority is lower than the transmission priority of the message queues included in the queue selection result.
[0140] In the embodiment of the present application, at least one queue selector includes a first queue selector, a second queue selector, a third queue selector, and a fourth queue selector connected in series. Among them, the message queue screening unit is further configured to: screen multiple message queues through the first queue selector based on the connection state and the running state to obtain the queue selection result of the first queue selector; screen multiple message queues through the second queue selector based on the running state to obtain the queue selection result of the second queue selector; screen multiple message queues through the third queue selector based on the connection state to obtain the queue selection result of the third queue selector; add the target message queue in the multiple message queues to the queue selection result of the fourth queue selector through the fourth queue selector, where the target message queue is used to represent the message queues in the multiple message queues that are not included in the queue selection result of the first queue selector, the queue selection result of the second queue selector, and the queue selection result of the third queue selector.
[0141] In the embodiment of the present application, the transmission priority determination unit is further configured to: determine that the transmission priority of the message queues included in the queue selection result of the first queue selector is the first priority; determine that the transmission priority of the message queues included in the queue selection result of the second queue selector is the second priority, where the first priority is greater than the second priority; determine that the transmission priority of the message queues included in the queue selection result of the third queue selector is the third priority, where the second priority is greater than the third priority; determine that the transmission priority of the message queues included in the queue selection result of the fourth queue selector is the fourth priority, where the third priority is greater than the fourth priority.
[0142] In the embodiment of the present application, the above device further includes: a selector output module, configured to output at least one queue selector on the interaction interface in the client; a selector adjustment module, configured to, in response to detecting an adjustment operation for adjusting at least one queue selector on the interaction interface, adjust at least one queue selector based on the adjustment operation to obtain an adjusted queue selector; a message queue screening module, configured to screen multiple message queues through the adjusted queue selector based on the current state to obtain the queue selection result of the adjusted queue selector.
[0143] In an embodiment of the present application, the above device further includes: a message sending module, configured to send a probe message to a message middleware according to a preset period; a result obtaining module, configured to obtain a response time and a response result of the message middleware in response to the probe message; a status determining module, configured to determine the current status of the message middleware based on the response time and the response result.
[0144] In an embodiment of the present application, the status determining module includes: a connection status determining unit, configured to determine the connection status of the message middleware based on the response result; an operating status determining unit, configured to determine the operating status of the message middleware based on the response time.
[0145] In an embodiment of the present application, the connection status determining unit is further configured to: when the response result is that the message middleware successfully responds to the probe message, determine that the connection status is that the message middleware and the client are normally connected; when the response result is that the message middleware fails to respond to the probe message, determine that the connection status is that the message middleware and the client are abnormally connected.
[0146] In an embodiment of the present application, the operating status determining unit is further configured to: when the response time is less than or equal to a preset time threshold, determine that the operating status is that the message middleware is operating normally; when the response time is greater than the preset time threshold, determine that the operating status is that the message middleware is operating abnormally.
[0147] In an embodiment of the present application, the above device further includes: a first storage module, configured to, in response to the operating status being that the message middleware is operating normally, store the operating status and the connection status into a middleware status table based on the middleware identifier of the message middleware, where the middleware status table is deployed in the client; a second storage module, configured to, in response to the operating status being that the message middleware is operating abnormally, obtain a first time node when it is detected that the message middleware is operating abnormally, and a second time node when it will operate normally next time, and store the operating status, the first time node, the second time node, and the connection status into the middleware status table based on the middleware identifier.
[0148] In an embodiment of the present application, the above-mentioned apparatus further includes: a middleware acquisition module, configured to update the running state of the message middleware to abnormal when the message queue sending fails, and acquire other message middleware based on the middleware status table, where the current state of the other message middleware is that the other message middleware is normally connected to the client and / or the other message middleware is running normally; a first sending module, configured to send the message queue to the other message middleware in response to successfully acquiring the other message middleware; a second sending module, configured to re-determine the current state of the message middleware at a preset period in response to failing to acquire the other message middleware, and send the message queue to the target message middleware when it is determined that the current state of the target message middleware is that the target message middleware is normally connected to the client and / or the target message middleware is running normally.
[0149] It should be noted here that the above-mentioned first message queue acquisition module 1002, the first current state determination module 1004, the first sending priority determination module 1006, and the first message queue sending module 1008 correspond to steps S402 to S408 in Embodiment 1. The implementation examples and application scenarios of the four modules and the corresponding steps are the same, but are not limited to the content disclosed in the above-mentioned Embodiment 1. It should be noted that the above-mentioned module or unit may be a hardware component or a software component stored in a memory (for example, memory 104) and processed by one or more processors (for example, processors 102a, 102b,..., 102n), and the above-mentioned module may also be a part of the apparatus and can run in the computer terminal 10 provided in Embodiment 1.
[0150] It should be noted that the preferred implementation schemes involved in the above-mentioned embodiments of the present application are the same as the schemes, application scenarios, and implementation processes provided in Embodiment 1, but are not limited to the schemes provided in Embodiment 1.
[0151] Embodiment 5
[0152] According to an embodiment of the present application, there is also provided a message sending apparatus for implementing the above-mentioned message sending method. Figure 11 It is a structural block diagram of a message sending apparatus shown according to an embodiment of the present application, as Figure 11 shown, the apparatus includes: a first display module 1102 and a second display module 1104.
[0153] Among them, the first display module 1102 is configured to respond to an input instruction acting on the operation interface and display, on the operation interface, a plurality of message queues received by at least one message middleware; the second display module 1104 is configured to respond to a sending instruction acting on the operation interface and display, on the operation interface, a sending result of the message queue, where the sending result is used to represent a result of sending the plurality of message queues according to a sending priority based on at least one message middleware, and the sending priority is determined based on a current state of at least one message middleware, and the current state includes at least one of the following: a connection state and an operating state, the connection state is used to represent whether the message middleware and the client are normally connected, and the operating state is used to represent whether the message middleware is operating normally.
[0154] It should be noted here that the above first display module 1102 and second display module 1104 correspond to steps S802 to S804 in Embodiment 2. The instances and application scenarios implemented by the two modules and the corresponding steps are the same, but are not limited to the content disclosed in the above Embodiment 1. It should be noted that the above modules or units may be hardware components or software components stored in a memory (for example, memory 104) and processed by one or more processors (for example, processors 102a, 102b,..., 102n), and the above modules may also be part of a device and may run in the computer terminal 10 provided in Embodiment 1.
[0155] It should be noted that the preferred implementation schemes involved in the above embodiments of the present application are the same as the schemes, application scenarios, and implementation processes provided in Embodiment 1, but are not limited to the schemes provided in Embodiment 1.
[0156] Embodiment 6
[0157] According to an embodiment of the present application, there is also provided a message sending device for implementing the above message sending method. Figure 12 It is a structural block diagram of a message sending device shown according to an embodiment of the present application, as Figure 12 shown. The device includes: a second message queue obtaining module 1202, a second current state determining module 1204, a second sending priority determining module 1206, a second message queue sending module 1208, and a sending result output module 1210.
[0158] Among them, the second message queue acquisition module 1202 is configured to acquire a plurality of message queues received by at least one message middleware by invoking a first interface, where the first interface includes a first parameter, and the parameter value of the first parameter includes a message queue; the second current state determination module 1204 is configured to determine the current state of at least one message middleware, where the current state includes at least one of the following: a connection state and an operating state, the connection state is used to characterize whether the message middleware and the client are normally connected, and the operating state is used to characterize whether the message middleware is operating normally; the second transmission priority determination module 1206 is configured to determine the transmission priorities of the plurality of message queues based on the current state of at least one message middleware; the second message queue transmission module 1208 is configured to use at least one message middleware to transmit the plurality of message queues to a target client according to the transmission priorities; the transmission result output module 1210 is configured to output the transmission result of the message queue by invoking a second interface, where the second interface includes a second parameter, and the parameter value of the second parameter includes a transmission result.
[0159] It should be noted here that the above-mentioned second message queue acquisition module 1202, second current state determination module 1204, second transmission priority determination module 1206, second message queue transmission module 1208, and transmission result output module 1210 correspond to steps S902 to S910 in Embodiment 3. The instances and application scenarios implemented by the five modules and the corresponding steps are the same, but are not limited to the content disclosed in the above-mentioned Embodiment 1. It should be noted that the above modules or units may be hardware components or software components stored in a memory (for example, memory 104) and processed by one or more processors (for example, processors 102a, 102b,..., 102n). The above modules may also be part of a device and may run in the computer terminal 10 provided in Embodiment 1.
[0160] It should be noted that the preferred implementation schemes involved in the above embodiments of the present application are the same as the schemes, application scenarios, and implementation processes provided in Embodiment 1, but are not limited to the schemes provided in Embodiment 1.
[0161] Embodiment 7
[0162] An embodiment of the present application may provide an electronic device, and the electronic device may be any one of the electronic devices in an electronic device group. Optionally, in this embodiment, the above-mentioned electronic device may also be replaced with a terminal device such as a mobile terminal.
[0163] Optionally, in this embodiment, the above-mentioned electronic device may be located in at least one of a plurality of network devices in a computer network.
[0164] In this embodiment, the above electronic device may execute the program code of the following steps in the message sending method: obtaining a plurality of message queues received by at least one message middleware; determining the current state of at least one message middleware, where the current state includes at least one of the following: connection state and running state, the connection state is used to characterize whether the message middleware and the client are normally connected, and the running state is used to characterize whether the message middleware is running normally; determining the sending priorities of the plurality of message queues based on the current state of at least one message middleware; and using at least one message middleware to send the plurality of message queues to the target client according to the sending priorities.
[0165] Optionally, Figure 13 It is a structural block diagram of an electronic device shown according to an embodiment of the present application. As shown in the figure, the electronic device A may include: one or more (only one is shown in the figure) processors 1302, a memory 1304, a storage controller, and a peripheral interface, where the peripheral interface is connected to a radio frequency module, an audio module, and a display.
[0166] Among them, the memory can be used to store software programs and modules, such as the program instructions / modules corresponding to the message sending method and device in the embodiment of the present application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, that is, implements the above message sending method. The memory may include a high-speed random access memory, and may further include a non-volatile memory, such as one or more magnetic storage devices, flash memories, or other non-volatile solid-state memories. In some instances, the memory may further include a memory remotely set relative to the processor, and these remote memories can be connected to the terminal A through a network. Examples of the above network include but are not limited to the Internet, an enterprise intranet, a local area network, a mobile communication network, and combinations thereof.
[0167] The processor can call the information and application programs stored in the memory through a transmission device to execute the following steps: determining the sending priorities of the plurality of message queues based on the current state of at least one message middleware, including: screening the remaining plurality of message queues after being screened by the previous queue selector based on the current state through at least one series-connected queue selector to obtain the queue selection result of at least one queue selector; and determining the sending priorities of the plurality of message queues based on the connection order and queue selection result of at least one queue selector.
[0168] Optionally, the above-mentioned processor may also execute the program code of the following steps: Based on the current state, at least one serially-connected queue selector filters the multiple message queues remaining after being filtered by the previous queue selector, to obtain the queue selection result of at least one queue selector, including: determining the selector identifier of the queue selector, and determining the target state matching the selector identifier from the current state; obtaining the queue filtering condition matching the selector identifier; when the target state meets the queue filtering condition and the matching is successful, storing the message queues received by the message middleware corresponding to the target state into the queue selection result.
[0169] Optionally, the above-mentioned processor may also execute the program code of the following steps: Based on the connection order and queue selection result of at least one queue selector, determine the sending priorities of multiple message queues, including: based on the connection order of at least one queue selector, determine the sending priorities of the message queues included in the queue selection result; determine that the sending priority of the target message queue in the multiple message queues is the preset priority, where the target message queue is used to represent the message queues in the multiple message queues that are not included in the queue selection result, and the preset priority is lower than the sending priorities of the message queues included in the queue selection result.
[0170] Optionally, the above-mentioned processor may also execute the program code of the following steps: At least one queue selector includes a first queue selector, a second queue selector, a third queue selector, and a fourth queue selector connected in series. Among them, based on the current state, at least one serially-connected queue selector filters the multiple message queues remaining after being filtered by the previous queue selector, to obtain the queue selection result of at least one queue selector, including: filtering the multiple message queues by the first queue selector based on the connection state and the running state, to obtain the queue selection result of the first queue selector; filtering the multiple message queues by the second queue selector based on the running state, to obtain the queue selection result of the second queue selector; filtering the multiple message queues by the third queue selector based on the connection state, to obtain the queue selection result of the third queue selector; adding the target message queue in the multiple message queues to the queue selection result of the fourth queue selector by the fourth queue selector, where the target message queue is used to represent the message queues in the multiple message queues that are not included in the queue selection result of the first queue selector, the queue selection result of the second queue selector, and the queue selection result of the third queue selector.
[0171] Optionally, the above-mentioned processor may also execute the program code of the following steps: Based on the connection order and queue selection results of at least one queue selector, determine the sending priorities of multiple message queues, including: determining the sending priority of the message queue included in the queue selection result of the first queue selector as the first priority; determining the sending priority of the message queue included in the queue selection result of the second queue selector as the second priority, where the first priority is greater than the second priority; determining the sending priority of the message queue included in the queue selection result of the third queue selector as the third priority, where the second priority is greater than the third priority; determining the sending priority of the message queue included in the queue selection result of the fourth queue selector as the fourth priority, where the third priority is greater than the fourth priority.
[0172] Optionally, the above-mentioned processor may also execute the program code of the following steps: The above method further includes: outputting at least one queue selector on the interaction interface in the client; in response to detecting an adjustment operation for adjusting at least one queue selector on the interaction interface, adjusting at least one queue selector based on the adjustment operation to obtain an adjusted queue selector; screening multiple message queues based on the current state through the adjusted queue selector to obtain the queue selection result of the adjusted queue selector.
[0173] Optionally, the above-mentioned processor may also execute the program code of the following steps: The above method further includes: sending a probe message to the message middleware at a preset period; obtaining the response time and response result of the message middleware in response to the probe message; determining the current state of the message middleware based on the response time and response result.
[0174] Optionally, the above-mentioned processor may also execute the program code of the following steps: Determining the current state of the message middleware based on the response time and response result includes: determining the connection state of the message middleware based on the response result; determining the running state of the message middleware based on the response time.
[0175] Optionally, the above-mentioned processor may also execute the program code of the following steps: Determining the connection state of the message middleware based on the response result includes: in the case where the response result is that the message middleware successfully responds to the probe message, determining that the connection state is that the message middleware and the client are normally connected; in the case where the response result is that the message middleware fails to respond to the probe message, determining that the connection state is that the message middleware and the client are abnormally connected.
[0176] Optionally, the above-mentioned processor may also execute the program code of the following steps: determining the running state of the message middleware based on the response time, including: when the response time is less than or equal to the preset time threshold, determining that the running state is that the message middleware is running normally; when the response time is greater than the preset time threshold, determining that the running state is that the message middleware is running abnormally.
[0177] Optionally, the above-mentioned processor may also execute the program code of the following steps: the above method further includes: in response to the running state being that the message middleware is running normally, storing the running state and the connection state into the middleware state table based on the middleware identifier of the message middleware, where the middleware state table is deployed in the client; in response to the running state being that the message middleware is running abnormally, obtaining the first time node when it is detected that the message middleware is running abnormally and the second time node when it runs normally next time, and storing the running state, the first time node, the second time node and the connection state into the middleware state table based on the middleware identifier.
[0178] Optionally, the above-mentioned processor may also execute the program code of the following steps: the above method further includes: in response to the failure of the message queue to be sent, updating the running state of the message middleware to be that the message middleware is running abnormally, and obtaining other message middleware based on the middleware state table, where the current state of the other message middleware is that the other message middleware is connected to the client normally and / or the other message middleware is running normally; in response to successfully obtaining other message middleware, sending the message queue to the other message middleware; in response to the failure to obtain other message middleware, re-determining the current state of the message middleware according to the preset period, and when it is determined that the current state of the target message middleware is that the target message middleware is connected to the client normally and / or the target message middleware is running normally, sending the message queue to the target message middleware.
[0179] In the embodiment of the present application, by adopting the method of obtaining multiple message queues received by at least one message middleware; determining the current state of at least one message middleware; determining the sending priority of the multiple message queues based on the current state of at least one message middleware; and using at least one message middleware to send the multiple message queues to the target client according to the sending priority, by determining the sending priority of the multiple message queues according to the current state of the message middleware corresponding to the message queue, the rationality of the determined order of sending the message queues is improved, and the situation that the sending of other message queues is relatively low due to the relatively poor current state of a certain message middleware, resulting in a long time consumption when using this message middleware to send the message queue, is avoided, thereby improving the efficiency of the message sending system to send the message queue through the message middleware, and further solving the technical problem of low efficiency of sending the message queue in the related art.
[0180] Those of ordinary skill in the art can understand that the structure shown in the figure is only schematic, and the electronic device can also be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a personal digital assistant, and terminal devices such as Mobile Internet Devices (MID), PAD, etc. Figure 13 It does not limit the structure of the above-mentioned electronic device. For example, the electronic device A may further include more or fewer components (such as a network interface, a display device, etc.) than those shown Figure 13 in the figure, or have a different configuration from that shown Figure 13 in the figure.
[0181] Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the relevant hardware of the terminal device through a program, and the program can be stored in a computer-readable storage medium. The storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disc, etc.
[0182] Embodiment 8
[0183] An embodiment of the present application further provides a storage medium. Optionally, in this embodiment, the above storage medium can be used to save the program code executed by the message sending method provided in the first embodiment above.
[0184] Optionally, in this embodiment, the above storage medium may be located in any one of the computer terminals in the computer terminal group in the computer network, or in any one of the mobile terminals in the mobile terminal group.
[0185] Optionally, in this embodiment, the storage medium is set to store program code for performing the following steps: obtaining a plurality of message queues received by at least one message middleware; determining the current state of at least one message middleware, where the current state includes at least one of the following: a connection state and an operating state, the connection state is used to characterize whether the message middleware and the client are normally connected, and the operating state is used to characterize whether the message middleware is operating normally; determining the sending priorities of the plurality of message queues based on the current state of at least one message middleware; and sending the plurality of message queues to the target client according to the sending priorities by using at least one message middleware.
[0186] Optionally, the storage medium is configured to store program code for performing the following steps: determining the sending priorities of multiple message queues based on the current state of at least one message middleware, including: screening the multiple message queues remaining after being screened by the previous queue selector based on the current state by at least one serially-connected queue selector to obtain the queue selection result of at least one queue selector; determining the sending priorities of the multiple message queues based on the connection order and the queue selection result of at least one queue selector.
[0187] Optionally, the storage medium is configured to store program code for performing the following steps: screening the multiple message queues remaining after being screened by the previous queue selector based on the current state by at least one serially-connected queue selector to obtain the queue selection result of at least one queue selector, including: determining the selector identifier of the queue selector, determining the target state matching the selector identifier from the current state; obtaining the queue screening condition matching the selector identifier; storing the message queues received by the message middleware corresponding to the target state into the queue selection result when the target state meets the queue screening condition successfully.
[0188] Optionally, the storage medium is configured to store program code for performing the following steps: determining the sending priorities of multiple message queues based on the connection order and the queue selection result of at least one queue selector, including: determining the sending priorities of the message queues included in the queue selection result based on the connection order of at least one queue selector; determining the sending priority of the target message queue in the multiple message queues as the preset priority, where the target message queue is used to represent the message queues in the multiple message queues that are not included in the queue selection result, and the preset priority is lower than the sending priorities of the message queues included in the queue selection result.
[0189] Optionally, the storage medium is configured to store program code for performing the following steps: at least one queue selector includes a first queue selector, a second queue selector, a third queue selector, and a fourth queue selector connected in series, wherein, based on the current state, the at least one queue selector connected in series filters a plurality of message queues remaining after being filtered by the previous queue selector to obtain a queue selection result of the at least one queue selector, including: filtering the plurality of message queues by the first queue selector based on the connection state and the running state to obtain a queue selection result of the first queue selector; filtering the plurality of message queues by the second queue selector based on the running state to obtain a queue selection result of the second queue selector; filtering the plurality of message queues by the third queue selector based on the connection state to obtain a queue selection result of the third queue selector; adding a target message queue in the plurality of message queues to the queue selection result of the fourth queue selector by the fourth queue selector, wherein the target message queue is used to represent the message queues in the plurality of message queues that are not included in the queue selection result of the first queue selector, the queue selection result of the second queue selector, and the queue selection result of the third queue selector.
[0190] Optionally, the storage medium is configured to store program code for performing the following steps: determining the transmission priorities of the plurality of message queues based on the connection order and the queue selection result of at least one queue selector, including: determining that the transmission priority of the message queues included in the queue selection result of the first queue selector is the first priority; determining that the transmission priority of the message queues included in the queue selection result of the second queue selector is the second priority, wherein the first priority is greater than the second priority; determining that the transmission priority of the message queues included in the queue selection result of the third queue selector is the third priority, wherein the second priority is greater than the third priority; determining that the transmission priority of the message queues included in the queue selection result of the fourth queue selector is the fourth priority, wherein the third priority is greater than the fourth priority.
[0191] Optionally, the storage medium is configured to store program code for performing the following steps: the above method further includes: outputting at least one queue selector on an interaction interface in the client; in response to detecting an adjustment operation for adjusting at least one queue selector on the interaction interface, adjusting at least one queue selector based on the adjustment operation to obtain an adjusted queue selector; filtering the plurality of message queues by the adjusted queue selector based on the current state to obtain a queue selection result of the adjusted queue selector.
[0192] Optionally, the storage medium is configured to store program code for performing the following steps: The above method further includes: sending a probe message to the message middleware according to a preset period; obtaining the response time and response result of the message middleware in response to the probe message; and determining the current state of the message middleware based on the response time and response result.
[0193] Optionally, the storage medium is configured to store program code for performing the following steps: Determining the current state of the message middleware based on the response time and response result includes: determining the connection state of the message middleware based on the response result; and determining the running state of the message middleware based on the response time.
[0194] Optionally, the storage medium is configured to store program code for performing the following steps: Determining the connection state of the message middleware based on the response result includes: when the response result is that the message middleware successfully responds to the probe message, determining that the connection state is that the message middleware and the client are normally connected; when the response result is that the message middleware fails to respond to the probe message, determining that the connection state is that the message middleware and the client are abnormally connected.
[0195] Optionally, the storage medium is configured to store program code for performing the following steps: Determining the running state of the message middleware based on the response time includes: when the response time is less than or equal to a preset time threshold, determining that the running state is that the message middleware is running normally; when the response time is greater than the preset time threshold, determining that the running state is that the message middleware is running abnormally.
[0196] Optionally, the storage medium is configured to store program code for performing the following steps: The above method further includes: in response to the running state being that the message middleware is running normally, storing the running state and the connection state into the middleware state table based on the middleware identifier of the message middleware, where the middleware state table is deployed in the client; in response to the running state being that the message middleware is running abnormally, obtaining the first time node when the message middleware running abnormally is detected, and the second time node when it runs normally next time, and storing the running state, the first time node, the second time node, and the connection state into the middleware state table based on the middleware identifier.
[0197] Optionally, the storage medium is configured to store program code for performing the following steps: The above method further includes: in response to the failure of sending a message queue, updating the running state of the message middleware to abnormal message middleware operation, and obtaining other message middleware based on the middleware status table, where the current state of the other message middleware is that the other message middleware and the client are connected normally, and / or the other message middleware is running normally; in response to successfully obtaining other message middleware, sending the message queue to the other message middleware; in response to the failure of obtaining other message middleware, re-determining the current state of the message middleware at a preset period, and when it is determined that there is a target message middleware whose current state is that the target message middleware and the client are connected normally, and / or the target message middleware is running normally, sending the message queue to the target message middleware.
[0198] In the embodiments of the present application, the method includes obtaining a plurality of message queues received by at least one message middleware; determining the current state of the at least one message middleware; determining the sending priority of the plurality of message queues based on the current state of the at least one message middleware; and using the at least one message middleware to send the plurality of message queues to the target client according to the sending priority. By determining the sending priority of the plurality of message queues according to the current state of the message middleware corresponding to the message queue, the rationality of the determined order of sending the message queues is improved, and the situation that the sending of other message queues is relatively low due to the relatively poor current state of a certain message middleware, resulting in a long time consumption when using the message middleware to send the message queue, is avoided. Therefore, the efficiency of the message sending system for sending message queues through the message middleware is improved, and the technical problem of low efficiency of sending message queues in the related art is solved.
[0199] The serial numbers of the embodiments of the present application above are only for description and do not represent the advantages or disadvantages of the embodiments.
[0200] In several embodiments provided by the present application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only illustrative. For example, the division of units is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection between each other can be through some interfaces, and the indirect coupling or communication connection of units or modules can be in an electrical or other form.
[0201] The unit described as a separation component may or may not be physically separated. The component shown as a unit may or may not be a physical unit, that is, it may be located in one place or may be distributed over multiple network units. Some or all of these units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0202] In addition, each functional unit in various embodiments of the present application may be integrated in a processing unit, may exist separately as individual physical units, or two or more units may be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
[0203] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or all or part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods in various embodiments of the present application. The foregoing storage medium includes: USB flash drives, read-only memories (ROMs), random access memories (RAMs), mobile hard disks, magnetic disks, or optical discs and other various media that can store program codes.
[0204] The above are only the preferred embodiments of the present application. It should be noted that for those of ordinary skill in the art, without departing from the principle of the present application, several improvements and refinements can be made, and these improvements and refinements should also be regarded as the protection scope of the present application.
Claims
1. A message sending method, characterized in that, The method includes: Obtaining a plurality of message queues received by at least one message middleware; Determining the current state of the at least one message middleware, where the current state includes at least one of the following: a connection state and an operating state, the connection state is used to characterize whether the message middleware and the client are normally connected, and the operating state is used to characterize whether the message middleware is operating normally; Determining the sending priorities of the plurality of message queues based on the current state of the at least one message middleware; Using the at least one message middleware to send the plurality of message queues to a target client according to the sending priorities.
2. The method according to claim 1, wherein Determining the sending priorities of the plurality of message queues based on the current state of the at least one message middleware includes: Filtering the plurality of message queues remaining after being filtered by the previous queue selector based on the current state through at least one serially connected queue selector to obtain the queue selection result of the at least one queue selector; Determining the sending priorities of the plurality of message queues based on the connection order and the queue selection result of the at least one queue selector.
3. The method according to claim 2, wherein Filtering the plurality of message queues remaining after being filtered by the previous queue selector based on the current state through at least one serially connected queue selector to obtain the queue selection result of the at least one queue selector includes: Determining the selector identifier of the queue selector, and determining a target state matching the selector identifier from the current state; Obtaining a queue filtering condition matching the selector identifier; When the target state meets the queue filtering condition, storing the message queues received by the message middleware corresponding to the target state into the queue selection result.
4. The method according to claim 2, wherein Determining the sending priorities of the plurality of message queues based on the connection order and the queue selection result of the at least one queue selector includes: Determining the sending priorities of the message queues included in the queue selection result based on the connection order of the at least one queue selector; Determining that the sending priority of a target message queue in the plurality of message queues is a preset priority, where the target message queue is used to characterize the message queues in the plurality of message queues that are not included in the queue selection result, and the preset priority is lower than the sending priorities of the message queues included in the queue selection result.
5. The method according to claim 2, wherein The at least one queue selector includes a first queue selector, a second queue selector, a third queue selector, and a fourth queue selector connected in series. Wherein, filtering the plurality of message queues remaining after being filtered by the previous queue selector based on the current state through at least one serially connected queue selector to obtain the queue selection result of the at least one queue selector includes: Filtering the plurality of message queues through the first queue selector based on the connection state and the operating state to obtain the queue selection result of the first queue selector; Filtering the plurality of message queues through the second queue selector based on the operating state to obtain the queue selection result of the second queue selector; Screen the multiple message queues based on the connection status through the third queue selector to obtain the queue selection result of the third queue selector; Add the target message queue in the multiple message queues to the queue selection result of the fourth queue selector through the fourth queue selector, where the target message queue is used to represent the message queue in the multiple message queues that is not included in the queue selection result of the first queue selector, the queue selection result of the second queue selector, and the queue selection result of the third queue selector.
6. The method according to claim 5, wherein Determine the sending priorities of the multiple message queues based on the connection order and queue selection results of the at least one queue selector, including: Determine that the sending priority of the message queue included in the queue selection result of the first queue selector is the first priority; Determine that the sending priority of the message queue included in the queue selection result of the second queue selector is the second priority, where the first priority is greater than the second priority; Determine that the sending priority of the message queue included in the queue selection result of the third queue selector is the third priority, where the second priority is greater than the third priority; Determine that the sending priority of the message queue included in the queue selection result of the fourth queue selector is the fourth priority, where the third priority is greater than the fourth priority.
7. The method according to claim 2, characterized in that, The method further includes: Output the at least one queue selector on the interaction interface in the client; In response to detecting an adjustment operation for adjusting the at least one queue selector in the interaction interface, adjust the at least one queue selector based on the adjustment operation to obtain an adjusted queue selector; Screen the multiple message queues based on the current state through the adjusted queue selector to obtain the queue selection result of the adjusted queue selector.
8. The method according to claim 1, characterized in that, The method further includes: Send a probe message to the message middleware at a preset period; Obtain the response time and response result of the message middleware in response to the probe message; Determine the current state of the message middleware based on the response time and the response result.
9. The method according to claim 8, wherein Determine the current state of the message middleware based on the response time and the response result, including: Determine the connection state of the message middleware based on the response result; Determine the running state of the message middleware based on the response time.
10. The method according to claim 9, wherein Determine the connection state of the message middleware based on the response result, including: When the response result is that the message middleware successfully responds to the probe message, determine that the connection state is that the message middleware and the client are normally connected; When the response result is that the message middleware does not successfully respond to the probe message, determine that the connection state is that the message middleware and the client are abnormally connected.
11. The method according to claim 9, characterized in that Determine the running state of the message middleware based on the response time, including: When the response time is less than or equal to a preset time threshold, determine that the running state is that the message middleware is running normally; In the case where the response time is greater than a preset time threshold, determine that the operating state is that the message middleware is operating abnormally.
12. The method according to claim 9, wherein The method further includes: In response to the operating state being that the message middleware is operating normally, based on the middleware identifier of the message middleware, store the operating state and the connection state in a middleware state table, where the middleware state table is deployed in the client; In response to the operating state being that the message middleware is operating abnormally, obtain a first time node when the message middleware is detected to be operating abnormally and a second time node when it operates normally next time, and based on the middleware identifier, store the operating state, the first time node, the second time node, and the connection state in the middleware state table.
13. The method according to claim 1, wherein The method further includes: In response to the message queue sending failing, update the operating state of the message middleware to be that the message middleware is operating abnormally, and obtain other message middleware based on the middleware state table, where the current state of the other message middleware is that the other message middleware is connected to the client normally and / or the other message middleware is operating normally; In response to successfully obtaining the other message middleware, send the message queue to the other message middleware; In response to failing to obtain the other message middleware, re-determine the current state of the message middleware at a preset period, and in the case where it is determined that the current state of a target message middleware is that the target message middleware is connected to the client normally and / or the target message middleware is operating normally, send the message queue to the target message middleware.
14. A message sending method, characterized in that, Includes: In response to an input instruction acting on the operation interface, display a plurality of message queues received by at least one message middleware on the operation interface; In response to a sending instruction acting on the operation interface, display the sending result of the message queue on the operation interface, where the sending result is used to represent the result of sending the plurality of message queues according to the sending priority based on the at least one message middleware, the sending priority is determined based on the current state of the at least one message middleware, and the current state includes at least one of the following: the connection state and the operating state, the connection state is used to represent whether the message middleware is connected to the client normally, and the operating state is used to represent whether the message middleware is operating normally.
15. A message sending method, characterized in that, Includes: Obtain a plurality of message queues received by at least one message middleware by calling a first interface, where the first interface includes a first parameter, and the parameter value of the first parameter includes the message queue; Determine the current state of the at least one message middleware, where the current state includes at least one of the following: the connection state and the operating state, the connection state is used to represent whether the message middleware is connected to the client normally, and the operating state is used to represent whether the message middleware is operating normally; Based on the current state of the at least one message middleware, determine the sending priority of the plurality of message queues; Sending the multiple message queues to a target client according to the sending priority by using the at least one message middleware; Outputting a sending result of the message queue by calling a second interface, where the second interface includes a second parameter, and a parameter value of the second parameter includes the sending result.
16. An electronic device, characterized in that, Comprising: A memory storing an executable program; A processor configured to run the program, where when the program runs, it executes the method according to any one of claims 1 to 15.
17. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored executable program, where when the executable program runs, it controls a device where the computer-readable storage medium is located to execute the method according to any one of claims 1 to 15.