CN107341059B - WeChat public number concurrent message processing system - Google Patents

WeChat public number concurrent message processing system Download PDF

Info

Publication number
CN107341059B
CN107341059B CN201710578068.1A CN201710578068A CN107341059B CN 107341059 B CN107341059 B CN 107341059B CN 201710578068 A CN201710578068 A CN 201710578068A CN 107341059 B CN107341059 B CN 107341059B
Authority
CN
China
Prior art keywords
message
wechat
processing
task
factory
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710578068.1A
Other languages
Chinese (zh)
Other versions
CN107341059A (en
Inventor
周瑞峰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Dazhi Software Technology Co ltd
Original Assignee
Shenzhen Dazhi Software Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Dazhi Software Technology Co ltd filed Critical Shenzhen Dazhi Software Technology Co ltd
Priority to CN201710578068.1A priority Critical patent/CN107341059B/en
Publication of CN107341059A publication Critical patent/CN107341059A/en
Application granted granted Critical
Publication of CN107341059B publication Critical patent/CN107341059B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q50/00Systems or methods specially adapted for specific business sectors, e.g. utilities or tourism
    • G06Q50/01Social networking
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/04Real-time or near real-time messaging, e.g. instant messaging [IM]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/52User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail for supporting social networking services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5011Pool
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5018Thread allocation

Abstract

The invention relates to the technical field of computer internet, in particular to a concurrent message processing mechanism for WeChat public numbers. It includes a WeChat message Uniform interface, a message factory, an event handler, a message handler, an asynchronous message handler, and an active Send Messaging machine. By adopting the technical scheme of the invention, the method has obvious effect on processing and large concurrent processing of multi-type messages (including texts, pictures, voice, videos, pictures, geographical positions and the like). Such as: the video data of the video pushed by the WeChat is generally larger, and the system can directly return to tell the WeChat that the WeChat has been processed after receiving the video type message. Then the system establishes a task for processing the video in parallel, and the task downloads the video and stores the video data to the local. The WeChat public number receives a great amount of various messages every day, and how to ensure the processing efficiency is very suitable for the set of concurrent message processing mechanism of the invention.

Description

WeChat public number concurrent message processing system
Technical Field
The invention relates to the technical field of computer internet, in particular to a WeChat public number concurrent message processing system.
Background
Tencent company provides a WeChat public platform and a related interface for receiving messages by the WeChat public platform, and defines a data packet format for receiving common messages and receiving event push by the WeChat public platform and a data packet format for sending messages under a developer mode.
Tencent corporation only defines the format and requirements of data packets, does not provide data flow and business processing, and needs the development capability of application software of users to develop according to the business. The application of a developer mode can not be rapidly completed according to the requirement by a WeChat public platform or a WeChat public user, the use is complex, and the development difficulty is increased.
Disclosure of Invention
Aiming at the requirement of the public number interface of the WeChat, the third-party platform must return a processing result within 5 seconds after receiving the message pushed by the WeChat. Therefore, the invention provides a WeChat public number concurrent message processing system for efficiently processing WeChat requests. The treatment system is divided into two parts: the method comprises the steps of fast processing and task processing, wherein the fast processing is the problem that fast reply is needed, and all messages which do not need to be replied fast use a task processing system. Meanwhile, when a large number of messages are processed concurrently, the task manager can ensure that the messages can be processed quickly. And each message can be rapidly and stably processed.
In order to achieve the purpose of rapidness and high efficiency, the invention provides the following technical scheme:
a WeChat public number concurrent message processing system comprises a WeChat message unified interface: the system is used for receiving and processing messages pushed by the WeChat and the WeChat public number;
a message factory: the processing module is used for receiving the message, judging the type of the message, automatically generating message parameter information, automatically loading the corresponding processing module through the parameter information, finding the processing module of the specified message, and then transmitting the message parameter information to the specified module for processing; wherein: the processing module and the designated module refer to the same module. The processing module is introduced as follows: because WeChat messages are of many types, each type is handled differently. We propose to make the corresponding processing unit (i.e. processing module) separately based on the processing of each message. The calling modes of the processing modules are uniform, and the processing logic in different processing modules is different. Such as: and the text message processing module is used for transmitting the message to the text message processing module for processing when the message factory judges that the message type is the text message.
An event handler: the system is used for receiving the task sent by the message factory, carrying out primary processing on the task, verifying whether the task needs to be processed quickly or not, and calling the asynchronous task to process if the received event cannot be processed quickly.
A message processor: the system is used for receiving the task sent by the message factory, carrying out primary processing on the task, verifying whether the message has a trigger keyword reply or not, carrying out rapid processing if the message is triggered, and returning a reply message; after the rapid processing is completed, an asynchronous task processing task is automatically added;
wherein: the preliminary treatment is as follows: and verifying the integrity of the message, sorting the message, marking the type of the message, and extracting key information of the message to facilitate the next processing. For example: the system judges what type of the received event message is, finds the event message, and extracts the specific key words of the event message from the message content;
the rapid processing means that: after receiving the message, the processing module is called to carry out rapid processing. Judging whether a task needs to be established for continuous processing by the processing module;
asynchronous task processing: is the invocation of the task to be done by the message processor.
An asynchronous message processor: the thread pool is used for automatically distributing the task to be processed through the thread pool, and if the task needs the system to automatically reply the message, the active message sending device is called;
an active messaging device: after receiving the message sending task, firstly sorting the message sending task; judging whether the fan (wherein, the fan refers to the WeChat user paying attention to the WeChat public number) can actively send the message; and if the message can be sent, calling a WeChat sending interface and pushing the message to the WeChat.
Preferably, the event types are: clicking a menu to obtain the geographical position of the vermicelli; the message types are: text, pictures, voice, video, graphics, and geographic location.
Preferably, the step of pushing the message from the wechat public number to be processed by the wechat message unified interface is as follows:
(1) verifying whether the WeChat message is sent from the WeChat public signal server or not, and carrying out IP verification through a white list of the WeChat server;
(2) and verifying whether the message is correct or not, and decrypting the message through a WeChat decryption rule (AES decryption), thereby verifying whether the message is correct or not.
(3) And arranging the decrypted data and notifying a message factory (MessageFactory) to process the data.
Preferably, the basic processing steps of the received message by the message factory (MessageFactory) are as follows:
(1) receiving the message and judging the type of the message;
(2) automatically generating message parameter information, and automatically loading a corresponding processing module through the parameter information;
(3) and after finding out the processing module of the specified message, transmitting the message parameter information into the specified module for processing.
Preferably, the event handler performs the following basic processing steps on the received task:
(1) performing primary processing on the task through the processing task sent by the message factory;
(2) verifying whether the task needs to be processed quickly, if so, quickly replying a set message when a menu is clicked;
(3) and if the received event can not process the reply quickly, the asynchronous task needs to be called to process the reply at the moment.
Preferably, the basic processing steps of the received task by the message processor are as follows:
(1) performing primary processing on the task through the processing task sent by the message factory;
(2) verifying whether the message has a trigger keyword reply or not, if the trigger needs to be rapidly processed, and returning a reply message;
(3) and after the rapid processing is finished, an asynchronous task processing task is automatically added.
Preferably, the asynchronous message processor performs basic processing on the received task as follows:
(1) automatically allocating tasks to be processed through a (threadpool. queueuseworkItem) thread pool;
(2) task processing, which is to process the received message task in the next step;
(3) and if the task needs the system to automatically reply the message, the active messenger is called.
Preferably, the basic processing steps of the active messenger on the received task are as follows:
(1) after receiving the message sending task, firstly arranging the message sending task;
(2) judging whether the vermicelli can actively send the message;
(3) and if the message can be sent, calling a WeChat sending interface and pushing the message to the WeChat.
Compared with the prior art, the invention has the following beneficial effects:
by adopting the technical scheme of the invention, the method has obvious effect on processing and large concurrent processing of multi-type messages (including texts, pictures, voice, videos, pictures, geographical positions and the like). Such as: the video data of the video pushed by the WeChat is generally larger, and the system can directly return to tell the WeChat that the WeChat has been processed after receiving the video type message. Then the system establishes a task for processing the video in parallel, and the task downloads the video and stores the video data to the local. The WeChat public number receives a great amount of various messages every day, and how to ensure the processing efficiency is very suitable for the set of concurrent message processing system.
Drawings
FIG. 1 is a schematic structural diagram of an overall functional framework of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
As shown in fig. 1, the present invention provides a specific embodiment of a wechat public number concurrent message processing system, which includes the following specific steps:
step 1, sending information to a WeChat message unified interface (WebAPI) by a WeChat public number or WeChat push, receiving the information sent by the WeChat public number or the WeChat push by the WeChat message unified interface (WebAPI), decrypting and verifying, and performing the following processing steps after the verification is passed; specifically, the method comprises the following steps:
1-1, verifying whether the WeChat message is sent from the WeChat public signal server or not, and carrying out IP verification through a white list of the WeChat server.
And 1-2, verifying whether the message is correct or not, and decrypting the message by using a WeChat decryption rule (AES decryption). Thereby verifying that the message is correct.
And 1-3, arranging the decrypted data and informing a message factory (MessageFactory) to process the data.
And step 2, a message factory (MessageFactory) receives the message pushed by the WeChat message Uniform interface (WebAPI) and judges the type of the message. And automatically generating message parameter information, and automatically loading the corresponding processing module through the parameter information. After finding out the processing module of the appointed message, the message parameter information is transmitted to the appointed module to be processed.
Step 4, the event processor receives the processing task sent by the message factory and carries out primary processing on the task; the event processor verifies whether the task needs to be processed quickly, for example, a set message needs to be replied quickly when a menu is clicked; if the received event can not process the reply quickly, the asynchronous task is called to process the reply at the moment.
Step 5, the message processor receives a processing task sent by a message factory and performs primary processing on the task; the message processor verifies whether the message has a trigger keyword reply, if the trigger is needed, the message processor carries out quick processing and returns a reply message. After the fast processing is completed, an asynchronous task processing task is automatically added.
And 6, receiving the task to be processed by the (thread. QueuueUserWorkItem) thread pool by the asynchronous message processor. And the next step of processing is carried out on the received message task; if the task requires the system to automatically reply to the message, the message is actively sent on call.
And 7, completing the following operations by the active message sending device: after receiving the message sending task, firstly sorting the message sending task; judging whether the vermicelli can actively send the message; and if the message can be sent, calling a WeChat sending interface, and pushing the message to a WeChat or a WeChat server.
Finally, description of fast processing and task processing:
message processing: after receiving the fan-clicked menu event sent by the WeChat
The message factory determines which specific module should process the menu event, and finds the module to process the event. The message is passed to an event processing module.
And the event processing module sorts the message, judges the event type, finds the automatic reply content corresponding to the time Key and generates a reply message.
The reply message is returned to the WeChat, and a message storage task is established, and the received and replied message is recorded by the task.
Finally, it should be noted that: although the present invention has been described in detail with reference to the foregoing embodiments, it will be apparent to those skilled in the art that changes may be made in the embodiments and/or equivalents thereof without departing from the spirit and scope of the invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (3)

1. A wechat public number concurrent message processing system, comprising: WeChat message unified interface: the system is used for receiving and processing messages pushed by the WeChat and the WeChat public number; a message factory: the processing module is used for receiving the message, judging the type of the message, automatically generating message parameter information, automatically loading the corresponding processing module through the parameter information, finding the processing module of the specified message, and then transmitting the message parameter information to the specified module for processing; an event handler: the system comprises a message factory, a task processing module, a task execution module and a task execution module, wherein the message factory is used for receiving a task sent by the message factory, carrying out primary processing on the task, verifying whether the task needs to be processed quickly or not, and calling asynchronous task processing if a received event cannot be processed and replied quickly; a message processor: the system is used for receiving the task sent by the message factory, carrying out primary processing on the task, verifying whether the message has a trigger keyword reply or not, and if the trigger is required, carrying out rapid processing and returning a reply message; after the rapid processing is completed, an asynchronous task processing task is automatically added; an asynchronous message processor: the system is used for automatically distributing the tasks to be processed through the thread pool, and calling an active message sending device if the tasks need the system to automatically reply messages; an active messaging device: after receiving the message sending task, firstly sorting the message sending task; judging whether the micro credit user can actively send the message; if the message can be sent, a WeChat sending interface is called, and the message is pushed to the WeChat.
2. A wechat, public number concurrent message processing system according to claim 1, wherein the event types are: clicking a menu to obtain the geographical position of the vermicelli; the message types are: text, pictures, voice, video, graphics, and geographic location.
3. A wechat public number concurrent message processing system according to claim 1 or 2, wherein the step of pushing the wechat public number to the message is performed by the wechat message uniform interface as follows:
(1) verifying whether the WeChat message is sent from the WeChat public signal server or not, and carrying out IP verification through a white list of the WeChat server;
(2) verifying whether the message is correct or not, and decrypting the message through a WeChat decryption rule so as to verify whether the message is correct or not;
(3) and arranging the decrypted data and informing a message factory to process the data.
CN201710578068.1A 2017-07-16 2017-07-16 WeChat public number concurrent message processing system Active CN107341059B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710578068.1A CN107341059B (en) 2017-07-16 2017-07-16 WeChat public number concurrent message processing system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710578068.1A CN107341059B (en) 2017-07-16 2017-07-16 WeChat public number concurrent message processing system

Publications (2)

Publication Number Publication Date
CN107341059A CN107341059A (en) 2017-11-10
CN107341059B true CN107341059B (en) 2020-08-21

Family

ID=60218720

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710578068.1A Active CN107341059B (en) 2017-07-16 2017-07-16 WeChat public number concurrent message processing system

Country Status (1)

Country Link
CN (1) CN107341059B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109377162A (en) * 2018-09-25 2019-02-22 浙江工业大学 Intelligent prompt method based on social software
CN110266596B (en) * 2019-06-12 2023-04-18 深圳前海微众银行股份有限公司 Message processing method, device, equipment and computer readable storage medium
CN112612877A (en) * 2020-12-16 2021-04-06 平安普惠企业管理有限公司 Multi-type message intelligent reply method, device, computer equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2015035868A1 (en) * 2013-09-16 2015-03-19 Tencent Technology (Shenzhen) Company Limited Place of interest recommendation
CN105515941A (en) * 2015-11-25 2016-04-20 郑州威尔克科技股份有限公司 Message and event replying method and system in wechat development mode
CN106384249A (en) * 2016-09-13 2017-02-08 四川长虹电器股份有限公司 WeChat official account platform management system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2015035868A1 (en) * 2013-09-16 2015-03-19 Tencent Technology (Shenzhen) Company Limited Place of interest recommendation
CN105515941A (en) * 2015-11-25 2016-04-20 郑州威尔克科技股份有限公司 Message and event replying method and system in wechat development mode
CN106384249A (en) * 2016-09-13 2017-02-08 四川长虹电器股份有限公司 WeChat official account platform management system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
微信公众号消息处理-工厂模式的实例;komyluo;《CSDN》;20170314;第2-6页 *

Also Published As

Publication number Publication date
CN107341059A (en) 2017-11-10

Similar Documents

Publication Publication Date Title
US11290555B2 (en) Push notification delivery system
US8352546B1 (en) Contextual and location awareness for device interaction
CN104618226B (en) A kind of information processing method, client and server
KR101577920B1 (en) Location-based group generation method, apparatus and system
US10560405B2 (en) Ensuring that all users of a group message receive a response to the group message
WO2013049687A1 (en) Message delivery systems and methods
CN107341059B (en) WeChat public number concurrent message processing system
CN109947408B (en) Message pushing method and device, storage medium and electronic equipment
US20170324686A1 (en) System and method for secure and efficient communication within an organization
US20130150098A1 (en) Computer To Mobile Two-Way Chat System And Method
CN114338793B (en) Message pushing method and device, electronic equipment and readable storage medium
CN107749922B (en) Method, machine-readable medium, and system for transmitting messages
US20210112025A1 (en) Method and server for processing messages
US20180343216A1 (en) Context driven modification of attachments in a messaging session
CN112422402A (en) Message forwarding tracing method and device, storage medium and terminal
CN112311750A (en) Interaction method and device and electronic equipment
US11855945B2 (en) Method, computer device, and non-transitory computer-readable recording medium to pick and display message in messaging-based social network service
WO2020251610A1 (en) Executing real-time message monitoring to identify potentially malicious messages and generate instream alerts
CN115567596A (en) Cloud service resource deployment method, device, equipment and storage medium
KR101634896B1 (en) Terminal and operation method of terminal
CN113992352A (en) Message pushing method and device, electronic equipment and storage medium
CN110769386A (en) Short message pushing method and device applied to server side
CN109889590B (en) Message processing method, device, client and computer readable medium
US11176021B2 (en) Messaging systems with improved reliability
US20240080285A1 (en) Information processing method and apparatus, electronic device, and storage medium

Legal Events

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