CN114785749B - Message group sending processing method and device - Google Patents
Message group sending processing method and device Download PDFInfo
- Publication number
- CN114785749B CN114785749B CN202210391976.0A CN202210391976A CN114785749B CN 114785749 B CN114785749 B CN 114785749B CN 202210391976 A CN202210391976 A CN 202210391976A CN 114785749 B CN114785749 B CN 114785749B
- Authority
- CN
- China
- Prior art keywords
- sending
- message
- mass
- group
- selection
- 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
Links
- 238000003672 processing method Methods 0.000 title claims abstract description 15
- 238000000034 method Methods 0.000 claims abstract description 88
- 238000001914 filtration Methods 0.000 claims abstract description 62
- 230000008569 process Effects 0.000 claims abstract description 41
- 230000005540 biological transmission Effects 0.000 claims description 128
- 238000012545 processing Methods 0.000 claims description 48
- 238000012216 screening Methods 0.000 claims description 42
- 230000004044 response Effects 0.000 claims description 22
- 230000002441 reversible effect Effects 0.000 claims description 17
- 238000013500 data storage Methods 0.000 claims description 10
- 238000012795 verification Methods 0.000 claims description 10
- 238000004590 computer program Methods 0.000 claims description 9
- 230000007246 mechanism Effects 0.000 claims description 7
- 230000002045 lasting effect Effects 0.000 claims description 5
- 238000003745 diagnosis Methods 0.000 description 15
- 238000010586 diagram Methods 0.000 description 15
- 230000006870 function Effects 0.000 description 10
- 238000007726 management method Methods 0.000 description 9
- 238000004891 communication Methods 0.000 description 8
- 230000005856 abnormality Effects 0.000 description 6
- 239000003814 drug Substances 0.000 description 6
- 238000012552 review Methods 0.000 description 6
- 230000003287 optical effect Effects 0.000 description 4
- 238000012986 modification Methods 0.000 description 3
- 230000004048 modification Effects 0.000 description 3
- 230000002159 abnormal effect Effects 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 2
- 238000013461 design Methods 0.000 description 2
- 238000011161 development Methods 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 239000000835 fiber Substances 0.000 description 2
- 230000000644 propagated effect Effects 0.000 description 2
- 230000007115 recruitment Effects 0.000 description 2
- 239000004065 semiconductor Substances 0.000 description 2
- 238000012384 transportation and delivery Methods 0.000 description 2
- 230000009471 action Effects 0.000 description 1
- 238000013459 approach Methods 0.000 description 1
- 230000008901 benefit Effects 0.000 description 1
- 230000003139 buffering effect Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 238000009223 counseling Methods 0.000 description 1
- 201000010099 disease Diseases 0.000 description 1
- 208000037265 diseases, disorders, signs and symptoms Diseases 0.000 description 1
- 229940079593 drug Drugs 0.000 description 1
- 230000003203 everyday effect Effects 0.000 description 1
- 230000007717 exclusion Effects 0.000 description 1
- 230000036541 health Effects 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 238000005457 optimization Methods 0.000 description 1
- 230000002085 persistent effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 230000001360 synchronised effect Effects 0.000 description 1
- 238000012559 user support system Methods 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L51/00—User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
- H04L51/04—Real-time or near real-time messaging, e.g. instant messaging [IM]
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer And Data Communications (AREA)
Abstract
The invention discloses a message mass-sending processing method and device, and relates to the field of Internet medical treatment. One embodiment of the method comprises the following steps: receiving a group sending message request transmitted by a client, constructing a group sending message task according to filtering conditions in request parameters and message contents to be sent in a group, and sending the group sending message task to a message middleware; executing the mass-sending message task through a process of consuming the message middleware to find a sending target conforming to the filtering condition, and mass-sending the message content to the sending target; and updating the message mass sending result of the mass sending message task according to the message sending result of each sending target, and returning the message mass sending result to the client. According to the embodiment, the client side does not directly transmit the sending target information to the server side, but transmits the filtering condition to the server side, and the server side determines the sending target and the snapshot through the rear-mounted process, so that the data consistency, timeliness and execution performance of the mass-sending message task are guaranteed.
Description
Technical Field
The present invention relates to the field of internet medical technology, and in particular, to a method and an apparatus for processing mass messaging.
Background
With the development of internet technology, the application of internet medical treatment is becoming widespread. One of the most important functions in the complete flow of inquiry in an internet hospital is post-diagnosis management, and the high re-diagnosis rate can be kept through continuous post-diagnosis management, so that the satisfaction degree of patients to doctors is improved, the treatment scheme is ensured, and the overall effect of inquiry is improved.
Modes of patient education, psychological counseling, health management and the like in post-diagnosis management are common scenes, and establishing a doctor-patient IM (INSTANT MESSAGING instant messaging) session in the post-diagnosis scenes is an indispensable bridge, so that a doctor sends messages to a plurality of patients in groups is a very convenient and efficient communication mode.
However, millions of consultation sheets are formed every day, and it is not easy for one doctor to accumulate tens of thousands of consultation patients and send the post-diagnosis information to tens of thousands of patients at the same time. At present, there are two main modes of mass messaging: the two modes have the problems of inconvenient operation, untimely response, incapability of simultaneously transmitting to tens of thousands of patients, need to be operated again by a user after abnormality, have no clear transmitting result and the like.
Disclosure of Invention
In view of the above, embodiments of the present invention provide a method and an apparatus for processing group sending of messages, which at least can solve the problems in the prior art that the operation is inconvenient, the response is not timely, the message cannot be sent to tens of thousands of patients at the same time, the user is required to operate again after the abnormality, and no clear sending result exists.
In order to achieve the above object, according to an aspect of the embodiments of the present invention, there is provided a message group sending processing method, applied to a server, including:
Receiving a group sending message request transmitted by a client, constructing a group sending message task according to filtering conditions in request parameters and message contents to be sent in a group, and sending the group sending message task to a message middleware;
Executing the mass-sending message task through a process of consuming the message middleware to find a sending target conforming to the filtering condition, and mass-sending the message content to the sending target;
And updating the message mass sending result of the mass sending message task according to the message sending result of each sending target, and returning the message mass sending result to the client.
Optionally, the searching for a sending target that meets the filtering condition, and sending the message content to the sending target group includes:
analyzing the message body of the mass messaging task to obtain a message batch number and the request parameter, and converting the request parameter into a mass messaging object;
Inquiring a database according to the message batch number to obtain the sending state of the mass-sending message object, and searching a sending target conforming to the filtering condition under the condition that the sending state is not sent so as to obtain sending target information corresponding to each sending target identifier;
uploading the sending target information to an object storage server as a snapshot to send the message content to each sending target based on the snapshot; the snapshot is used for guaranteeing consistency of the target information sent during the process of re-consumption.
Optionally, the filtering condition includes a filtering field, a selecting mode field, and a sending target identifier, where the sending target identifier is a sending target identifier selected in a forward direction or a sending target identifier that is deselected in a full selection;
the searching for the sending target meeting the filtering condition comprises the following steps:
Searching all the sending targets conforming to the screening field, and judging whether the key value of the selection mode field is a preset numerical value or not;
if yes, determining that the selection mode is forward selection, and taking the transmission targets corresponding to the transmission target identifiers in all the transmission targets as the objects of the message to be sent in group; or (b)
If not, determining that the selection mode is full selection and reverse selection, and taking the rest sending targets except the sending target identification in all the sending targets as the objects of the message to be sent in group.
Optionally, the method further comprises: determining a storage address of the snapshot in the object storage server, and storing the storage address into the sending record of a database; and
And in response to the repayment processing operation, in the case that the sending state is incomplete, acquiring the storage address from a database according to the message batch number so as to acquire the snapshot from the object storage server based on the storage address.
Optionally, the request parameter further includes a total number of sending targets, and the sending the message content to the sending target group further includes:
calculating the quotient of the total number of the sending targets and the number of the sending targets which can be processed by the subtasks, and rounding up the quotient to obtain a plurality of rounded subtasks;
executing the plurality of subtasks in parallel using threads in a thread pool to send the message content to each sending target based on the snapshot;
The updating the message mass sending result of the mass sending message task according to the message sending result of each sending target comprises the following steps:
And updating the message mass sending result of the mass sending message task after all the subtasks are executed.
Optionally, the method further comprises: storing the message sending record for each sending target into a designated data storage component; the message sending record comprises a message sending result, wherein the message sending result is successful sending or failed sending; and
And counting the number of message sending records with successful message sending results in the data storage component, and changing the key value of a field of the number of successful sending records into the number of message sending records.
Optionally, the request parameter further includes a user login identifier;
the method for constructing the mass-sending message task and sending the mass-sending message task to the message middleware according to the filtering condition in the request parameter and the message content to be mass-sent comprises the following steps:
carrying out anti-re-submission verification on the request parameters according to the user login identification;
generating a sending record aiming at the group sending message request and lasting the sending record into a database in response to the passing of the verification result; the sending record comprises a sending state and a message group sending result; and
And constructing the mass-sending message task according to the filtering condition in the request parameter and the message content to be mass-sent, and sending the mass-sending message task to a message middleware.
Optionally, the executing the group messaging task through the process of consuming the message middleware further includes:
According to the response mechanism of the message middleware, if the current consumption processing fails, the re-consumption operation is executed; and
And adding a distributed lock to the mass messaging task, executing the mass messaging task by a process consuming the message middleware according to the distributed lock, and releasing the distributed lock after processing is completed.
Optionally, while the group messaging task is constructed and sent to the messaging middleware, the method further comprises: and returning the message group sending request result to the client.
To achieve the above object, according to an aspect of the embodiments of the present invention, there is provided a message group sending processing method, applied to a client, including:
receiving screening conditions and message contents input by a user, and searching all sending targets conforming to the screening conditions so as to receive the selection operation of the user on a plurality of sending targets;
Responding to the selection operation of the user on the group sending message option, generating a filtering condition according to the screening field, the selection mode field and the sending target identifier, and combining the message content to obtain a request parameter; the sending target identifier is a sending target identifier which is positively selected or a sending target identifier which is deselected when the sending target identifier is fully selected;
and generating a mass-sending message request based on the request parameters, transmitting the mass-sending message request to the server, and then receiving and displaying a message mass-sending result fed back by the server.
Optionally, the receiving user selects a plurality of sending targets, including:
receiving a selection operation of a user on a plurality of sending targets by using a forward selection mode; or (b)
And receiving a deselection operation of one or more sending targets by a user in the full selection state.
Optionally, before the receiving and displaying the message group sending result fed back by the server, the method further includes: and receiving and displaying a message group sending request result returned by the server.
To achieve the above object, according to another aspect of the embodiments of the present invention, there is provided a message group sending processing apparatus, applied to a server, including:
The receiving module is used for receiving a group sending message request transmitted by the client, constructing a group sending message task according to the filtering condition in the request parameter and the message content to be sent in a group and sending the group sending message task to the message middleware;
the mass sending module is used for executing the mass sending message task through the process of consuming the message middleware so as to find a sending target which accords with the filtering condition and mass sending the message content to the sending target;
And the updating module is used for updating the message mass sending result of the mass sending message task according to the message sending result of each sending target and returning the message mass sending result to the client.
Optionally, the group sending module is configured to:
analyzing the message body of the mass messaging task to obtain a message batch number and the request parameter, and converting the request parameter into a mass messaging object;
Inquiring a database according to the message batch number to obtain the sending state of the mass-sending message object, and searching a sending target conforming to the filtering condition under the condition that the sending state is not sent so as to obtain sending target information corresponding to each sending target identifier;
uploading the sending target information to an object storage server as a snapshot to send the message content to each sending target based on the snapshot; the snapshot is used for guaranteeing consistency of the target information sent during the process of re-consumption.
Optionally, the filtering condition includes a filtering field, a selecting mode field, and a sending target identifier, where the sending target identifier is a sending target identifier selected in a forward direction or a sending target identifier that is deselected in a full selection;
the mass-sending module is used for:
Searching all the sending targets conforming to the screening field, and judging whether the key value of the selection mode field is a preset numerical value or not;
if yes, determining that the selection mode is forward selection, and taking the transmission targets corresponding to the transmission target identifiers in all the transmission targets as the objects of the message to be sent in group; or (b)
If not, determining that the selection mode is full selection and reverse selection, and taking the rest sending targets except the sending target identification in all the sending targets as the objects of the message to be sent in group.
Optionally, the group sending module is further configured to:
Determining a storage address of the snapshot in the object storage server, and storing the storage address into the sending record of a database; and
And in response to the repayment processing operation, in the case that the sending state is incomplete, acquiring the storage address from a database according to the message batch number so as to acquire the snapshot from the object storage server based on the storage address.
Optionally, the request parameter further includes a total number of sending targets, and the group sending module is further configured to: calculating the quotient of the total number of the sending targets and the number of the sending targets which can be processed by the subtasks, and rounding up the quotient to obtain a plurality of rounded subtasks;
executing the plurality of subtasks in parallel using threads in a thread pool to send the message content to each sending target based on the snapshot;
the updating module is used for: and updating the message mass sending result of the mass sending message task after all the subtasks are executed.
Optionally, the updating module is further configured to:
storing the message sending record for each sending target into a designated data storage component; the message sending record comprises a message sending result, wherein the message sending result is successful sending or failed sending; and
And counting the number of message sending records with successful message sending results in the data storage component, and changing the key value of a field of the number of successful sending records into the number of message sending records.
Optionally, the request parameter further includes a user login identifier;
The receiving module is used for: carrying out anti-re-submission verification on the request parameters according to the user login identification;
generating a sending record aiming at the group sending message request and lasting the sending record into a database in response to the passing of the verification result; the sending record comprises a sending state and a message group sending result; and
And constructing the mass-sending message task according to the filtering condition in the request parameter and the message content to be mass-sent, and sending the mass-sending message task to a message middleware.
Optionally, the group sending module is further configured to: according to the response mechanism of the message middleware, if the current consumption processing fails, the re-consumption operation is executed; and
And adding a distributed lock to the mass messaging task, executing the mass messaging task by a process consuming the message middleware according to the distributed lock, and releasing the distributed lock after processing is completed.
Optionally, while the group messaging task is constructed and sent to the messaging middleware, the method further comprises: and returning the message group sending request result to the client.
To achieve the above object, according to another aspect of the embodiments of the present invention, there is provided a message mass-sending processing apparatus, applied to a client, including:
the operation module is used for receiving screening conditions and message contents input by a user, searching all the sending targets which accord with the screening conditions, and receiving the selection operation of the user on a plurality of sending targets;
the generation module is used for responding to the selection operation of a user on the group sending message option, generating filtering conditions according to the screening field, the selection mode field and the sending target identifier, and combining the message content to obtain request parameters; the sending target identifier is a sending target identifier which is positively selected or a sending target identifier which is deselected when the sending target identifier is fully selected;
and the transmission module is used for generating a group sending message request based on the request parameters and transmitting the group sending message request to the server, and then receiving and displaying a message group sending result fed back by the server.
Optionally, the operation module is configured to:
receiving a selection operation of a user on a plurality of sending targets by using a forward selection mode; or (b)
And receiving a deselection operation of one or more sending targets by a user in the full selection state.
Optionally, before the receiving and displaying the message group sending result fed back by the server, the method further includes: and receiving and displaying a message group sending request result returned by the server.
To achieve the above object, according to still another aspect of the embodiments of the present invention, there is provided a message mass-sending processing electronic device. The electronic equipment of the embodiment of the invention comprises: one or more processors; and the storage device is used for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors are enabled to realize the message mass sending processing method.
To achieve the above object, according to still another aspect of the embodiments of the present invention, there is provided a computer readable medium having stored thereon a computer program which, when executed by a processor, implements any one of the above-described message group transmission processing methods.
According to the solution provided by the present invention, one embodiment of the above invention has the following advantages or beneficial effects: the method is used for solving the problems that the operation is inconvenient, the response is not timely, tens of thousands of patients cannot be simultaneously sent, the user is required to operate again after abnormality, the result is not explicitly sent and the like in the prior art, providing the group sending message service with high efficiency and reliability for the user, improving the review rate, improving the satisfaction degree of the patients and maintaining the doctor-patient relationship in the Internet medical scene, and providing technical support for post-diagnosis management.
Further effects of the above-described non-conventional alternatives are described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
fig. 1 is a main flow diagram of a message group sending processing method applied to a server according to an embodiment of the present invention;
Fig. 2 is a flow chart of an alternative message mass-sending processing method applied to a server according to an embodiment of the invention;
FIG. 3 (a) is a forward selected operational morphology;
FIG. 3 (b) is a diagram of the operational morphology of the full selection and the reverse selection;
fig. 4 is a flow chart of another alternative message mass-sending processing method applied to a server according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of a relationship between a database and an object store service:
FIG. 6 is a flow chart of yet another alternative message mass-sending processing method applied to a server according to an embodiment of the present invention;
FIG. 7 is a schematic diagram of heterogeneous storage batch mass-send records and detailed send records;
Fig. 8 is a flow chart of a message mass-sending processing method applied to a client according to an embodiment of the invention;
Fig. 9 is a schematic diagram of main modules of a message mass-sending processing device applied to a server according to an embodiment of the present invention;
fig. 10 is a schematic diagram of main modules of a message mass-sending processing device applied to a client according to an embodiment of the present invention;
FIG. 11 is an exemplary system architecture diagram in which embodiments of the present invention may be applied;
fig. 12 is a schematic diagram of a computer system suitable for use in implementing a mobile device or server of an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention will now be described with reference to the accompanying drawings, in which various details of the embodiments of the present invention are included to facilitate understanding, and are to be considered merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
It is noted that embodiments of the application and features of the embodiments may be combined with each other without conflict. The technical scheme of the application obtains, stores, uses, processes and the like the data, which all meet the relevant regulations of national laws and regulations.
The IM system mass-sending message in the Internet hospital post-diagnosis management scene has the following characteristics:
1) Support for simultaneous transmission of messages to multiple patients: most doctors have more patients after accumulated diagnosis, and with the development of internet medical treatment, the number of patients after accumulated diagnosis of a single doctor is increased, so that the concurrent quantity of single group-sent patients needs to be increased.
2) The user experience is efficient and convenient: on the one hand, the user (e.g. doctor) can easily select a large number of patients, and on the other hand, the user's operation can be responded quickly.
3) The real-time performance of message transmission is good: after receiving the request of mass-sending message, the server needs to submit the sending task as soon as possible and execute the sending logic.
4) There is an explicit send result: based on the importance of post-diagnosis management, each message to be clustered to a patient needs to know the sending result explicitly, and the user can see the sending state and the sending result of a certain clustered message at any time.
At present, the mass messaging modes of the internet hospitals are as follows:
Mode 1, limit the immediate transmission mode of a small number of transmission targets: after the user selects the sending target by the client application, the target data to be sent is transmitted to the server through the network, and after the server receives the sending request, the server sequentially traverses each sending target and completes a plurality of logics such as inquiring session information, judging message types, constructing sending parameters and the like, and finally, the sending target data is sent to a patient. In the back-end processing process, the user can only stay on the sending page to wait for sending the result.
Mode 2, limit the asynchronous transmission mode of more transmission targets: and the client application transmits the target data selected by the user to the server through the network. The server first stores the sending request data in the database, and then responds to the client. At this point, the message has not actually been sent to the patient, and the message sent status is not sent. And the subsequent back-end timing task reads the group sending message task with the status of not being sent in the database at regular time, starts to send, and updates the message sending status into sending. And updating the message to be sent after the message is sent completely.
The technical problems of the existing mass messaging mode of the Internet hospital include:
1. In the operation flow of both the mode 1 and the mode 2, the user needs to manually select the sending targets one by one, sometimes needs to manually turn pages to acquire new sending targets and click the sending targets again for selection, when the number of the sending targets is large, the selection mode is not friendly to the user, the user is occupied for a long time only by selecting the sending targets, and if the sending targets are abnormal, the user needs to reselect the sending targets, so that the experience is poor;
2. In the mode 1, all the sending targets are transmitted by the network, the number of the sending targets is limited by the network transmission, and a synchronous mode is adopted, so that the client application blocks the sending result of the waiting server, the waiting time cannot be estimated, and the user cannot respond in time. In addition, the transmission mode is more limited and has poorer performance, is not suitable for sending messages to tens of thousands of people, and does not meet the characteristic 1).
3. The method 2 uses an asynchronous transmission method to respond to the user as soon as possible, but still transmits all transmission targets by the network, and relatively consumes network resources. In addition, a large number of unstructured sending targets are accessed by using the database, so that resources are occupied, the connection time of the database is long during read-write operation, and the overall performance of the database can be reduced. The manner in which the timing tasks are used also makes the server CPU utilization unstable and the timeliness of sending messages is also affected and therefore does not satisfy features 1) and 2) above).
4. Some mainstream IM applications support a limited number of sending targets of mass-sending at a time, such as 200 people, and the number of patients corresponding to doctors in the internet post-medical management scenario is far from that, so that the requirements cannot be met.
The words related to the scheme are explained as follows:
1) Database: a repository of data is organized, stored, and managed in terms of data structures, such as MySQL, etc.
2) Message middleware: a data structure that is "first in first out" in the underlying data structure. The method is generally used for solving the problems of application decoupling, asynchronous message, flow peak clipping and the like, and realizing a high-performance, high-availability, scalable and final consistency architecture. Such as JMQ, etc.
3) Object storage: is a cloud storage service scheme with mass, safety, low cost and high reliability. The solution mainly uses OSS (Object Storage Service ) as object storage server.
4) Distributed lock: the distributed system is controlled to operate on shared resources in an orderly manner, and consistency is maintained through mutual exclusion.
Referring to fig. 1, a main flowchart of a method for processing server-side message group sending provided by an embodiment of the present invention includes the following steps:
S101: receiving a group sending message request transmitted by a client, constructing a group sending message task according to filtering conditions in request parameters and message contents to be sent in a group, and sending the group sending message task to a message middleware;
S102: executing the mass-sending message task through a process of consuming the message middleware to find a sending target conforming to the filtering condition, and mass-sending the message content to the sending target;
s103: and updating the message mass sending result of the mass sending message task according to the message sending result of each sending target, and returning the message mass sending result to the client.
In the above embodiment, for step S101, the solution is applicable to all scenes where a large number of target mass-sending messages need to be sent, such as sending post-diagnosis information to a patient by a doctor, sending recruitment information and recruitment results to a recruiter by an enterprise, sending a score sheet to a student by a teacher, and the like in an internet medical scene; the messages sent may be identical, or different messages may be generated for different sending targets, for example, a message template including an alternative field is created, where the alternative field includes a student name, a student score, and a teacher comment, and a database including these three information is called to generate a message corresponding to each student.
The scheme mainly takes an Internet medical scene as an example for explanation, wherein a 'transmission target' is a patient, a 'transmission target information' is patient information, and the patient information comprises an ID, a name, an age, a gender, a label and the like. The post-diagnosis management aims at maintaining doctor-patient relations, can send patient articles, questionnaires, holiday blessings and the like, and can also generate different sending information, such as medication reminders, for different patients. The scheme can support doctors to send the post-diagnosis message to thousands of patients simultaneously, greatly improves the experience of managing patients after doctor diagnosis, and improves the efficiency.
The scheme supports the mass sending of tens of thousands of messages at a time, a user selects tens of thousands of sending targets by using a client and submits a mass sending message request to a server, wherein the client is mobile equipment used by the user, such as a mobile phone and a PC (personal computer ), and belongs to the front end. The rear end is a concept corresponding to the front end, namely a service end, and the service end in the scheme comprises a foreground service and a middle service, is layering of a framework, is convenient to flexibly expand and is easy to maintain. The foreground service is mainly used for receiving a request transmitted by a client and transmitting the request to a downstream service (namely, a middle service) for processing, and processing personalized business. The middle station service mainly provides general capability and data support.
After receiving the group sending message request transmitted by the foreground service, the middle platform service firstly analyzes the request parameter in the group sending message request, and performs anti-re-delivery verification on the request parameter based on the user login ID in the request parameter, for example, the user clicks and submits the group sending message request for multiple times, so that the server side can receive multiple repeated group sending message requests transmitted by the user client side, and only one group sending message request is processed by the server side through the anti-re-delivery verification.
And under the condition that the anti-replay check result is passed, generating a sending record aiming at the mass-sending message request and lasting the sending record to a database, wherein the sending record comprises the sending state of the mass-sending message request and the mass-sending result of the message, and the database supports the change of the sending state of the message and the display of the history record of the mass-sending message. A message lot number is automatically created for the transmission record, e.g. a doctor wants to send a message to 1 ten thousand patients, which 1 ten thousand patients form a lot. The database field includes:
TABLE 1
The data primary key Id does not relate to service attributes, is automatically generated for the system, and is not related to the scheme. The request parameters include LoginUserId-MsgContent, which are described in detail below. OssUrl is the storage address of the sending target in the object storage server, and the snapshot can ensure the consistency of the sending target information when the process re-consumes the processing.
And under the condition that the anti-replay check result is passed, constructing a mass-sending message task according to the filtering condition and the message content in the request parameter, and sending the mass-sending message task to the message middleware. In addition, a message mass sending request result is returned to the client to inform the user that the mass sending message request is received and submitted to the message middleware, similar to the message that the incoming message is known and the process is started.
For step S102, the message middleware is an application that exists independently, and functions to temporarily store the group messaging task. After the mass-sending message request reaches the server, a sending record is generated and stored in a database, a mass-sending message task is constructed and sent to a message middleware, at the moment, the mass-sending message content is not sent to a sending target mass-sending message, the logic of the actual mass-sending message content is a specific process in a middle service, and the mass-sending message task is acquired from the message middleware and executed to send the mass-sending message content to a process of the sending target.
The specific process in the middle-stage service is not a process of the message middleware, but a process of consuming the message middleware. Because the receiving of the group sending message request and the actual sending of the message are not completed in the same process, the sending of the message is completed by the process of consuming the message middleware, and the message middleware is used for peak clipping, valley filling and buffering.
In addition, in order to ensure the reliability of the whole implementation process, the message middleware starts an ACK (Acknowledge character, acknowledge character, in TCP/IP protocol, if the receiver successfully receives the data, it can reply an ACK data) response mechanism, if the current consumption processing fails, it can re-consume the processing. Under the distributed architecture, in order to solve the problem of concurrency of message processing in a multithreading processing environment, a distributed lock is added to a group messaging task before processing, so as to ensure that the same task is not repeatedly processed, namely idempotent property is ensured. To reduce system complexity and improve system performance, it is preferred to employ cache (Redis) based distributed locks. The current process determines a group messaging task to be executed according to the distributed lock so as to carry out the next logic processing, and the lock is released after the processing is completed. In summary, the function of retrying sending after the task processing failure is realized, the stability of the system and the timeliness of the message processing are considered, and the reliability and the high performance of the message mass sending can be ensured.
For step S103, the server needs to respond to the user in time within a limited time: the operation of the user needs to be explicitly responded, which means that the server receives the operation request of the user, processes the operation request, and generates a processing result. If the user sends a group sending message request, the response is a message group sending result: success or failure, the result needs to be transmitted back to the user by the foreground service in real time, and the user cannot wait for a long time.
In the scheme, a mode of heterogeneous storage of message data is preferably used, the message sending record of each sending target is stored in ES (ElasticSearch), so that the searching efficiency is improved, and the sending record of the whole group sending message task is stored in a database. And updating the message mass sending result of the mass sending message task according to the message sending result of each sending target.
Optionally, the service end in the scheme can also process a query request for the history sending record, the request parameter carries a user login ID, if the user a logs in the sending record which is queried by the account number of the user a and is sent by the history group, the query process is also completed by the middle service, all the persistent data are operated by the middle service, the middle service queries the history sending record and returns the history sending record to the front service, and the history sending record is returned to the client end by the front service.
According to the method provided by the embodiment, the client side does not directly transmit the sending target information to the server side, but transmits the filtering condition to the server side, and the server side inquires the filtering condition by itself, so that the network transmission pressure is reduced, and the problem of transmitting big data is solved; the user is responded immediately after the task is transmitted to the message middleware, the whole request response process is short in average time consumption, and the user cannot feel the click.
Referring to fig. 2, a flowchart of an optional method for processing server-side message group sending according to an embodiment of the present invention is shown, including the following steps:
s201: obtaining a filtering condition in the request parameters; the filtering condition comprises a screening field, a selection mode field and a transmission target identifier, wherein the transmission target identifier is a forward selected transmission target identifier or a transmission target identifier which is deselected in full selection;
S202: searching all the sending targets conforming to the screening field, and judging whether the key value of the selection mode field is a preset numerical value or not;
s203: if yes, determining that the selection mode is forward selection, and taking the transmission targets corresponding to the transmission target identifiers in all the transmission targets as the objects of the message to be sent in group;
s204: if not, determining that the selection mode is full selection and reverse selection, and taking the rest sending targets except the sending target identification in all the sending targets as the objects of the message to be sent in group.
In the above embodiment, for steps S201 to S204, in order for the server to support the function of sending the target group message to tens of thousands or more at a time, the scheme firstly improves and optimizes on the basis of traditional selection of the sending target and transmission of the sending target information, so as to solve the problems of high transmission cost and low performance of the existing network.
1. Method for selecting transmission destination
In the scheme, the user supports full selection and reverse selection besides forward selection in the mode of selecting the transmission targets by the client, namely, the user can pertinently cancel selection of some transmission targets in the full selection state. Referring to fig. 3 (a) for a forward selection operation mode, assuming that the total number of transmission targets screened after the user inputs the screening conditions is 9848, transmission target 1 and transmission target 2 may be selected by clicking. Referring to fig. 3 (b), assuming that the total number of transmission targets screened after the user inputs the screening condition is 9848, the user can select 9848 transmission targets, i.e. transmission target 1 to transmission target 9848, by clicking the "full selection" option without turning pages, and can cancel selection of transmission target 2 and transmission target 3 again, and only mass-send messages to the remaining 9846 transmission targets.
2. Client-side mass-sending message request message optimization
Since the send target list is paged on the client, the user swipes the page up to trigger a load operation, loading a certain number of send targets per page. How does the 9846 send targets' information be transmitted to the server in the form logic of the full select and the reverse select described above? One way is that the client obtains all 9848 data information of the transmission targets at one time, performs virtual paging, and transmits all 9846 information of the transmission targets selected by the user to the server during transmission, but this way consumes a large amount of network resources. Taking the internet medical scenario as an example, the data information of one patient includes more than ten kinds of information such as name, sex, age, disease information, classification tag, etc., and the size of 9848 data information is about 2M calculated by one data information 200 Byte. Thus, the one-time all-choice transmission includes two steps of acquiring a transmission target list and transmitting target information, consuming a total of 4M of the network, and obviously the cost of this approach is extremely high.
Aiming at the cost problem existing in the mode, the novel transmission mode is designed, the screening condition of the transmission target and the deselected transmission target ID are transmitted to the server side by improving the message transmitted by the transmission target in the network, the server side inquires all the transmission targets meeting the screening condition by itself, and the deselected transmission targets are filtered, so that the final transmission target is obtained. Therefore, the sending target list of the client can also acquire data in a paging way, the sending content and the sending target screening condition are calculated according to 10 pieces of data of one page, the network consumption of sending 9846 objects is about 3K, and compared with the mode, the sending cost is greatly reduced.
Improved request parameter form:
TABLE 2
Fields | Field type | Description of the invention |
LoginUserId | String | Login user id |
CheckedTargets | Object[] | List of selected transmission targets |
SendTargetTotal | Int | Total number of transmission targets |
CheckedFlag | Int | The selection mode is 1:full selection, 0:not full selection |
UncheckedTargetIds | String[] | Deselected transmit destination id at full select |
SearchTargetCondition | String | Querying parameters of the transmission target, i.e. screening conditions |
MsgType | Int | Message type, 1, text, 2, picture and 3, card |
MsgContent | String | Message content |
Compared with the prior art, CHECKEDFLAG, UNCHECKEDTARGETIDS, SEARCHTARGETCONDITION fields are added, and the request parameters transmitted to the foreground service by the client are not specific sending targets any more, but filtering conditions on the sending targets. The foreground service can transmit the filtering condition of the sending target received from the client to the middle station service, and the back-end middle station service inquires the specific sending target of the mass-sending message according to the filtering condition.
Examples of the request parameters for non-total selection forward selection are as follows, where the request parameters may or may not include a screening condition, and the specific transmission target may be determined directly according to the transmission target ID:
{
"LoginUserId":1,
"CHECKEDFLAG":0 (i.e. a preset value),
"SendTargetTotal":2,
"CheckedTargetIds":[1212087838028,1212087838029],
"MsgType":1,
"MsgContent" please take medicine according to the order, review in time-! "
}
Examples of request parameters for full and reverse selection are as follows:
{
"LoginUserId":1,
"CheckedFlag":1,
"SendTargetTotal":9848,
"UncheckedTargetIds":[1212087838028,1212087838029],
"SearchTargetCondition" { \ "patientSex": \ "male" },
"MsgType":1,
"MsgContent" please take medicine according to the order, review in time-! "
}
According to the method provided by the embodiment, the filtering conditions are selected in the forward direction and selected in the reverse direction after full selection, so that diversity selection is realized, and the problem that users select one by one and consume too much labor time is avoided.
Referring to fig. 4, a flowchart of another optional method for processing server-side message group sending according to an embodiment of the present invention is shown, including the following steps:
S401: analyzing the message body of the mass messaging task to obtain a message batch number and a request parameter, and converting the request parameter into a mass messaging object; the method comprises the steps of creating a message batch number of a sending record in a database, wherein the sending record corresponds to a group sending message request and comprises a sending state;
S402: inquiring a database according to the message batch number to obtain the sending state of the mass-sending message object, and searching a sending target conforming to the filtering condition under the condition that the sending state is not sent so as to obtain sending target information corresponding to each sending target identifier;
S403: uploading the sending target information to an object storage server as a snapshot to send the message content to each sending target based on the snapshot; the snapshot is used for guaranteeing consistency of the target information sent during the process of re-consumption.
In the above embodiment, for steps S401 to S402, the server needs to respond quickly after receiving the group messaging request from the client, and at this time, it is impossible to respond quickly for a large number of sending targets to send synchronously in real time. In order to respond quickly, the sending record of the group sending message request can be saved in a database, then the group sending message task is built in the distributed high-performance message middleware, and the group sending message task is pulled from the message middleware in real time and processed asynchronously, and then the user can be responded directly, so that the group sending message task is submitted and started.
From the aforementioned database fields, the subject message body format of the mass messaging task is known as follows (the values are only examples):
{
"Id":1212343568,
"BatchId":"364166e9",
"LoginUserId":1,
"SendTargetTotal":9848,
"CheckedFlag":1,
"UncheckedTargetIds":[],
"SearchTargetCondition" { \ "patientSex": \ "male" },
"MsgType":1,
"MsgContent" please take medicine according to the order, review in time-! "
}
And monitoring a subject message body of the mass messaging task in the message middleware by using a designated program process, and continuously pulling a message batch number and a request parameter in the subject message body to convert the request parameter in the JSON format into a mass messaging object. Inquiring a sending record in a database according to the message batch number:
1. if the query result is nonexistent, the mass messaging object is invalid and does not need to be processed.
2. If the sending record is detected, the sending state is checked, if the sending record is sent, the sending record is not required to be processed, and if the sending record is not sent, the post logic processing is performed, for example, the invention target meeting the filtering condition is searched.
For step S403, in the database table field design described above, specific transmission target information is not directly stored, because the data size of the specific transmission target information is related to how many transmission targets are selected by the user, and the data size of several transmission targets is only several tens of bytes, but the data size reaches the mega-level when tens of thousands of transmission targets are selected. Storing this data directly in the database takes up a lot of valuable resources and severely affects the performance of the database.
In the first operation, the information of each invention target is acquired according to the ID of the invention target, the information of the invention target is stored in the object storage server as a snapshot, so that the consistency of the information of the transmission target in the retry process is ensured, and the database only stores the snapshot address. The database only concerns the mass sending result of the message, and does not need to care the mode and transmission mode for selecting the sending target, thereby reducing the complexity of the database storage, improving the storage and query performance, and the relation between the database and the object storage server is shown in fig. 5. Wherein, snapshot: with respect to a fully available copy of a given data set, the copy includes an image of the corresponding data at some point in time (the point in time when the copy began), the snapshot may be a copy of the data it represents, or may be a replica of the data.
In the step, firstly, whether a snapshot storage address (ossUrl field) of the transmission target information exists in the mass messaging object is checked, if not, the operation is represented as the first operation, a specific transmission target is required to be searched according to a filtering condition, each transmission target information is searched and uploaded to an object storage server together as a snapshot, and the storage address is obtained and persisted in a transmission record of a database. If so, the snapshot is directly obtained from the object storage server according to the storage address.
It should be noted that, the sending target information is first stored in the object storage server, and the subsequent actual mass sending message is sent based on the sending target information stored in the object storage server, so that the sending process may be abnormal, and the resending sending target information needs to be resent after the abnormality is also based on the snapshot of the object storage server, so as to ensure that the sending target in resending is the original sending target, and achieve consistency.
According to the method provided by the embodiment, the information of all the sending targets requested by the current group sending is stored in one snapshot, and even if the information is reprocessed after the abnormality, the snapshot is used for processing, so that the consistency of the information of the sending targets is ensured.
Referring to fig. 6, a flowchart of another optional method for processing server-side message group sending according to an embodiment of the present invention is shown, including the following steps:
S601: obtaining the total number of sending targets in the request parameters, calculating the quotient of the total number of the sending targets and the number of the sending targets which can be processed by the subtasks, rounding up the quotient, and obtaining a plurality of rounded subtasks;
S602: executing the plurality of subtasks in parallel using threads in a thread pool to send the message content to each sending target based on a snapshot;
s603: and updating the message mass sending result of the mass sending message task after all the subtasks are executed.
In the above embodiment, for steps S601 to S603, the number of transmission targets is generally ten thousand, and thus the pressure for transmitting messages to ten thousand transmission targets is excessive at the same time.
For a total of 9846 sendtargets, 90 sendtargets are processed for each sub-task, 9846/90=109.4, rounded up to 110, i.e. the group messaging task needs to be split into 110 sub-tasks. The 110 subtasks may be subsequently performed in parallel using threads in the thread pool, and 110 messages may be sent simultaneously at the same time. Or determining the number of detachable subtasks according to the number of the available threads in the thread pool so as to equally divide the sending target into the subtasks.
To ensure the performance of message retrieval, the sending records of the entire batch of mass-sending message requests and the message sending records for each sending target are stored in different data storage components, see fig. 7. The sending record of the mass messaging request is stored in a database and corresponds to one piece of data in the database. The message transmission record for each transmission destination is stored in the ES, and as exemplified above, the transmission record of one batch corresponds to 9846 message transmission records in the ES.
When the intermediate service executes the subtasks in parallel, the intermediate service saves the message sending record of each sending target into the ES, wherein the message sending record comprises a message sending result, and the message sending result is that the sending is successful or failed. If the execution of the messages of the whole batch is completed, updating the database transmission Status field to be completed, counting the number of successful messages in the ES as the result of message transmission, and updating the transmission success number (SendSuccessNum) field in the database. The subsequent user can check the specific sending situation, if the message is sent to 30000 patients in group at a time, the successful sending number is 28000.
In the method provided by the embodiment, in order to reduce the service pressure of the server, one group messaging task is split into a plurality of subtasks, the subtasks are executed in parallel, and the throughput of simultaneously sending the message to a plurality of sending targets is improved; the sending record of the mass messaging task is stored in a database, but the sending result of each sending target is stored in the ES, so that the efficiency of subsequent searching is improved.
Referring to fig. 8, a flow chart of a message group sending processing method applied to a client according to an embodiment of the invention is shown, including the following steps:
s801: receiving screening conditions and message contents input by a user, and searching all sending targets conforming to the screening conditions;
S802: receiving a selection operation of a user on a plurality of sending targets by using a forward selection mode;
s803: receiving a deselection operation of one or more sending targets by a user in a full selection state;
S804: responding to the selection operation of the user on the group sending message option, generating a filtering condition according to the screening field, the selection mode field and the sending target identifier, and combining the message content to obtain a request parameter; the sending target identifier is a sending target identifier which is positively selected or a sending target identifier which is deselected when the sending target identifier is fully selected;
s805: and generating a mass-sending message request based on the request parameters, transmitting the mass-sending message request to the server, and then receiving and displaying a message mass-sending result fed back by the server.
In the above embodiment, referring to fig. 3 (a) and 3 (b) as well, assuming that the total number of transmission targets screened after the user inputs the screening condition is 9848, if using the method of fig. 3 (a), the user can click to select transmission target 1 and transmission target 2, if using the method of fig. 3 (b), the user can select 9848 transmission targets, that is, transmission target 1 to transmission target 9848, by clicking the "all-select" option without turning pages, and can cancel selection of transmission target 2 and transmission target 3, and at this time, only the group transmission message is transmitted to the remaining 9846 transmission targets.
The subsequent page will determine the key value of the selection mode field according to the specific selection mode of the user, for example, 0 or 1,0 is indicated as the forward selection mode, and 1 is indicated as the full selection and the deselection mode. And determining the key value of the screening field according to the input screening condition, wherein the key value is patientSex as male. According to the specific selected invention target ID, selection mode field, screening field, user login ID and message content (such as text, picture, etc.) to be sent in group, request parameters are generated, and then a group sending message request is generated to the server.
The final message group sending result returned by the server may include sending status, number of successful sending, specific sending targets failed sending, etc. In addition, after the server generates a mass-sending message task to the message middleware, the server can generate a message mass-sending request result to the client to inform the client that the request is received and the processing is started.
Examples of the request parameters for forward selection are as follows, and at this time, the screening conditions may be included, or the screening conditions may not be included, and the specific transmission target may be determined directly according to the transmission target ID:
{
"LoginUserId":1,
"CHECKEDFLAG":0 (i.e. a preset value),
"SendTargetTotal":2,
"CheckedTargetIds":[1212087838028,1212087838029],
"MsgType":1,
"MsgContent" please take medicine according to the order, review in time-! "
}
Examples of request parameters for full and reverse selection are as follows:
{
"LoginUserId":1,
"CheckedFlag":1,
"SendTargetTotal":9848,
"UncheckedTargetIds":[1212087838028,1212087838029],
"SearchTargetCondition" { \ "patientSex": \ "male" },
"MsgType":1,
"MsgContent" please take medicine according to the order, review in time-! "
}
According to the method provided by the embodiment, the filtering condition of the sending target is transmitted to the server, and the server searches all the sending targets meeting the filtering condition by itself.
The mass messaging problem relates to a plurality of key elements such as user operation and response, large data network transmission, large task processing performance and the like, so that the method provided by the embodiment of the invention has at least the following beneficial effects compared with the prior art in view of a plurality of aspects such as operation mode, data transmission, data storage, task execution, state update and the like:
1. Improving transmission request parameters: the client side does not directly transmit the sending target information to the server side any more, but transmits the filtering condition to the server side, and the server side inquires and determines the sending target by itself, so that the data transmission mode of the client side group messaging request is simplified, and the network transmission pressure and consumption are reduced;
2. The filtering conditions are divided into forward filtering and reverse filtering after full selection, so that diversity selection is realized, and the problem that users select one by one and consume too long manual time is avoided;
3. All the information of the sending targets requested for mass sending at this time is uploaded to the object storage server to be used as a snapshot, and even if the information is reprocessed after abnormality, the snapshot is used to ensure the consistency and the searching performance of the information of the sending targets;
4. splitting a group messaging task into a plurality of subtasks, flexibly scheduling and concurrently executing, improving throughput of simultaneously sending the group messaging task to a plurality of sending targets, and ensuring timeliness of message touch;
5. The heterogeneous storage batch mass sending records and the detailed sending records are stored in a database, and the sending records of mass sending message tasks are stored in an ES (ES) for each sending target, so that the message record retrieval performance is improved.
6. The system is provided with an anti-replay check mechanism, and when a user clicks the mass messaging button for a plurality of times, the system passes the anti-replay check and only needs to execute once; the server receives the group message sending request, then persists the request and sends the request to the message middleware, then responds to the user, and the user can obtain a response result in a short time of 100 ms;
7. the message middleware has a response mechanism, and can automatically re-execute the consumption operation when the consumption group message sending task fails, so that the reliability is good.
Referring to fig. 9, a schematic diagram of main modules of a message mass sending processing apparatus 900 applied to a server according to an embodiment of the present invention is shown, including:
the receiving module 901 is configured to receive a group sending message request transmitted by a client, construct a group sending message task according to a filtering condition in a request parameter and a message content to be sent in a group, and send the group sending message task to a message middleware;
The mass sending module 902 is configured to perform the mass sending message task through a process of consuming a message middleware, so as to find a sending target that meets the filtering condition, and mass send the message content to the sending target;
the updating module 903 is configured to update a message mass sending result of the mass sending message task according to the message sending result of each sending target, and return the message mass sending result to the client.
In the embodiment of the present invention, the group sending module 902 is configured to:
analyzing the message body of the mass messaging task to obtain a message batch number and the request parameter, and converting the request parameter into a mass messaging object;
Inquiring a database according to the message batch number to obtain the sending state of the mass-sending message object, and searching a sending target conforming to the filtering condition under the condition that the sending state is not sent so as to obtain sending target information corresponding to each sending target identifier;
uploading the sending target information to an object storage server as a snapshot to send the message content to each sending target based on the snapshot; the snapshot is used for guaranteeing consistency of the target information sent during the process of re-consumption.
In the embodiment of the invention, the filtering condition comprises a screening field, a selection mode field and a transmission target identifier, wherein the transmission target identifier is a forward selected transmission target identifier or a transmission target identifier which is deselected in full selection;
the group sending module 902 is configured to:
Searching all the sending targets conforming to the screening field, and judging whether the key value of the selection mode field is a preset numerical value or not;
if yes, determining that the selection mode is forward selection, and taking the transmission targets corresponding to the transmission target identifiers in all the transmission targets as the objects of the message to be sent in group; or (b)
If not, determining that the selection mode is full selection and reverse selection, and taking the rest sending targets except the sending target identification in all the sending targets as the objects of the message to be sent in group.
In the embodiment of the present invention, the group sending module 902 is further configured to:
Determining a storage address of the snapshot in the object storage server, and storing the storage address into the sending record of a database; and
And in response to the repayment processing operation, in the case that the sending state is incomplete, acquiring the storage address from a database according to the message batch number so as to acquire the snapshot from the object storage server based on the storage address.
In the embodiment of the present invention, the request parameter further includes a total number of sending targets, and the group sending module 902 is further configured to:
calculating the quotient of the total number of the sending targets and the number of the sending targets which can be processed by the subtasks, and rounding up the quotient to obtain a plurality of rounded subtasks;
executing the plurality of subtasks in parallel using threads in a thread pool to send the message content to each sending target based on the snapshot;
the update module 903 is configured to:
And updating the message mass sending result of the mass sending message task after all the subtasks are executed.
In the embodiment of the present invention, the update module 903 is further configured to:
storing the message sending record for each sending target into a designated data storage component; the message sending record comprises a message sending result, wherein the message sending result is successful sending or failed sending; and
And counting the number of message sending records with successful message sending results in the data storage component, and changing the key value of a field of the number of successful sending records into the number of message sending records.
In the implementation device of the invention, the request parameters also comprise a user login identifier;
The receiving module is used for:
carrying out anti-re-submission verification on the request parameters according to the user login identification;
generating a sending record aiming at the group sending message request and lasting the sending record into a database in response to the passing of the verification result; the sending record comprises a sending state and a message group sending result; and
And constructing the mass-sending message task according to the filtering condition in the request parameter and the message content to be mass-sent, and sending the mass-sending message task to a message middleware.
In the embodiment of the present invention, the group sending module 902 is further configured to:
According to the response mechanism of the message middleware, if the current consumption processing fails, the re-consumption operation is executed; and
And adding a distributed lock to the mass messaging task, executing the mass messaging task by a process consuming the message middleware according to the distributed lock, and releasing the distributed lock after processing is completed.
The implementation device of the invention constructs the mass-sending message task and sends the mass-sending message task to the message middleware, and simultaneously comprises the following steps: and returning the message group sending request result to the client.
Referring to fig. 10, a schematic diagram of main modules of a message mass sending processing apparatus 1000 applied to a client according to an embodiment of the present invention is shown, including:
An operation module 1001, configured to receive a filtering condition and a message content input by a user, and find all sending targets that meet the filtering condition, so as to receive a selection operation of the user on a plurality of sending targets;
A generating module 1002, configured to generate a filtering condition according to the screening field, the selection mode field, and the sending target identifier in response to a selection operation of the user on the group sending message option, and combine the message content to obtain a request parameter; the sending target identifier is a sending target identifier which is positively selected or a sending target identifier which is deselected when the sending target identifier is fully selected;
And the transmission module 1003 is configured to generate a group sending message request based on the request parameter, transmit the group sending message request to the server, and then receive and display a message group sending result fed back by the server.
In the embodiment of the present invention, the operation module 1001 is configured to:
receiving a selection operation of a user on a plurality of sending targets by using a forward selection mode; or (b)
And receiving a deselection operation of one or more sending targets by a user in the full selection state.
In the embodiment of the invention, before the message group sending result fed back by the receiving server is displayed, the device further comprises: and receiving and displaying a message group sending request result returned by the server.
In addition, the implementation of the apparatus in the embodiments of the present invention has been described in detail in the above method, so that the description is not repeated here.
Fig. 11 illustrates an exemplary system architecture 1100 in which embodiments of the present invention may be employed, including terminal devices 1101, 1102, 1103, a network 1104 and a server 1105 (by way of example only).
The terminal devices 1101, 1102, 1103 may be various electronic devices having a display screen and supporting web browsing, installed with various communication client applications, and a user may interact with the server 1105 using the terminal devices 1101, 1102, 1103 via the network 1104 to receive or transmit messages, etc.
Network 1104 is the medium used to provide communication links between terminal devices 1101, 1102, 1103 and server 1105. Network 1104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
The server 1105 may be a server providing various services, and it should be noted that, the method provided by the embodiment of the present invention is generally executed by the server 1105, and accordingly, the apparatus is generally disposed in the server 1105.
It should be understood that the number of terminal devices, networks and servers in fig. 11 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 12, there is illustrated a schematic diagram of a computer system 1200 suitable for use in implementing an embodiment of the present invention. The terminal device shown in fig. 12 is only an example, and should not impose any limitation on the functions and the scope of use of the embodiment of the present invention.
As shown in fig. 12, the computer system 1200 includes a Central Processing Unit (CPU) 1201, which can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 1202 or a program loaded from a storage section 1208 into a Random Access Memory (RAM) 1203. In the RAM 1203, various programs and data required for the operation of the system 1200 are also stored. The CPU 1201, ROM 1202, and RAM 1203 are connected to each other through a bus 1204. An input/output (I/O) interface 1205 is also connected to the bus 1204.
The following components are connected to the I/O interface 1205: an input section 1206 including a keyboard, a mouse, and the like; an output portion 1207 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, a speaker, and the like; a storage section 1208 including a hard disk or the like; and a communication section 1209 including a network interface card such as a LAN card, a modem, or the like. The communication section 1209 performs communication processing via a network such as the internet. The drive 1210 is also connected to the I/O interface 1205 as needed. A removable medium 1211 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is installed as needed on the drive 1210 so that a computer program read out therefrom is installed into the storage section 1208 as needed.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network via the communication portion 1209, and/or installed from the removable media 1211. The above-described functions defined in the system of the present invention are performed when the computer program is executed by a Central Processing Unit (CPU) 1201.
The computer readable medium shown in the present invention may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules involved in the embodiments of the present invention may be implemented in software or in hardware. The described modules may also be provided in a processor, for example, as: a processor comprises a receiving module, a group sending module and an updating module. The names of these modules do not in some way constitute a limitation on the module itself, for example, a mass-sending module may also be described as a "mass-sending message module".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be present alone without being fitted into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to perform any of the message mass-sending methods described above.
The above embodiments do not limit the scope of the present invention. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives can occur depending upon design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.
Claims (16)
1. The message mass-sending processing method is applied to a server and is characterized by comprising the following steps:
Receiving a group sending message request transmitted by a client, constructing a group sending message task according to filtering conditions in request parameters and message contents to be sent in a group, and sending the group sending message task to a message middleware;
Executing the mass-sending message task through a process of consuming the message middleware to find a sending target conforming to the filtering condition, and mass-sending the message content to the sending target; the filtering conditions comprise a screening field, a selection mode field and a sending target identifier, wherein the selection mode is full selection and reverse selection, and the sending target identifier is a sending target identifier which is deselected when full selection is performed; for the case that the selection mode is forward selection, the screening field is null or not set;
And updating the message mass sending result of the mass sending message task according to the message sending result of each sending target, and returning the message mass sending result to the client.
2. The method of claim 1, wherein the searching for a transmission target that meets the filtering condition, and transmitting the message content to the transmission target group, comprises:
analyzing the message body of the mass messaging task to obtain a message batch number and the request parameter, and converting the request parameter into a mass messaging object;
Inquiring a database according to the message batch number to obtain the sending state of the mass-sending message object, and searching a sending target conforming to the filtering condition under the condition that the sending state is not sent so as to obtain sending target information corresponding to each sending target identifier;
uploading the sending target information to an object storage server as a snapshot to send the message content to each sending target based on the snapshot; the snapshot is used for guaranteeing consistency of the target information sent during the process of re-consumption.
3. The method according to claim 1 or 2, wherein the transmission target identifier is a transmission target identifier selected in a forward direction or a transmission target identifier deselected at the time of full selection;
the searching for the sending target meeting the filtering condition comprises the following steps:
Searching all the sending targets conforming to the screening field, and judging whether the key value of the selection mode field is a preset numerical value or not;
if yes, determining that the selection mode is forward selection, and taking the transmission targets corresponding to the transmission target identifiers in all the transmission targets as the objects of the message to be sent in group; or (b)
If not, determining that the selection mode is full selection and reverse selection, and taking the rest sending targets except the sending target identification in all the sending targets as the objects of the message to be sent in group.
4. The method as recited in claim 2, further comprising:
Determining a storage address of the snapshot in the object storage server, and storing the storage address into a sending record of a database; and
And in response to the repayment processing operation, in the case that the sending state is incomplete, acquiring the storage address from a database according to the message batch number so as to acquire the snapshot from the object storage server based on the storage address.
5. The method according to claim 2 or 4, wherein the request parameters further include a total number of transmission targets, and the mass transmitting the message content to the transmission targets further includes:
calculating the quotient of the total number of the sending targets and the number of the sending targets which can be processed by the subtasks, and rounding up the quotient to obtain a plurality of rounded subtasks;
executing the plurality of subtasks in parallel using threads in a thread pool to send the message content to each sending target based on the snapshot;
The updating the message mass sending result of the mass sending message task according to the message sending result of each sending target comprises the following steps:
And updating the message mass sending result of the mass sending message task after all the subtasks are executed.
6. The method as recited in claim 5, further comprising:
storing the message sending record for each sending target into a designated data storage component; the message sending record comprises a message sending result, wherein the message sending result is successful sending or failed sending; and
And counting the number of message sending records with successful message sending results in the data storage component, and changing the key value of a field of the number of successful sending records into the number of message sending records.
7. The method according to claim 1 or 2, wherein the request parameters further comprise a user login identification;
the method for constructing the mass-sending message task and sending the mass-sending message task to the message middleware according to the filtering condition in the request parameter and the message content to be mass-sent comprises the following steps:
carrying out anti-re-submission verification on the request parameters according to the user login identification;
generating a sending record aiming at the group sending message request and lasting the sending record into a database in response to the passing of the verification result; the sending record comprises a sending state and a message group sending result; and
And constructing the mass-sending message task according to the filtering condition in the request parameter and the message content to be mass-sent, and sending the mass-sending message task to a message middleware.
8. The method of claim 1 or 2, wherein the executing the group messaging task by a process consuming message middleware further comprises:
According to the response mechanism of the message middleware, if the current consumption processing fails, the re-consumption operation is executed; and
And adding a distributed lock to the mass messaging task, executing the mass messaging task by a process consuming the message middleware according to the distributed lock, and releasing the distributed lock after processing is completed.
9. The method of claim 8, wherein the constructing a group messaging task and sending into a messaging middleware further comprises: and returning the message group sending request result to the client.
10. The message mass-sending processing method is applied to the client and is characterized by comprising the following steps:
receiving screening conditions and message contents input by a user, and searching all sending targets conforming to the screening conditions so as to receive the selection operation of the user on a plurality of sending targets;
Responding to the selection operation of the user on the group sending message option, generating a filtering condition according to the screening field, the selection mode field and the sending target identifier, and combining the message content to obtain a request parameter; the method comprises the steps of selecting a transmission target identifier from a transmission target identifier, wherein the transmission target identifier is a transmission target identifier which is selected in a forward direction or a transmission target identifier which is deselected when the selection mode is full selection and reverse selection; for the case that the selection mode is forward selection, the screening field is null or not set;
and generating a mass-sending message request based on the request parameters, transmitting the mass-sending message request to the server, and then receiving and displaying a message mass-sending result fed back by the server.
11. The method of claim 10, wherein the receiving user selection operation of the plurality of transmission targets comprises:
receiving a selection operation of a user on a plurality of sending targets by using a forward selection mode; or (b)
And receiving a deselection operation of one or more sending targets by a user in the full selection state.
12. The method according to claim 10 or 11, further comprising, before the receiving and displaying the message group sending result fed back by the server,: and receiving and displaying a message group sending request result returned by the server.
13. A message mass-sending processing device, applied to a server, comprising:
The receiving module is used for receiving a group sending message request transmitted by the client, constructing a group sending message task according to the filtering condition in the request parameter and the message content to be sent in a group and sending the group sending message task to the message middleware;
The mass sending module is used for executing the mass sending message task through the process of consuming the message middleware so as to find a sending target which accords with the filtering condition and mass sending the message content to the sending target; the filtering conditions comprise a screening field, a selection mode field and a sending target identifier, wherein the selection mode is full selection and reverse selection, and the sending target identifier is a sending target identifier which is deselected when full selection is performed; for the case that the selection mode is forward selection, the screening field is null or not set;
And the updating module is used for updating the message mass sending result of the mass sending message task according to the message sending result of each sending target and returning the message mass sending result to the client.
14. A message mass-sending processing apparatus, applied to a client, comprising:
the operation module is used for receiving screening conditions and message contents input by a user, searching all the sending targets which accord with the screening conditions, and receiving the selection operation of the user on a plurality of sending targets;
The generation module is used for responding to the selection operation of a user on the group sending message option, generating filtering conditions according to the screening field, the selection mode field and the sending target identifier, and combining the message content to obtain request parameters; the method comprises the steps of selecting a transmission target identifier from a transmission target identifier, wherein the transmission target identifier is a transmission target identifier which is selected in a forward direction or a transmission target identifier which is deselected when the selection mode is full selection and reverse selection; for the case that the selection mode is forward selection, the screening field is null or not set;
and the transmission module is used for generating a group sending message request based on the request parameters and transmitting the group sending message request to the server, and then receiving and displaying a message group sending result fed back by the server.
15. An electronic device, comprising:
One or more processors;
storage means for storing one or more programs,
When executed by the one or more processors, causes the one or more processors to implement the method of any of claims 1-12.
16. A computer readable medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the method according to any of claims 1-12.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210391976.0A CN114785749B (en) | 2022-04-14 | 2022-04-14 | Message group sending processing method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210391976.0A CN114785749B (en) | 2022-04-14 | 2022-04-14 | Message group sending processing method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114785749A CN114785749A (en) | 2022-07-22 |
CN114785749B true CN114785749B (en) | 2024-07-16 |
Family
ID=82429409
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210391976.0A Active CN114785749B (en) | 2022-04-14 | 2022-04-14 | Message group sending processing method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114785749B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115334466B (en) * | 2022-08-15 | 2023-08-04 | 北京泰镝科技股份有限公司 | Message sending method and device, electronic equipment and storage medium |
CN118316887B (en) * | 2024-06-07 | 2024-09-17 | 湖南云客信息技术有限公司 | Flow surge elimination method and device for mass-sending information |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1968442A (en) * | 2006-04-14 | 2007-05-23 | 华为技术有限公司 | Short message group sending system and method |
CN102209084A (en) * | 2010-03-30 | 2011-10-05 | 华为终端有限公司 | Processing method of Push message, apparatus thereof and communication system |
CN112311868A (en) * | 2020-10-27 | 2021-02-02 | 上海淇馥信息技术有限公司 | Message touch method and device and electronic equipment |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7464121B2 (en) * | 2006-01-06 | 2008-12-09 | International Business Machines Corporation | Apparatus for sending a sequence of asynchronous messages to the same member of a clustered consumer |
CN101183377B (en) * | 2007-12-10 | 2010-09-08 | 华中科技大学 | A high-availability database cluster system based on message middleware |
CN111198769A (en) * | 2018-11-16 | 2020-05-26 | 北京京东金融科技控股有限公司 | Information processing method and system, computer system and computer readable medium |
CN110753129A (en) * | 2019-10-29 | 2020-02-04 | 深圳前海微众银行股份有限公司 | Message transmission method, system, apparatus, device, and computer-readable storage medium |
CN111666162B (en) * | 2020-04-30 | 2022-12-30 | 平安科技(深圳)有限公司 | Distributed message transmission method, device, computer equipment and storage medium |
CN114124861B (en) * | 2020-08-28 | 2023-05-23 | 腾讯科技(深圳)有限公司 | Message mass-sending method, device, computer equipment and storage medium |
-
2022
- 2022-04-14 CN CN202210391976.0A patent/CN114785749B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1968442A (en) * | 2006-04-14 | 2007-05-23 | 华为技术有限公司 | Short message group sending system and method |
CN102209084A (en) * | 2010-03-30 | 2011-10-05 | 华为终端有限公司 | Processing method of Push message, apparatus thereof and communication system |
CN112311868A (en) * | 2020-10-27 | 2021-02-02 | 上海淇馥信息技术有限公司 | Message touch method and device and electronic equipment |
Also Published As
Publication number | Publication date |
---|---|
CN114785749A (en) | 2022-07-22 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11636106B2 (en) | Federated search of heterogeneous data sources | |
US8983902B2 (en) | Transparent caching of configuration data | |
US8762408B2 (en) | Optimizing software applications | |
US20120158655A1 (en) | Non-relational function-based data publication for relational data | |
CN114785749B (en) | Message group sending processing method and device | |
US20110231592A1 (en) | Mashup Infrastructure with Learning Mechanism | |
US20090287805A1 (en) | System & method for non-http session based publish/subscribe support using pre-emptive subscriptions | |
CN113779094B (en) | Batch-flow-integration-based data processing method and device, computer equipment and medium | |
US20120054662A1 (en) | Task Importance Indicator Based on Personalized Rules | |
CN112765152B (en) | Method and apparatus for merging data tables | |
US11593418B2 (en) | System and method for a semantically-driven smart data cache | |
CN112579897B (en) | Information searching method and device | |
CN114116842B (en) | Multidimensional medical data real-time acquisition method and device, electronic equipment and storage medium | |
CN117413289A (en) | Controlled display of related message threads | |
US10755362B2 (en) | Escrow personalization system | |
CN115185787B (en) | Method and device for processing transaction log | |
US20210149709A1 (en) | Method and apparatus for processing transaction | |
CN113986936A (en) | Data processing method and device, electronic equipment and storage medium | |
CN118394324A (en) | Component data intercommunication method and system based on low-code development of hospital background control system | |
US10831854B2 (en) | Web-based medical image viewer with web database | |
CN116701445A (en) | Resource matching information generation method, device, equipment and computer readable medium | |
CN117215738A (en) | Data intensive computing imaging optimization system based on distributed system | |
JP7162682B2 (en) | Information collaboration device, information collaboration system, information collaboration method and program | |
US11107563B2 (en) | Fast healthcare interoperability resources model for user interface generation | |
CN113821537A (en) | Method, apparatus, device and storage medium for reading data |
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 |