Disclosure of Invention
The present disclosure is mainly directed to provide a message processing method and device, so as to solve a problem that a third party IM server cannot store an instant messaging message for a long time.
In order to achieve the above object, according to a first aspect of the present disclosure, there is provided a message processing method, after a preset communication mode with an IM server is established, monitoring a notification message sent by the IM server; after receiving the notification message, capturing the IM message stored by the IM server in a preset mode; and after judging the type indicated by the IM message, storing the captured IM message according to a preset storage mode based on different types.
Optionally, after the preset communication mode with the IM server is established, monitoring the notification message sent by the IM server includes: and configuring a callback address to the IM server, so that after the user side establishes interactive communication with the IM server, a server indicated by the callback address monitors a notification message sent by the IM server.
Optionally, after the preset communication mode with the IM server is established, monitoring the notification message sent by the IM server includes: and configuring a callback address to the IM server, so that after the user side establishes interactive communication with the IM server, a server indicated by the callback address monitors a notification message sent by the IM server.
Optionally, after receiving the notification message, capturing the IM message stored by the IM server in a preset manner includes: and after receiving the notification message, capturing the IM message stored by the IM server based on the path indicated by the notification message.
Optionally, storing the captured content according to a preset storage manner includes: if the IM message is text information, storing the text information into a database; if the IM message is non-text information, the non-text information is unloaded in the file system.
Optionally, the method further comprises: in response to analyzing and counting the stored historical IM messages, recalling the non-text information in the file processing system to a database; and analyzing and counting the historical IM messages stored in the database so as to send the results obtained by analyzing and counting to a preset user side.
Optionally, the method further comprises: responding to the received historical IM message inquired by the target user terminal within the preset time, and inquiring the corresponding IM message from the database; and if the IM message comprises the non-text content, inquiring the non-text content corresponding to the IM message from the file system.
According to a second aspect of the present disclosure, there is provided a message processing apparatus including: the monitoring unit is configured to monitor the notification message sent by the IM server after a preset communication mode with the IM server is established; the grabbing unit is configured to grab the IM messages stored by the IM server in a preset mode after receiving the notification messages; and the storage unit is configured to store the captured IM message according to a preset storage mode based on different types after judging the type indicated by the IM message.
Optionally, the monitoring unit is further configured to include: and configuring a callback address to the IM server, so that after the user side establishes interactive communication with the IM server, a server indicated by the callback address monitors a notification message sent by the IM server.
According to a third aspect of the present disclosure, there is provided a computer-readable storage medium storing computer instructions for causing a computer to execute the message processing method according to any one of the embodiments of the first aspect.
According to a fourth aspect of the present disclosure, there is provided an electronic device comprising: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores a computer program executable by the at least one processor, the computer program being executable by the at least one processor to cause the at least one processor to perform the message processing method as described in any one of the embodiments of the first aspect.
In the embodiment of the disclosure, firstly, after a preset communication mode with an IM server is established, a notification message sent by the IM server is monitored; then, after receiving the notification message, capturing the IM message stored by the IM server in a preset mode; and finally, after judging the type indicated by the IM message, storing the captured IM message according to a preset storage mode based on different types. And storing the messages according to different content types by receiving the notification messages of the IM server. Therefore, the technical problem that the IM server does not store the message for a long time is solved.
Detailed Description
In order to make the technical solutions of the present disclosure better understood by those skilled in the art, the technical solutions of the embodiments of the present disclosure will be clearly and completely described below with reference to the drawings in the embodiments of the present disclosure, and it is obvious that the described embodiments are only some embodiments of the present disclosure, not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments disclosed herein without making any creative effort, shall fall within the protection scope of the present disclosure.
It should be noted that the terms "first," "second," and the like in the description and claims of the present disclosure and in the above-described drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It should be understood that the data so used may be interchanged under appropriate circumstances such that embodiments of the present disclosure may be described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It should be noted that, in the present disclosure, the embodiments and features of the embodiments may be combined with each other without conflict. The present disclosure will be described in detail below with reference to the accompanying drawings in conjunction with embodiments.
The system architecture for implementing the present embodiment may include a terminal device, a network 104, an IM server, and a server. The network serves as a medium for providing communication links between the terminal device and the IM server, between the IM server and the server, and between the server and the terminal device. The network may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The user can use the terminal equipment network to interact with the server so as to realize instant messaging. Various communication client applications, such as instant messaging tools, social platform software and the like, can be installed on the terminal device.
The terminal device may be various electronic devices having a display screen and supporting shopping applications, including but not limited to a smart phone, a tablet computer, an electronic book reader, an MP3 player (Moving Picture Experts Group Audio Layer III, mpeg compression standard Audio Layer 3), an MP4 player (Moving Picture Experts Group Audio Layer IV, mpeg compression standard Audio Layer 4), a laptop portable computer, a desktop computer, and the like.
The IM server may be a server that establishes instant messaging with the terminal device.
The server may be a server that provides various services, such as a processing server that establishes communication interactions with the IM server. The processing server can analyze and process the interactive information of the terminal equipment and the IM server, and sends the processing result to the preset terminal equipment.
It should be noted that the information processing method provided in the embodiment of the present application is generally executed by a server, and accordingly, a message processing apparatus is generally disposed in the server.
It should be understood that the number of end devices, networks, IM servers, and servers. There may be any number, as desired for implementation.
According to an embodiment of the present disclosure, there is provided a message processing method, as shown in fig. 1, the method includes thefollowing steps 101 to 103:
step 101: and after a preset communication mode with the IM server is established, monitoring a notification message sent by the IM server.
In the implementation, the user sides can initiate chat through the IM server, and then instant communication is realized through the SDK of the third-party IM server. Because the time for storing the chat records on the IM server is limited and historical chat records cannot be stored for a long time, when statistical analysis is needed to be carried out based on chat data, abundant data sources do not exist, and multi-dimensional analysis of targeted data cannot be further realized.
Specifically, the preset communication mode is used for triggering the server to monitor whether the IM server sends the notification message, and the preset communication mode may be a mode capable of realizing transmission of the chat message in real time in the instant communication process, or a mode capable of realizing transmission of the completed chat message after the instant communication. The notification message may be used to notify the server that the client side has established instant messaging with the IM server.
As an optional implementation manner of this embodiment, after establishing a preset communication manner with an IM server, monitoring a notification message sent by the IM server includes: and configuring a callback address to the IM server, so that after the user side establishes interactive communication with the IM server, a server indicated by the callback address monitors a notification message sent by the IM server.
In this embodiment, a callback address may be configured in advance to the IM server, where the callback address is used for the IM server to send a notification message to a server (or a server target location) indicated by the callback address.
Step 102: and after receiving the notification message, capturing the IM message stored by the IM server in a preset mode.
In this embodiment, after receiving the notification message, the server may grab the IM message stored by the IM server. The capturing mode may include, based on a path indicated in the notification message, acquiring, from the path, an IM message stored by the IM server by a preset data acquisition means.
As an optional implementation manner of this embodiment, after receiving the notification message, based on the path indicated by the notification message, the IM message stored by the IM server is captured.
Step 103: and after judging the type indicated by the IM message, storing the captured IM message according to a preset storage mode based on different types.
In this embodiment, after acquiring the IM message instep 102, the server may determine the type indicated by the IM message. The type includes a text type, such as a word. Non-text types such as pictures, video, voice, and files are also included.
As an optional implementation manner of this embodiment, based on different types, storing the captured content according to a preset storage manner includes: if the IM message is text information, storing the text information into a database; if the IM message is non-text information, the non-text information is unloaded in the file system.
In this optional implementation manner, after determining the type of the IM message, the text-type message may be directly stored in a database, for example, a mysql, redis, DB, or other database. If the type of the IM message is a non-text type, the message can be dumped to a file system.
As an optional implementation manner of this embodiment, in response to performing analysis statistics on stored historical IM messages, non-text information in the file processing system is recalled to the database; and analyzing and counting the historical IM messages stored in the database so as to send the results obtained by analyzing and counting to a preset user side.
In this optional implementation manner, if it is necessary to perform data analysis statistics by using an IM message, the pre-established data analysis system may obtain the IM message from the database, and because the IM message has non-text content, the non-text content in the file system is recalled to the database during the data analysis statistics, so that the data analysis system performs analysis processing directly based on data in the database. After the analysis processing, the result can be sent to a preset user side.
For example, the content of the house source service related to the chat information between two clients is limited in the time for storing the chat information by the IM server, but the transaction period of the house source service is long, and if statistics of the house source renting service is required based on the historical chat information (for example, analysis and statistics of which house source characteristics are included in a house source easy to rent), all the IM information needs to be acquired, so that a final analysis and statistics result can be obtained. Therefore, after the embodiment is adopted, the data analysis system can be utilized to call the message in the database, and the analysis processing can be carried out based on the called message. And sending the analyzed and counted result to a preset user side.
As an optional implementation manner of this embodiment, the method further includes: responding to the received historical IM message inquired by the target user terminal within the preset time, and inquiring the corresponding IM message from the database; and if the IM message comprises the non-text content, inquiring the non-text content corresponding to the IM message from the file system.
In the optional implementation mode, the history chat records can be checked at any time by storing the history messages for a long time, so that the technical problem that the IM server cannot store the messages for a long time is solved.
From the above description, it can be seen that the present disclosure achieves the following technical effects: the method can realize the long-term storage of the instant messaging messages, and can analyze and count according to a target strategy based on the historical IM messages to obtain a target result.
It should be noted that the steps illustrated in the flowcharts of the figures may be performed in a computer system such as a set of computer-executable instructions and that, although a logical order is illustrated in the flowcharts, in some cases, the steps illustrated or described may be performed in an order different than presented herein.
According to an embodiment of the present disclosure, there is also provided an apparatus for implementing the message processing method, as shown in fig. 2, the apparatus includes: the monitoringunit 201 is configured to monitor a notification message sent by an IM server after a preset communication mode with the IM server is established; a fetchingunit 202, configured to fetch, after receiving the notification message, an IM message stored by the IM server in a preset manner; thestorage unit 203 is configured to store the captured IM message according to a preset storage manner based on different types after judging the type indicated by the IM message.
As an optional implementation manner of this embodiment, the monitoring unit is further configured to include: and configuring a callback address to the IM server, so that after the user side establishes interactive communication with the IM server, a server indicated by the callback address monitors a notification message sent by the IM server.
The embodiment of the present disclosure provides an electronic device, as shown in fig. 3, the electronic device includes one ormore processors 31 and amemory 32, where oneprocessor 31 is taken as an example in fig. 3.
The controller may further include: aninput device 33 and anoutput device 34.
Theprocessor 31, thememory 32, theinput device 33 and theoutput device 34 may be connected by a bus or other means, and fig. 3 illustrates the connection by a bus as an example.
Theprocessor 31 may be a Central Processing Unit (CPU). Theprocessor 31 may also be other general purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or combinations thereof. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
Thememory 32, which is a non-transitory computer readable storage medium, may be used to store non-transitory software programs, non-transitory computer executable programs, and modules, such as program instructions/modules corresponding to the control methods in the embodiments of the present disclosure. Theprocessor 31 executes various functional applications of the server and data processing, i.e. implements the message processing method of the above-described method embodiment, by running non-transitory software programs, instructions and modules stored in thememory 32.
Thememory 32 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to use of a processing device operated by the server, and the like. Further, thememory 32 may include high speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid state storage device. In some embodiments, thememory 32 may optionally include memory located remotely from theprocessor 31, which may be connected to a network connection device via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
Theinput device 33 may receive input numeric or character information and generate key signal inputs related to user settings and function control of the processing device of the server. Theoutput device 34 may include a display device such as a display screen.
One or more modules are stored in thememory 32, which when executed by the one ormore processors 31 perform the method as shown in fig. 1.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program to instruct related hardware, and the program can be stored in a computer readable storage medium, and when executed, the program can include the processes of the embodiments of the motor control methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-only memory (ROM), a Random Access Memory (RAM), a flash memory (FlashMemory), a hard disk (hard disk drive, abbreviated as HDD) or a Solid State Drive (SSD), etc.; the storage medium may also comprise a combination of memories of the kind described above.
Although the embodiments of the present disclosure have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present disclosure, and such modifications and variations fall within the scope defined by the appended claims.