Disclosure of Invention
The application provides a message pushing method which is used for solving the problem of high development cost in the prior art.
According to an aspect of the present application, there is provided a message pushing method, the method including:
receiving a message pushing request of a message sending end, and acquiring a message template matched with the message pushing request;
determining a target message to be pushed, a message channel and a message receiving end according to the message template;
inquiring the connection state of the message receiving end, and pushing the target message to the message receiving end through the message channel when the connection state of the message receiving end is determined to be an on-line state.
In one possible implementation manner, before the receiving the message push request of the message sending end, the method includes:
acquiring a connection request sent by a message sending end;
Authenticating a message sending end based on the connection request;
And when the authentication is passed, the connection state of the message sending end is an on-line state.
In one possible implementation, the message push request includes a message type;
The message template matched with the message pushing request is obtained, which comprises the following steps:
and matching to obtain a message template according to the message type and the label of the message sending end.
In another possible implementation manner, after the querying the connection state of the message receiving end, the method includes:
When the connection state of the message receiving end is determined to be an offline state, storing the target message into a task queue to be pushed;
inquiring the connection state of the message receiving end after a preset time interval, acquiring a target message from a task queue to be pushed when the connection state of the message receiving end is determined to be an on-line state, and pushing the target message to the message receiving end.
In yet another possible implementation manner, before the receiving the message push request of the message sending end, the method includes:
acquiring a preset message type, and a message channel, a message source and a message destination matched with the message type;
a message template is generated based on the message type, the message channel, the message source, and the message destination.
In another possible implementation manner, the determining the target message to be pushed, the message channel and the message receiving end according to the message template includes:
Analyzing according to the message module to obtain a message type, a message channel, a message source and a message destination;
Generating a target message to be pushed based on at least one of a message type, a message channel, a message source and a message destination;
and determining that the message goes to the corresponding message receiving end.
In another possible implementation manner, after pushing the target message to the message receiving end through the message channel, the method includes:
and storing the target message into a preset pushing task queue.
According to another aspect of an embodiment of the present application, there is provided a message pushing apparatus, including:
The receiving module is used for receiving the message pushing request of the message sending end and acquiring a message template matched with the message pushing request;
the determining module is used for determining a target message to be pushed, a message channel and a message receiving end according to the message template;
And the pushing module is used for inquiring the connection state of the message receiving end, and pushing the target message to the message receiving end through the message channel when the connection state of the message receiving end is determined to be an on-line state.
In another possible implementation manner, the receiving module is configured to, before receiving a message push request from a message sender:
acquiring a connection request sent by a message sending end;
Authenticating a message sending end based on the connection request;
And when the authentication is passed, the connection state of the message sending end is an on-line state.
In another possible implementation, the message push request includes a message type;
the receiving module is used for, when obtaining the message template matched with the message pushing request:
and matching to obtain a message template according to the message type and the label of the message sending end.
In another possible implementation manner, the pushing module is configured to, after querying a connection state of a message receiving end:
When the connection state of the message receiving end is determined to be an offline state, storing the target message into a task queue to be pushed;
inquiring the connection state of the message receiving end after a preset time interval, acquiring a target message from a task queue to be pushed when the connection state of the message receiving end is determined to be an on-line state, and pushing the target message to the message receiving end.
In another possible implementation manner, the receiving module is configured to, before receiving a message push request from a message sender:
acquiring a preset message type, and a message channel, a message source and a message destination matched with the message type;
a message template is generated based on the message type, the message channel, the message source, and the message destination.
In another possible implementation manner, the determining module is configured to, when determining the target message to be pushed, the message channel, and the message receiving end according to the message template:
Analyzing according to the message module to obtain a message type, a message channel, a message source and a message destination;
Generating a target message to be pushed based on at least one of a message type, a message channel, a message source and a message destination;
and determining that the message goes to the corresponding message receiving end.
In another possible implementation manner, the pushing module is configured to, after pushing the target message to the message receiving end through the message channel:
and storing the target message into a preset pushing task queue.
According to another aspect of the present application there is provided an electronic device comprising a memory, a processor and a computer program stored on the memory, the processor executing the computer program to carry out the steps of the method of the first aspect of the present application.
According to a further aspect of the present application there is provided a computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of the method of the first aspect of the present application.
The technical scheme provided by the application has the beneficial effects that:
The message pushing method, the device, the electronic equipment and the storage medium can be used for determining the target message to be pushed, the message channel and the message receiving end according to the message template by acquiring the message template matched with the message pushing request, then inquiring the connection state of the message receiving end, and pushing the target message to the message receiving end through the message channel when the connection state of the message receiving end is determined to be an on-line state. According to the embodiment of the application, the message to be pushed and the pushing channel and pushing destination message receiving end of the message sending end can be determined based on the message template by integrating the message channels, and the communication between the multi-channel multi-terminal or service end (namely the message sending end and the message receiving end) can be realized by integrating the message components.
Detailed Description
Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. It should be understood that the description is only exemplary and is not intended to limit the scope of the present disclosure. In addition, in the following description, descriptions of well-known structures and techniques are omitted so as not to unnecessarily obscure the concepts of the present disclosure.
Various structural schematic diagrams according to embodiments of the present disclosure are shown in the drawings. The figures are not drawn to scale, wherein certain details are exaggerated for clarity of presentation and may have been omitted. The shapes of the various regions, layers and relative sizes, positional relationships between them shown in the drawings are merely exemplary, may in practice deviate due to manufacturing tolerances or technical limitations, and one skilled in the art may additionally design regions/layers having different shapes, sizes, relative positions as actually required.
In the context of the present disclosure, when a layer/element is referred to as being "on" another layer/element, it can be directly on the other layer/element or intervening layers/elements may be present therebetween. In addition, if one layer/element is located "on" another layer/element in one orientation, that layer/element may be located "under" the other layer/element when the orientation is turned.
In the Internet of vehicles project, various scenes needing message pushing, such as vehicle abnormal reminding, holiday blessing, intelligent recommendation, handcart interconnection and the like, are available, but because various pushing types are different, and a sending end and a receiving end of the message pushing are different (a host factory, a third party, a vehicle machine, a mobile phone and the like), each end needs to select and integrate different technical components according to actual scenes, and the problem of high development cost is caused.
Based on the technical problems, the method comprises the steps of obtaining a message template matched with a message pushing request, determining a target message to be pushed, a message channel and a message receiving end according to the message template, inquiring the connection state of the message receiving end, and pushing the target message to the message receiving end through the message channel when the connection state of the message receiving end is determined to be an on-line state. According to the embodiment of the application, the message to be pushed and the pushing channel and the pushing destination message receiving end of the message sending end can be determined based on the message template by integrating the message channels, and the communication between the multi-channel multi-terminal or service end (namely the message sending end and the message receiving end) can be realized through integrating various message components.
The following describes the technical scheme of the present application and how the technical scheme of the present application solves the above technical problems in detail with specific embodiments. The following embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments. Embodiments of the present application will be described below with reference to the accompanying drawings.
The embodiment of the application provides a message pushing method, as shown in fig. 1, which can be applied to a message center of an internet of vehicles server, and comprises the following steps:
S101, receiving a message pushing request of a message sending end, and acquiring a message template matched with the message pushing request.
S102, determining a target message to be pushed, a message channel and a message receiving end according to the message template.
The message channels may include, among other things, push-to-pole, MQTT (Message Queuing Telemetry Transport, message queue telemetry transport), webSocket (protocol for full duplex communication over a single TCP connection), and the like.
In particular, the message components required for each message channel may be integrated into a message center so that the message center may communicate with a message sender or a message receiver via different message channels.
S103, inquiring the connection state of the message receiving end, and pushing the target message to the message receiving end through the message channel when the connection state of the message receiving end is determined to be an on-line state.
Specifically, the target message may be sent to the message receiving end through the message channel in an asynchronous communication manner.
The embodiment of the application acquires the message template matched with the message pushing request, then determines the target message to be pushed, the message channel and the message receiving end according to the message template, then inquires the connection state of the message receiving end, and pushes the target message to the message receiving end through the message channel when the connection state of the message receiving end is determined to be an on-line state. According to the embodiment of the application, the message to be pushed and the pushing channel and the pushing destination message receiving end of the message sending end can be determined based on the message template by integrating the message channels, and the communication between the multi-channel multi-terminal or service end (namely the message sending end and the message receiving end) can be realized through integrating various message components.
The embodiment of the application provides a possible implementation manner, before receiving the message push request of the message sending end, the method comprises the following steps:
s201, obtaining a connection request sent by a message sending end.
And S202, authenticating the message sending end based on the connection request, and when the authentication is passed, the connection state of the message sending end is an on-line state. And when the authentication is not passed, returning a reminder that the connection is impossible.
Specifically, the client or the server can report information of the message center by using a secret key according to the actually used message channel, or establish interfaces (as required) such as the channel and the like to realize connection of the message center, and can receive or send push messages after successful connection.
Optionally, unlike the prior art that the message sending end is respectively connected with each message manufacturer and each message component, the message sending end in the application can conveniently provide various types of capability of receiving and sending messages only by being connected and corresponding to the message center, thereby effectively saving the learning and development cost of a developer.
The embodiment of the application provides a possible implementation manner, wherein the message pushing request comprises a message type;
The message template matched with the message pushing request is obtained, which comprises the following steps:
and matching to obtain a message template according to the message type and the label of the message sending end.
The message type may be a corresponding message push scenario, such as a vehicle abnormality alert, a maintenance alert, a flow threshold alert, a vehicle condition, and the like.
The embodiment of the application provides a possible implementation manner, after the connection state of the message receiving end is queried, the method comprises the following steps:
S301, when the connection state of the message receiving end is determined to be an offline state, the target message is stored in a task queue to be pushed.
S302, inquiring the connection state of the message receiving end after a preset time interval, and when the connection state of the message receiving end is determined to be an on-line state, acquiring a target message from a task queue to be pushed, and pushing the target message to the message receiving end.
The embodiment of the application provides a possible implementation manner, before receiving the message push request of the message sending end, the method comprises the following steps:
s401, acquiring a preset message type, a message channel matched with the message type, a message source and a message destination;
S402, generating a message template based on the message type, the message channel, the message source and the message destination.
The message source is a message sending end, and the message is sent to a message receiving end.
Specifically, the message templates may further include different message attributes, for example, when the message templates are message templates for pushing messages to the vehicle owner application by the third party system through a push channel, the message attributes may be supporting configuration message titles, content (supporting placeholder configuration) and custom messages, and when the message templates are vehicle condition information of the vehicle APP pushed to the vehicle owner mobile phone by the vehicle owner system through WebSocket, the message attributes may be configured as custom transparent messages.
The embodiment of the application can realize personalized customization and management of the message content by configuring various message templates, and can effectively improve the user experience.
The embodiment of the application provides a possible implementation manner, which determines a target message to be pushed, a message channel and a message receiving end according to a message template, and comprises the following steps:
S501, analyzing according to a message module to obtain a message type, a message channel, a message source and a message destination;
s502, generating a target message to be pushed based on at least one of a message type, a message channel, a message source and a message destination;
s503, determining the message to the corresponding message receiving end.
The embodiment of the application provides a possible implementation manner, after pushing the target message to the message receiving end through the message channel, the method comprises the following steps:
and storing the target message into a preset pushing task queue.
In other embodiments, after the target message is pushed to the message receiving end through the message channel, the message receiving end may return a push success notification to the message center after receiving the target message, and the message center may also store the push success notification in the push task queue, so as to implement management of a full life cycle of the message, and provide technical support for developers.
Specifically, the message center can record the push record of each message channel through the push task queue or the statistical report, so that the vehicle health degree of the user can be conveniently analyzed, and the user experience is further improved.
For a better understanding of the above message pushing method, an example of the message pushing method of the present application is described in detail below with reference to fig. 2, and the method includes the following steps:
S601, a message sending end sends a message pushing request to a message center.
Wherein the message push request includes a message type.
S602, the message center obtains a message template by matching according to the message type and the label of the message sending end.
The message type may be a corresponding message push scenario, such as a vehicle abnormality alert, a maintenance alert, a flow threshold alert, a vehicle condition, and the like.
S603, the message center determines a target message to be pushed, a message channel and a message receiving end according to the message template.
The message channels may include, among other things, push-to-pole, MQTT (Message Queuing Telemetry Transport, message queue telemetry transport), webSocket (protocol for full duplex communication over a single TCP connection), and the like.
In particular, the message components required for each message channel may be integrated into a message center so that the message center may communicate with a message sender or a message receiver via different message channels.
S604, the message center inquires the connection state of the message receiving end, and when the connection state of the message receiving end is determined to be an on-line state, the target message is pushed to the message receiving end in an asynchronous communication mode through the message channel.
The embodiment of the application provides a message pushing device, as shown in fig. 3, the message pushing device 30 may include a receiving module 301, a determining module 302 and a pushing module 303;
The receiving module 301 is configured to receive a message pushing request of a message sending end, and obtain a message template matched with the message pushing request;
the determining module 302 is configured to determine a target message to be pushed, a message channel, and a message receiving end according to the message template;
and the pushing module 303 is configured to query a connection state of the message receiving end, and push the target message to the message receiving end through the message channel when determining that the connection state of the message receiving end is an online state.
In an embodiment of the present application, a possible implementation manner is provided, where before receiving a message push request from a message sending end, the receiving module 301 is configured to:
acquiring a connection request sent by a message sending end;
Authenticating a message sending end based on the connection request;
And when the authentication is passed, the connection state of the message sending end is an on-line state.
The embodiment of the application provides a possible implementation manner, wherein the message pushing request comprises a message type;
The receiving module 301 is configured to, when acquiring a message template matched with the message pushing request:
and matching to obtain a message template according to the message type and the label of the message sending end.
In an embodiment of the present application, a possible implementation manner is provided, where the pushing module 303 is configured to, after querying a connection state of a message receiving end:
When the connection state of the message receiving end is determined to be an offline state, storing the target message into a task queue to be pushed;
inquiring the connection state of the message receiving end after a preset time interval, acquiring a target message from a task queue to be pushed when the connection state of the message receiving end is determined to be an on-line state, and pushing the target message to the message receiving end.
In an embodiment of the present application, a possible implementation manner is provided, where before receiving a message push request from a message sending end, the receiving module 301 is configured to:
acquiring a preset message type, and a message channel, a message source and a message destination matched with the message type;
a message template is generated based on the message type, the message channel, the message source, and the message destination.
In one possible implementation manner provided in the embodiment of the present application, the determining module 302 is configured to, when determining, according to a message template, a target message to be pushed, a message channel, and a message receiving end:
Analyzing according to the message module to obtain a message type, a message channel, a message source and a message destination;
Generating a target message to be pushed based on at least one of a message type, a message channel, a message source and a message destination;
and determining that the message goes to the corresponding message receiving end.
In one possible implementation manner provided in the embodiment of the present application, the pushing module 303 is configured to, after pushing the target message to the message receiving end through the message channel:
and storing the target message into a preset pushing task queue.
The device of the embodiment of the present application may perform the method provided by the embodiment of the present application, and its implementation principle is similar, and actions performed by each module in the device of the embodiment of the present application correspond to steps in the method of the embodiment of the present application, and detailed functional descriptions of each module of the device may be referred to the descriptions in the corresponding methods shown in the foregoing, which are not repeated herein.
The embodiment of the application acquires the message template matched with the message pushing request, then determines the target message to be pushed, the message channel and the message receiving end according to the message template, then inquires the connection state of the message receiving end, and pushes the target message to the message receiving end through the message channel when the connection state of the message receiving end is determined to be an on-line state. According to the embodiment of the application, the message to be pushed and the pushing channel and the pushing destination message receiving end of the message sending end can be determined based on the message template by integrating the message channels, and the communication between the multi-channel multi-terminal or service end (namely the message sending end and the message receiving end) can be realized through integrating various message components.
The embodiment of the application provides electronic equipment, which comprises a memory, a processor and a computer program stored on the memory, wherein the processor executes the computer program to realize the steps of a message pushing method; and then inquiring the connection state of the message receiving end, and pushing the target message to the message receiving end through the message channel when the connection state of the message receiving end is determined to be an on-line state. According to the embodiment of the application, the message to be pushed and the pushing channel and the pushing destination message receiving end of the message sending end can be determined based on the message template by integrating the message channels, and the communication between the multi-channel multi-terminal or service end (namely the message sending end and the message receiving end) can be realized through integrating various message components.
In an alternative embodiment, an electronic device is provided, as shown in FIG. 4, the electronic device 700 shown in FIG. 4 comprising a processor 701 and a memory 703. The processor 701 is coupled to a memory 703, such as via a bus 702. Optionally, the electronic device 700 may further comprise a transceiver 704, the transceiver 704 may be used for data interaction between the electronic device and other electronic devices, such as transmission of data and/or reception of data, etc. It should be noted that, in practical applications, the transceiver 704 is not limited to one, and the structure of the electronic device 700 is not limited to the embodiment of the present application.
The Processor 701 may be a CPU (Central Processing Unit ), general purpose Processor, DSP (DIGITAL SIGNAL Processor, data signal Processor), ASIC (Application SPECIFIC INTEGRATED Circuit), FPGA (Field Programmable GATE ARRAY ) or other programmable logic device, transistor logic device, hardware component, or any combination thereof. Which may implement or perform the various exemplary logic blocks, modules and circuits described in connection with this disclosure. The processor 701 may also be a combination that performs computing functions, such as including one or more microprocessors, a combination of a DSP and a microprocessor, or the like.
Bus 702 may include a path to transfer information between the components. Bus 702 may be a PCI (PERIPHERAL COMPONENT INTERCONNECT, peripheral component interconnect standard) bus, or an EISA (Extended Industry Standard Architecture ) bus, or the like. Bus 702 may be divided into an address bus, a data bus, a control bus, and the like. For ease of illustration, only one thick line is shown in fig. 4, but not only one bus or one type of bus.
The Memory 703 may be, but is not limited to, ROM (Read Only Memory) or other type of static storage device that can store static information and instructions, RAM (Random Access Memory ) or other type of dynamic storage device that can store information and instructions, EEPROM (ELECTRICALLY ERASABLE PROGRAMMABLE READ ONLY MEMORY ), CD-ROM (Compact Disc Read Only Memory, compact disc Read Only Memory) or other optical disk storage, optical disk storage (including compact discs, laser discs, optical discs, digital versatile discs, blu-ray discs, etc.), magnetic disk storage media, other magnetic storage devices, or any other medium that can be used to carry or store a computer program and that can be Read by a computer.
The memory 703 is used for storing a computer program for executing an embodiment of the present application and is controlled to be executed by the processor 701. The processor 701 is arranged to execute a computer program stored in the memory 703 for carrying out the steps shown in the foregoing method embodiments.
The electronic device includes, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a PAD, etc., and a stationary terminal such as a digital TV, a desktop computer, etc.
In an embodiment of the application, a computer-readable storage medium is provided, on which a computer program is stored, which computer program, when being executed by a processor, carries out the steps of the method according to the first aspect of the embodiment of the application.
In the above description, technical details such as patterning of each layer are not described in detail. Those skilled in the art will appreciate that layers, regions, etc. of the desired shape may be formed by a variety of techniques. In addition, to form the same structure, those skilled in the art can also devise methods that are not exactly the same as those described above. In addition, although the embodiments are described above separately, this does not mean that the measures in the embodiments cannot be used advantageously in combination.
The terms "first," "second," "third," "fourth," "1," "2," and the like in the description and in the claims and in the above figures, if any, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate, such that the embodiments of the application described herein may be implemented in other sequences than those illustrated or otherwise described.
It should be understood that, although various operation steps are indicated by arrows in the flowcharts of the embodiments of the present application, the order in which these steps are implemented is not limited to the order indicated by the arrows. In some implementations of embodiments of the application, the implementation steps in the flowcharts may be performed in other orders as desired, unless explicitly stated herein. Furthermore, some or all of the steps in the flowcharts may include multiple sub-steps or multiple stages based on the actual implementation scenario. Some or all of these sub-steps or phases may be performed at the same time, or each of these sub-steps or phases may be performed at different times, respectively. In the case of different execution time, the execution sequence of the sub-steps or stages can be flexibly configured according to the requirement, which is not limited by the embodiment of the present application.
The foregoing is merely an optional implementation manner of some of the implementation scenarios of the present application, and it should be noted that, for those skilled in the art, other similar implementation manners based on the technical ideas of the present application are adopted without departing from the technical ideas of the scheme of the present application, and the implementation manner is also within the protection scope of the embodiments of the present application.
While preferred embodiments of the present application have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. It is therefore intended that the following claims be interpreted as including the preferred embodiments and all such alterations and modifications as fall within the scope of the application.
It will be apparent to those skilled in the art that various modifications and variations can be made to the present application without departing from the spirit or scope of the application. Thus, it is intended that the present application also include such modifications and alterations insofar as they come within the scope of the appended claims or the equivalents thereof.