CN107786623B - Message asynchronous processing method and device - Google Patents

Message asynchronous processing method and device Download PDF

Info

Publication number
CN107786623B
CN107786623B CN201610835127.4A CN201610835127A CN107786623B CN 107786623 B CN107786623 B CN 107786623B CN 201610835127 A CN201610835127 A CN 201610835127A CN 107786623 B CN107786623 B CN 107786623B
Authority
CN
China
Prior art keywords
message
message data
data
terminal
server
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201610835127.4A
Other languages
Chinese (zh)
Other versions
CN107786623A (en
Inventor
王博
李松林
吴凯
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN201610835127.4A priority Critical patent/CN107786623B/en
Publication of CN107786623A publication Critical patent/CN107786623A/en
Application granted granted Critical
Publication of CN107786623B publication Critical patent/CN107786623B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/566Grouping or aggregating service requests, e.g. for unified processing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/55Push-based network services
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/568Storing data temporarily at an intermediate stage, e.g. caching

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Mobile Radio Communication Systems (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention relates to a message asynchronous processing method and a device, wherein the method comprises the following steps: pulling message data; writing the message data into a cache, wherein the message data comprises message content and a terminal identifier, the terminal identifier corresponds to a user terminal, and the user terminal is connected with a first server; reading message data in a cache, and sending the read message data to a first server corresponding to a terminal identifier, so that the first server sends the message content to a client terminal corresponding to the terminal identifier, and returns corresponding state data; and receiving the state data, and mapping the message data and the corresponding state data to a database for storage. By adopting the method, the sending efficiency of the mass messages can be effectively improved.

Description

Message asynchronous processing method and device
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for asynchronous processing of a message.
Background
Currently, insurance gradually deepens into the daily life of people, and the insurance types are increasingly diversified. In order to make it easier for the client to know the insurance information, the insurance company will typically actively send various messages to the client. In a traditional manner, a background writes various messages to be sent into a database, reads the messages from the database, sends the messages to an operator server, and sends the messages to a user terminal through the operator server. Since reading and writing of each message takes a certain time, when the number of messages reaches the level of millions or even tens of millions, the traditional method inevitably causes the reduction of message sending efficiency. The technical problem to be solved at present is how to effectively improve the sending efficiency when a large amount of messages are faced.
Disclosure of Invention
Therefore, it is necessary to provide a message asynchronous processing method and device capable of effectively improving efficiency of sending massive messages, in order to solve the above technical problems.
A method of asynchronous processing of messages, the method comprising:
pulling message data;
writing the message data into a cache, wherein the message data comprises message content and a terminal identifier, the terminal identifier corresponds to a user terminal, and the user terminal is connected with a first server;
reading message data in a cache, and sending the read message data to a first server corresponding to a terminal identifier, so that the first server sends the message content to a client terminal corresponding to the terminal identifier, and returns corresponding state data;
and receiving the state data, and mapping the message data and the corresponding state data to a database for storage.
In one embodiment, the message data and the state data are associated by a primary key identifier, and the step of mapping the message data and the corresponding state data to a database for storage includes:
inquiring whether a main key identification corresponding to the state data exists in a database;
if yes, updating the state data in a database according to the primary key identification;
otherwise, mapping the message data and the state data to a database for storage according to the primary key identification.
In one embodiment, before the step of sending the read message data to the first server corresponding to the terminal identifier, the method further includes:
determining the priority corresponding to the message data according to the priority of the message template identifier;
dividing the message data into a plurality of queues according to the priority;
the step of sending the read message data to a first server corresponding to the terminal identifier includes:
and extracting the terminal identification in the message data, and sending the message contents in the queues to a first server corresponding to the terminal identification by adopting a plurality of threads according to the priority.
In one embodiment, the step of pulling the message data includes:
counting the terminal identification, and judging whether the accumulated quantity of the terminal identification in a first preset time is greater than a first preset quantity;
if yes, pulling a first preset number of message data according to the terminal identification, and refusing to pull the message data which is beyond the first preset number and corresponds to the terminal identification.
In one embodiment, the method further comprises:
if the message data exceeding a second preset amount is not sent within a second preset time, generating alarm information, and sending the alarm information to an operation terminal, wherein the operation terminal is used for remotely processing abnormal conditions, and the alarm information comprises an abnormal gateway;
and receiving a gateway switching instruction sent by the operating terminal, closing the abnormal gateway according to the gateway switching instruction, and switching to other gateways to process unsent message data.
An apparatus for asynchronous processing of messages, the apparatus comprising:
the acquisition module is used for pulling message data;
the data access module is used for writing the message data into a cache, wherein the message data comprises message content and a terminal identifier, the terminal identifier corresponds to a user terminal, and the user terminal is connected with a first server;
the data access module is also used for reading message data in the cache;
a sending module, configured to send the read message data to a first server corresponding to a terminal identifier, so that the first server sends the message content to a client terminal corresponding to the terminal identifier, and returns corresponding state data;
a receiving module for receiving the status data;
and the storage module is used for mapping the message data and the corresponding state data to a database for storage.
In one embodiment, the message data and the state data are associated through a primary key identifier, and the storage module is further configured to query whether the primary key identifier corresponding to the state data exists in the database; if yes, updating the state data in a database according to the primary key identification; otherwise, mapping the message data and the state data to a database for storage according to the primary key identification.
In one embodiment, the data access module is further configured to determine a priority corresponding to the message data according to the priority identified by the message template; dividing the message data into a plurality of queues according to the priority; the sending module is further configured to extract a terminal identifier in the message data, and send the message content in the plurality of queues to a first server corresponding to the terminal identifier according to the priority by using the plurality of threads.
In one embodiment, the obtaining module is further configured to count the terminal identifiers, and determine whether an accumulated number of the terminal identifiers in a first preset time is greater than a first preset number; if yes, pulling a first preset number of message data according to the terminal identification, and refusing to pull the message data which is beyond the first preset number and corresponds to the terminal identification.
In one embodiment, the sending module is further configured to generate alarm information and send the alarm information to an operating terminal if message data exceeding a second preset amount is not sent within a second preset time, where the operating terminal is configured to remotely handle an abnormal condition, and the alarm information includes an abnormal gateway; the receiving module is further configured to receive a gateway switching instruction sent by the operating terminal;
the device further comprises:
and the switching module is used for closing the abnormal gateway according to the gateway switching instruction and switching to other gateways to process unsent message data.
According to the message asynchronous processing method and device, after the message data are pulled, the message data are written into the cache, and then the message data are read from the cache. The read message data carries the message content and the terminal identification. And determining a corresponding first server according to the terminal identification, and sending the message data to the first server, so that the first server sends the message content to the user terminal corresponding to the terminal identification. Thereby enabling the user to learn about the message content. And after receiving the state data, mapping the message data and the corresponding state data to a database for storage. Because the read-write operation of the message data is performed through the cache instead of the database, the time consumption can be effectively reduced compared with the case that the message data is directly written into the database. And after the message data is sent, mapping the state data and the message data corresponding to the sending state to the data for storage. Therefore, the sending efficiency of the massive messages is effectively improved in an asynchronous processing mode.
Drawings
FIG. 1 is a diagram of an application environment of a method for asynchronous processing of messages in one embodiment;
FIG. 2 is a flow diagram of a method for asynchronous processing of messages in one embodiment;
FIG. 3 is a schematic diagram of a server in one embodiment;
FIG. 4 is a diagram showing the structure of an asynchronous message processing apparatus according to an embodiment;
fig. 5 is a schematic structural diagram of a message asynchronous processing device in yet another embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The message asynchronous processing method provided in the embodiment of the present invention may be applied to an application environment as shown in fig. 1. The second server 102 is connected to the backend server 104 via a network. The first server 106 is connected to the background server 104 via a network. The backend server 104 may pull the message data from the second server 102 by calling a data interface. Background server 104 writes the pulled message data to the cache instead of directly writing the message data to the database. The background server 104 determines the corresponding first server 106 according to the terminal identifier carried in the message data. The user terminal 108 corresponding to the terminal identification is connected to the first server 106 through the network. The background server 104 reads the message data in the cache, and sends the message data to the first server 106 corresponding to the terminal identifier. The first server 106 extracts the message content carried in the message data, and sends the message content to the user terminal 108 corresponding to the terminal identifier. After the message data is sent, the first server 106 returns status data to the backend server 104. The background server 104 receives the status data and keeps the message data and the corresponding status data mapping in the database. Since the read-write operation of the message data is performed through the buffer and not through the database, the message data is not stored in the database after being sent. Therefore, the sending efficiency of the massive messages is effectively improved in an asynchronous processing mode.
In an embodiment, as shown in fig. 2, a message asynchronous processing method is provided, which is described by taking an example that the method is applied to a background server, and specifically includes the following steps:
step 202, pull message data.
And 204, writing message data into a cache, wherein the message data comprises message content and a terminal identifier, the terminal identifier corresponds to the user terminal, and the user terminal is connected with the first server.
The background server is respectively connected with the second server and the first server through a network. The second server is a server adopted by each organization, and may be an independent server or a distributed server cluster. One database may be deployed on the second server, or a plurality of databases may be deployed. The second server opens a data interface to the background server. The background server may pull the message data from the second server by calling these data interfaces. For example, the backend server may pull the message data from the second server by calling an EJB (Enterprise java bean, a server-side component model) or HTTP (HyperText Transfer Protocol) interface. When the second server is configured with a plurality of databases, the background server synchronously pulls the message data from the plurality of databases by calling the data interface. The message data pulled by the background server from the second server may be massive.
The message data includes message content and a terminal identification. The terminal identification corresponds to the user terminal, and the user terminal is connected with the first server. The terminal identification can be a mobile phone number, an application program account or an electronic mailbox and the like. And the background server determines a corresponding first server according to the terminal identifier. When the terminal identification is a mobile phone number, the first server can be a first server; when the terminal is identified as the application account, the first server may be a server in which the application runs; when the terminal is identified as an email box, the first server may be an email box server.
In order to effectively improve the access efficiency of the mass message quantity, the background server writes the pulled message data into the cache instead of directly writing the message data into the database. The time consumption for writing the message data into the cache is lower than the time consumption for writing the message data into the database, so that the total time consumption for sending massive message data by the background server can be effectively reduced.
And step 206, reading the message data in the cache, sending the read message data to the first server corresponding to the terminal identification, so that the first server sends the message content to the client terminal corresponding to the terminal identification, and returns the corresponding state data.
And the background server reads the message data in the cache and sends the message data to the first server corresponding to the terminal identifier. And the first server receives the message data, extracts the message content and sends the message content to the client terminal corresponding to the terminal identification. Thereby enabling the client to learn about the message content. And after the first server sends the message content to the client terminal, acquiring state data corresponding to the sending state, and returning the state data to the background server.
And step 208, receiving the state data, and mapping the message data and the corresponding state data to a database for storage.
And the background server receives the state data returned by the first server and maps and holds the message data and the corresponding state data into the database.
In this embodiment, after the message data is pulled, the message data is written into the cache, and then the message data is read from the cache. The read message data carries the message content and the terminal identification. And determining a corresponding first server according to the terminal identification, and sending the message data to the first server, so that the first server sends the message content to the user terminal corresponding to the terminal identification. Thereby enabling the user to learn about the message content. And after receiving the state data returned by the first server, mapping the message data and the corresponding state data to a database for storage. Because the read-write operation of the message data is performed through the cache instead of the database, the time consumption can be effectively reduced compared with the case that the message data is directly written into the database. And after the message data is sent, mapping the state data and the message data corresponding to the sending state to the data for storage. Therefore, the sending efficiency of the massive messages is effectively improved in an asynchronous processing mode.
In one embodiment, the step of associating the message data with the state data through the primary key identifier, and the step of mapping the message data and the corresponding state data to the database for storage includes: inquiring whether a main key identification corresponding to the state data exists in a database; if the key exists, updating the state data in the database according to the primary key identification; otherwise, mapping the message data and the state data to a database for storage according to the primary key identification.
In this embodiment, the message data read by the background server further includes a primary key identifier. The state data returned by the first server to the background server also comprises the primary key identification. The primary key identification of the message data is identical to the primary key identification of the corresponding status data, thereby associating the message data with the status data through the primary key identification.
Since the speed of returning the state data to the background server by the first server is much faster than the speed of writing the message data into the database by the background server, if the state data and the message data are written into the database at the same time, the data loss is likely to be caused. In order to prevent the problem of data loss, the background server inquires whether the corresponding primary key identifier exists in the database when writing the state data into the database. If the primary key identification is inquired in the database, the message data is written into the database, and the background server can only update the corresponding state data in the database according to the primary key identification. If the primary key identification is not inquired, the message data is not written into the database, and the background server maps the short message data and the state data to the database for storage. Thereby ensuring that data written to the database is not lost.
In one embodiment, before the step of sending the read message data to the first server corresponding to the terminal identifier, the method further includes: acquiring a message template identifier corresponding to the message data, and determining the priority corresponding to the message data according to the priority of the message template identifier; dividing the message data into a plurality of queues according to the priority; the step of sending the read message data to a first server corresponding to the terminal identifier includes: and extracting a terminal identifier in the message data, and sending the message contents in the queues to a first server corresponding to the terminal identifier by adopting a plurality of threads according to the priority.
In this embodiment, different message templates are used for different message data. The backend server may set different priorities for different message templates. The message data generated by adopting the message template with high priority is correspondingly high in priority of asynchronous processing. The background server can obtain the message template identification corresponding to the message data, and obtain the priority of the asynchronously processed message data according to the priority of the message template identification. And the background server divides the message data into a plurality of queues according to the priority. Different queues correspond to different transmit channels and different threads. And the background server extracts the terminal identification from the message data, and respectively sends the message contents in the queues to the first server corresponding to the terminal identification through the multiple threads according to the priority and the sending channels corresponding to the queues. The message data with high priority is sent by the thread in priority. And for the message data with the same priority, the background server acquires the time for writing the message data into the cache and confirms the sending sequence according to the writing time. The message data written into the buffer firstly is sent firstly. The sending priority of the message data is confirmed according to the priority corresponding to the message template identification, and the message data is sent according to the priority in a form of a plurality of queues, so that the sending efficiency of the message data is effectively improved.
In one embodiment, the step of pulling the message data comprises: counting the terminal identifications, and judging whether the accumulated number of the terminal identifications in a first preset time is greater than a first preset number; if yes, pulling a first preset number of message data according to the terminal identification, and refusing to pull the message data which is corresponding to the terminal identification and exceeds the first preset number.
In this embodiment, when the background server calls the data interface to pull the message data of the second server, the terminal identifiers carried in the message data are counted. The background server may count the terminal identifier by using redis, and specifically, the background server may count the terminal identifier in a key-value manner. Wherein, key represents the terminal identifier, and value represents the accumulated number of the terminal identifier. To avoid unnecessary disturbance to the user, the backend server may control the frequency of sending message data. The background server judges whether the accumulated quantity corresponding to the terminal identification in the first preset time is larger than the first preset quantity, if so, the frequency of the message data sent to the terminal identification exceeds the set sending frequency, and therefore the message data corresponding to the terminal identification is not pulled continuously. The frequency of transmission of the messages may be set once a day, once a week, twice a week, etc. Different transmission frequencies can be set for messages of different service types. And when the accumulated quantity of the terminal identifications in the first preset time is larger than the first preset quantity, the background server pulls the message data of the first preset quantity in the second server according to the terminal identifications, and refuses to pull the message data which is corresponding to the terminal identifications and exceeds the first preset quantity. Therefore, the message data are limited to be frequently sent to the user by controlling the sending frequency of the message data, so that unnecessary disturbance to the user is avoided.
In one embodiment, the method further comprises: if the message data exceeding the second preset quantity is not sent within the second preset time, generating alarm information, and sending the alarm information to an operation terminal, wherein the operation terminal is used for remotely processing abnormal conditions, and the alarm information comprises an abnormal gateway; and receiving a gateway switching instruction sent by the operation terminal, closing the abnormal gateway according to the gateway switching instruction, and switching to other gateways to process unsent message data.
In this embodiment, the background server may obtain the corresponding gateway according to the terminal identifier, and send the message data to the first server through the gateway. When the terminal identification is a mobile phone number, the gateway can be an operator gateway; when the terminal identifier is an application program account, the gateway can be an application program gateway; when the terminal identifier is an email box, the gateway may be an email box gateway. In order to ensure that the message data can be sent in time, a plurality of gateways corresponding to the terminal identification can be provided, and the plurality of gateways can work simultaneously.
And when the message data exceeding the second preset quantity is not sent in the second time, the background server generates corresponding alarm information. The alarm information includes the gateway identifier of the abnormal gateway. And the background server sends the alarm information to the operation terminal. The warning information may be a short message, a network message, an email, or the like. The operation terminal is a terminal used by an operator, is used for remotely processing abnormal conditions, and can be a mobile phone, a computer or a tablet computer and the like.
After the operation terminal receives the warning information, an operator can send a gateway switching instruction to the background server through the operation terminal. The gateway switching instruction may include an abnormal gateway that is turned off and other gateways that are turned on and normally operate. And the background server closes the abnormal gateway according to the gateway switching instruction and switches to other gateways to process the message data which is not sent. When the alarm condition occurs, the operator can timely and effectively carry out remote processing without visiting the site, convenience is provided for the operator, and time is saved for processing abnormal conditions.
In addition, the operation terminal may also send a closing instruction of the abnormal gateway to the background server first, and the background server closes the abnormal gateway according to the closing instruction. And the operation terminal sends the opening instructions of other gateways to the background server, and the background server opens a gateway which normally works according to the gateway identification carried in the opening instruction. Thereby switching the message data which is not sent from the abnormal gateway to other gateways which work normally for processing. For example, if the operator sends S +9511 to the background server through the operator terminal, the background server stops the gateway 9511. And the operation terminal sends O +9512 to the background server, and then the background server starts the gateway 9522 and sends the overstocked short message by using the 9522.
In one embodiment, as shown in FIG. 3, a server 300 is provided that includes a processor 301, an internal memory 302, a non-volatile storage medium 303, and a network interface 304 connected by a system bus. The nonvolatile storage medium 303 of the server stores an operating system 3031 and a message asynchronous processing device 3032, and the message asynchronous processing device 3032 is used for effectively improving the efficiency of sending mass messages. The processor 301 of the server 300, which provides computing and control capabilities, is configured to perform a message asynchronous processing method. The server 300 may be a stand-alone server or a cluster server. Those skilled in the art will appreciate that the configuration shown in fig. 3 is a block diagram of only a portion of the configuration associated with the present application and does not constitute a limitation on the terminal to which the present application is applied, and that a particular terminal may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, as shown in fig. 4, there is provided a message asynchronous processing apparatus connected to a first server through a network, including: an obtaining module 402, a data accessing module 404, a sending module 406, a receiving module 408 and a saving module 410, wherein:
an obtaining module 402, configured to pull message data.
And a data access module 404, configured to write message data into the cache, where the message data includes message content and a terminal identifier, the terminal identifier corresponds to the user terminal, and the user terminal is connected to the first server.
The data access module 404 is also configured to read the message data in the cache.
A sending module 406, configured to send the read message data to the first server corresponding to the terminal identifier, so that the first server sends the message content to the client terminal corresponding to the terminal identifier, and returns corresponding status data.
A receiving module 408, configured to receive the status data.
The saving module 410 is configured to map the message data and the corresponding state data to a database for saving.
In one embodiment, the message data and the state data are associated through a primary key identifier, and the storage module 410 is further configured to query whether the database has the primary key identifier corresponding to the state data; if the key exists, updating the state data in the database according to the primary key identification; otherwise, mapping the message data and the state data to a database for storage according to the primary key identification.
In one embodiment, the data access module 404 is further configured to determine a priority corresponding to the message data according to the priority identified by the message template; dividing the message data into a plurality of queues according to the priority; the sending module 406 is further configured to extract a terminal identifier in the message data, and send the message content in the plurality of queues to the first server corresponding to the terminal identifier according to the priority by using a plurality of threads.
In an embodiment, the obtaining module 402 is further configured to count the terminal identifiers, and determine whether an accumulated number of the terminal identifiers in a first preset time is greater than a first preset number; if yes, pulling a first preset number of message data according to the terminal identification, and refusing to pull the message data which is corresponding to the terminal identification and exceeds the first preset number.
In an embodiment, the sending module 406 is further configured to generate an alarm message if the message data exceeding the second preset amount is not sent within the second preset time, and send the alarm message to an operating terminal, where the operating terminal is configured to remotely handle the abnormal condition, and the alarm message includes an abnormal gateway; the receiving module is also used for receiving a gateway switching instruction sent by the operation terminal; as shown in fig. 5, the apparatus further includes: and a switching module 412, configured to close the abnormal gateway according to the gateway switching instruction, and switch to another gateway to process the message data that is not sent.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above examples only show some embodiments of the present invention, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the inventive concept, which falls within the scope of the present invention. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (12)

1. A method of asynchronous processing of messages, the method comprising:
calling EJB data interfaces or HTTP data interfaces through the background server to synchronously pull message data from the plurality of second servers; the method comprises the following steps: counting the terminal identifications in the message data in a key-value mode, and judging whether the accumulated number of the terminal identifications in a first preset time is larger than a first preset number; if yes, pulling a first preset number of message data according to the terminal identification, and refusing to pull the message data which is beyond the first preset number and corresponds to the terminal identification; the messages of different service types correspond to different first preset time and first preset quantity; the second server is a server which is adopted by each mechanism and is provided with a database;
writing the message data into a cache through the background server, wherein the message data comprises message content and a terminal identifier, the terminal identifier corresponds to a user terminal, and the user terminal is connected with a first server;
reading message data in a cache through the background server, and sending the read message data to a first server corresponding to a terminal identifier, so that the first server sends the message content to a client terminal corresponding to the terminal identifier, and returns corresponding state data;
receiving the state data through the background server, and mapping the message data and the corresponding state data to a database for storage;
before the step of sending the read message data to the first server corresponding to the terminal identifier, the method further includes: determining the priority corresponding to the message data according to the priority of the message template identifier; dividing the message data into a plurality of queues according to the priority; different queues correspond to different sending channels and different threads; the step of sending the read message data to a first server corresponding to the terminal identifier includes:
extracting a terminal identifier in the message data through the background server, adopting a plurality of threads to send the message contents in a plurality of queues to a first server corresponding to the terminal identifier from high priority to low priority according to the priority of a message template corresponding to each message data; and for the message data with the same priority, sending the message data with the same priority to a first server corresponding to the terminal identifier through the background server according to the sequence from front to back of the time for writing the message data with the same priority into the cache.
2. The method of claim 1, wherein the message data and the state data are associated by a primary key identifier, and wherein the step of mapping the message data and the corresponding state data to a database for storage comprises:
inquiring whether a main key identification corresponding to the state data exists in a database;
if yes, updating the state data in a database according to the primary key identification;
otherwise, mapping the message data and the state data to a database for storage according to the primary key identification.
3. The method of claim 1, wherein the terminal identifier is a cell phone number, an application account number, or an email box.
4. The method of claim 1, further comprising:
if the message data exceeding a second preset amount is not sent within a second preset time, generating alarm information, and sending the alarm information to an operation terminal, wherein the operation terminal is used for remotely processing abnormal conditions, and the alarm information comprises an abnormal gateway;
and receiving a gateway switching instruction sent by the operating terminal, closing the abnormal gateway according to the gateway switching instruction, and switching to other gateways to process unsent message data.
5. The method of claim 4, wherein the alarm message is a short message, a network message, or an email.
6. An apparatus for asynchronous processing of messages, the apparatus comprising:
the acquisition module is used for calling EJB data interfaces or HTTP data interfaces through the background server to synchronously pull message data from the plurality of second servers; the method comprises the following steps: counting the terminal identifications in the message data in a key-value mode, and judging whether the accumulated number of the terminal identifications in a first preset time is larger than a first preset number; if yes, pulling a first preset number of message data according to the terminal identification, and refusing to pull the message data which is beyond the first preset number and corresponds to the terminal identification; the messages of different service types correspond to different first preset time and first preset quantity; the second server is a server which is adopted by each mechanism and is provided with a database;
the data access module is used for writing the message data into a cache through the background server, the message data comprises message content and a terminal identifier, the terminal identifier corresponds to a user terminal, and the user terminal is connected with the first server; determining the priority corresponding to the message data according to the priority of the message template identifier; dividing the message data into a plurality of queues according to the priority; different queues correspond to different sending channels and different threads; the data access module is also used for reading message data in the cache through the background server;
the sending module is used for sending the read message data to a first server corresponding to a terminal identifier through the background server so that the first server sends the message content to a client terminal corresponding to the terminal identifier and returns corresponding state data;
a receiving module for receiving the status data;
the storage module is used for mapping the message data and the corresponding state data to a database for storage;
the sending module is further configured to extract a terminal identifier in the message data through the background server, send each message data to a first server corresponding to the terminal identifier in an order from high priority to low priority according to the priority of a message template corresponding to each message data for message contents in a plurality of queues by using a plurality of threads; and for the message data with the same priority, sending the message data with the same priority to a first server corresponding to the terminal identifier through the background server according to the sequence from front to back of the time for writing the message data with the same priority into the cache.
7. The apparatus according to claim 6, wherein the message data and the status data are associated by a primary key identifier, and the storage module is further configured to query whether the primary key identifier corresponding to the status data exists in the database; if yes, updating the state data in a database according to the primary key identification; otherwise, mapping the message data and the state data to a database for storage according to the primary key identification.
8. The apparatus of claim 6, wherein the terminal identifier is a cell phone number, an application account number, or an email.
9. The apparatus according to claim 6, wherein the sending module is further configured to generate an alarm message if message data exceeding a second preset amount is not sent within a second preset time, and send the alarm message to an operating terminal, where the operating terminal is configured to remotely handle an abnormal condition, and the alarm message includes an abnormal gateway; the receiving module is further configured to receive a gateway switching instruction sent by the operating terminal;
the device further comprises:
and the switching module is used for closing the abnormal gateway according to the gateway switching instruction and switching to other gateways to process unsent message data.
10. The apparatus of claim 9, wherein the alarm message is a short message, a network message, or an email.
11. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor, when executing the computer program, implements the steps of the method of any of claims 1 to 5.
12. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 5.
CN201610835127.4A 2016-09-20 2016-09-20 Message asynchronous processing method and device Active CN107786623B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610835127.4A CN107786623B (en) 2016-09-20 2016-09-20 Message asynchronous processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610835127.4A CN107786623B (en) 2016-09-20 2016-09-20 Message asynchronous processing method and device

Publications (2)

Publication Number Publication Date
CN107786623A CN107786623A (en) 2018-03-09
CN107786623B true CN107786623B (en) 2021-03-30

Family

ID=61438181

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610835127.4A Active CN107786623B (en) 2016-09-20 2016-09-20 Message asynchronous processing method and device

Country Status (1)

Country Link
CN (1) CN107786623B (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108737292A (en) * 2018-04-18 2018-11-02 千寻位置网络有限公司 A kind of sending method and system, server of bulk messages
CN108900506A (en) * 2018-06-28 2018-11-27 江苏中威科技软件系统有限公司 Information push method, push server and transmission control protocol server
CN109656725B (en) * 2018-11-09 2019-12-27 北京字节跳动网络技术有限公司 Message consumer switching method and device, storage medium and electronic equipment
CN109743377A (en) * 2018-12-27 2019-05-10 杭州当虹科技股份有限公司 A kind of small documents read-write optimization method based on HTTP
CN110489484B (en) * 2019-07-11 2022-07-05 视联动力信息技术股份有限公司 Data synchronization method and device, readable storage medium and electronic equipment
CN113781133A (en) * 2020-06-22 2021-12-10 北京沃东天骏信息技术有限公司 Order data processing method and device
CN113572680A (en) * 2021-07-30 2021-10-29 康键信息技术(深圳)有限公司 Template message sending method, device, equipment and storage medium
CN116032417B (en) * 2021-10-25 2024-04-19 青岛海尔科技有限公司 Message processing method, terminal and server

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103246696A (en) * 2013-03-21 2013-08-14 宁波公众信息产业有限公司 High-concurrency database access method and method applied to multi-server system
GB201312560D0 (en) * 2013-07-12 2013-08-28 Canon Kk Methods and devices for exchanging data
CN103428076A (en) * 2013-08-22 2013-12-04 北京奇虎科技有限公司 Method and device for transmitting information to multi-type terminals or applications
CN103905504A (en) * 2012-12-27 2014-07-02 海尔集团公司 Information pushing method and system
CN104702481A (en) * 2013-12-06 2015-06-10 腾讯科技(北京)有限公司 System, method and device for achieving instant communication function in medium information of website
CN104753769A (en) * 2015-03-24 2015-07-01 新余兴邦信息产业有限公司 Method and device for issuing messages by message queue
CN105207881A (en) * 2014-06-10 2015-12-30 阿里巴巴集团控股有限公司 Message sending method and equipment
CN105847853A (en) * 2016-04-01 2016-08-10 深圳市创云方网络科技有限公司 Video content distribution method and device

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101227311B (en) * 2008-02-03 2010-12-01 腾讯科技(深圳)有限公司 System and method for publishing internet information
CN102567222A (en) * 2010-12-15 2012-07-11 北京兆易创新科技有限公司 Data access method and data access device
CN103188220B (en) * 2011-12-28 2016-07-06 中国移动通信集团北京有限公司 Message transmission system, method and device, data maintaining method and device
CN105306383B (en) * 2014-06-10 2019-11-19 腾讯科技(深圳)有限公司 The method for pushing and terminal and push server of a kind of message

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103905504A (en) * 2012-12-27 2014-07-02 海尔集团公司 Information pushing method and system
CN103246696A (en) * 2013-03-21 2013-08-14 宁波公众信息产业有限公司 High-concurrency database access method and method applied to multi-server system
GB201312560D0 (en) * 2013-07-12 2013-08-28 Canon Kk Methods and devices for exchanging data
CN103428076A (en) * 2013-08-22 2013-12-04 北京奇虎科技有限公司 Method and device for transmitting information to multi-type terminals or applications
CN104702481A (en) * 2013-12-06 2015-06-10 腾讯科技(北京)有限公司 System, method and device for achieving instant communication function in medium information of website
CN105207881A (en) * 2014-06-10 2015-12-30 阿里巴巴集团控股有限公司 Message sending method and equipment
CN104753769A (en) * 2015-03-24 2015-07-01 新余兴邦信息产业有限公司 Method and device for issuing messages by message queue
CN105847853A (en) * 2016-04-01 2016-08-10 深圳市创云方网络科技有限公司 Video content distribution method and device

Also Published As

Publication number Publication date
CN107786623A (en) 2018-03-09

Similar Documents

Publication Publication Date Title
CN107786623B (en) Message asynchronous processing method and device
KR102238205B1 (en) Apparatus and method for maintaining a message thread with opt-in permanence for entries
US8001150B2 (en) Device management method using nodes having additional attribute and device management client thereof
US8074230B2 (en) Method and system for dynamic context based contact service
CN109002424B (en) File format conversion method and device, computer equipment and storage medium
US8539509B2 (en) Event queue managing device and event queue managing method
TW201820903A (en) Method and device for processing chat log of real-time chat tool
CN109842621A (en) A kind of method and terminal reducing token storage quantity
CN101217449A (en) A remote call office procedure
CN114168297A (en) Method, device, equipment and medium for scheduling collection tasks
CN108763046A (en) Thread operation and monitoring method, device, computer equipment and storage medium
CN107948242A (en) More service number template message sending methods and system
CN103092663A (en) Method for installing application program in terminal and device
CN104065617B (en) A kind of harassing and wrecking email processing method, device and system
CN115801569B (en) Access rule deployment method, device, equipment, medium and cloud platform
CN112929482B (en) Sensor operation control method and device, computer equipment and storage medium
US8554753B1 (en) Maintaining database transaction priority between web pages in the absence of direct communication between the pages
CN114402313A (en) Label updating method and device, electronic equipment and storage medium
CN109766347B (en) Data updating method, device, system, computer equipment and storage medium
CN114546677A (en) Message execution processing method and device, electronic equipment and storage medium
US20190108139A1 (en) Client-side persistent caching framework
US20230014025A1 (en) Method and device for processing service using request, and computer readable storage medium
CN117472617B (en) Message processing method and device, electronic equipment and readable storage medium
CN110019259A (en) Data-updating method, device and the storage medium of distributed index service-Engine
CN117033024A (en) Method and device for identifying foreground and background applications, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant