CN107341059A - A kind of wechat public number concurrent message treatment mechanism - Google Patents

A kind of wechat public number concurrent message treatment mechanism Download PDF

Info

Publication number
CN107341059A
CN107341059A CN201710578068.1A CN201710578068A CN107341059A CN 107341059 A CN107341059 A CN 107341059A CN 201710578068 A CN201710578068 A CN 201710578068A CN 107341059 A CN107341059 A CN 107341059A
Authority
CN
China
Prior art keywords
message
task
wechat
processing
public number
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.)
Granted
Application number
CN201710578068.1A
Other languages
Chinese (zh)
Other versions
CN107341059B (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

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

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Business, Economics & Management (AREA)
  • Software Systems (AREA)
  • General Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • Primary Health Care (AREA)
  • Strategic Management (AREA)
  • Tourism & Hospitality (AREA)
  • Marketing (AREA)
  • General Business, Economics & Management (AREA)
  • Human Resources & Organizations (AREA)
  • General Health & Medical Sciences (AREA)
  • Economics (AREA)
  • General Engineering & Computer Science (AREA)
  • Information Transfer Between Computers (AREA)
  • Computer And Data Communications (AREA)

Abstract

The present invention relates to computer internet technical field, and in particular to a kind of wechat public number concurrent message treatment mechanism.It includes wechat message unified interface, message factory, event handler, message handling device, asynchronous message processor and actively sends message device.Using technical scheme, in multipart(Including text, picture, voice, video, picture and text and geographical position etc.)Processing has obvious effect with big concurrent processing.Such as:The video that wechat push comes, video data is typically all bigger, and system can directly return after the message of video type is received and tell wechat to handle.Then system can establish the task of a processing video parallel, and by this task come foradownloaded video, video data is saved in into local.Wechat public number can receive a large amount of various types of message daily, how ensure that the efficiency of processing is applicable very much using this set concurrent message treatment mechanism of the present invention.

Description

A kind of wechat public number concurrent message treatment mechanism
Technical field
The present invention relates to computer internet technical field, and in particular to a kind of wechat public number concurrent message processor System.
Background technology
Teng Xun companies provide wechat public platform and wechat public number receives the relevant interface of message, define and are opening Under originator pattern, wechat public platform receives common message and receives the data packet format of event push, and sends message Data packet format.
Teng Xun companies only define data packet format and requirement, do not provide data flow and business processing, to use Person's applied software development ability, according to business self-developing.Wechat public platform or wechat public number user can not be quick The application of developer's pattern is completed according to demand, using complexity, adds development difficulty.
The content of the invention
For wechat public number interface requirement, third-party platform is after the message that wechat push comes is received, within 5 seconds It must return to result.So the present invention provides a kind of wechat public number concurrent message processor of efficient process wechat request System.The treatment mechanism is divided into two parts:Quick processing, task processing, what is quickly handled is all institute the problem of needing Quick-return There is the message for not needing Quick-return, all with task processor system.Meanwhile when a large amount of message concurrent processing, by appointing Business manager can ensure that message can be handled quickly.Ensure every message can fast and stable processing.
To reach above-mentioned purpose rapidly and efficiently, the present invention provides following technical scheme:
A kind of wechat public number concurrent message treatment mechanism, including wechat message unified interface:For receiving and handling by wechat And wechat public number pushes the message that comes;
Message factory:For receiving message, judging type of message, message parameter information and automatic by parameter information is automatically generated Processing module corresponding to loading, after the processing module for finding specified message, message parameter information is passed to designated module to handle; Wherein:Processing module refers to same module with designated module.Processing module is described below:Because the message of wechat has very Polytype, each type of processing mode are all different.So we individually propose to make accordingly according to the processing of every kind of message Processing unit(That is processing module).The method of calling of processing module is unified, and the processing logic in different disposal module is Different.Such as:Text message processing module, message factory judges that type of message is text message, just this message transmission Handled to text message processing module.
Event handler:For receiving being sended over by message factory for task and carrying out preliminary treatment to the task, test Whether card task needs quickly to handle, if the event received can not quickly handle reply, at this time just needs to call asynchronous Task is handled.
Message handling device:For receiving being sent by the message factory for task and carrying out preliminary treatment to the task, test Whether card message has triggering keyword to reply, if triggering needs quickly to be handled and return to one to reply message;Quick After the completion of processing, automatic one asynchronous task processing task of addition;
Wherein:Preliminary treatment refers to:The integrality of effect message, message is arranged, annotated message is that type, and extraction is such to disappear The key message of breath facilitates the processing of next step.Such as:What is received is event message, and system can first judge it is what message class Type, is the discovery that event message, and system extracts the specific keyword of event message from message content;
Quick processing refers to:First processing module is called quickly to be handled after receiving message.Judged whether by processing module Need to establish task and continue with;
Asynchronous task processing:It is that pending task is called by message handling device.
Asynchronous message processor:For being distributed automatically by (ThreadPool.QueueUserWorkItem) thread pool Pending task, if task, which needs system to automatically reply message and just call, actively sends message device;
Actively send message device:After transmission message task is received, message task is first arranged;Judge this bean vermicelli(Wherein:Bean vermicelli is Refer to the wechat user of concern wechat public number)Whether message can actively be sent;If can send, call wechat to send and connect Mouthful, push messages to wechat.
As preferable, event type has:Menu is clicked on, obtains bean vermicelli geographical position;Type of message has:Text, picture, Voice, video, picture and text and geographical position.
As preferable, by the push of wechat public number come message handled by wechat message unified interface the step of such as Under:
(1), checking wechat message whether sended over from wechat public number server, pass through wechat server white list carry out IP Checking;
(2), checking message it is whether correct, pass through wechat decryption rule(AES is decrypted)Message is decrypted, so as to verify message It is whether correct.
(3), the data after decryption are arranged, and notification message factory (MessageFactory) is handled.
As preferable, the message factory (MessageFactory) to the basic handling step of received message such as Under:
(1), receive message, judge type of message;
(2), automatically generate message parameter information, and load corresponding processing module automatically by parameter information;
(3), find the processing module of specified message after, message parameter information is passed to designated module to handle.
As preferable, the event handler is as follows to the basic handling step of received task:
(1), the processing task sent by message factory, preliminary treatment is carried out to task;
(2), validation task whether need quickly to handle, such as clicking on menu needs the message of the setting of Quick-return one;
(3)If, the event that receives can not quickly handle reply, at this time just need to call asynchronous task to handle.
As preferable, the message handling device is as follows to the basic handling step of received task:
(1), the processing task sent by message factory, preliminary treatment is carried out to task;
(2), checking message whether there is triggering keyword to reply, if triggering needs quickly to be handled and return to a reply and disappear Breath;
(3), after the completion of quick processing, an asynchronous task processing task can be added automatically.
As preferable, the asynchronous message processor is as follows to the basic handling step of received task:
(1), by (ThreadPool.QueueUserWorkItem) thread pool distribute pending task automatically;
(2), task processing, the processing of next step is carried out to the message task that receives;
(3)If, task need system to automatically reply message, will call actively send message device.
As preferable, the message device that actively sends is as follows to the basic handling step of received task:
(1), when receive send message task after, first arrange message task;
(2), judge whether this bean vermicelli can actively send message;
(3)If, can send, call wechat transmission interface, push messages to wechat.
Compared with prior art, beneficial effects of the present invention are as follows:
Using technical scheme, in multipart(Including text, picture, voice, video, picture and text and geographical position Deng)Processing has obvious effect with big concurrent processing.Such as:The video that wechat push comes, video data is typically all bigger, is System can directly return after the message of video type is received and tell wechat to handle.Then system can establish one parallel The task of individual processing video, by this task come foradownloaded video, local is saved in by video data.Wechat public number can be received daily To a large amount of various types of message, how to ensure that the efficiency of processing is very suitable using this set concurrent message treatment mechanism of the present invention With.
Brief description of the drawings
Fig. 1 is allomeric function circuit theory schematic diagram of the present invention.
Embodiment
Below in conjunction with real-Shi Lizhong of the invention accompanying drawing, the technical scheme in the embodiment of the present invention is carried out clear, complete Site preparation describes, it is clear that described embodiment is only part of the embodiment of the present invention, rather than whole embodiments.It is based on Embodiment in the present invention, those of ordinary skill in the art are obtained every other under the premise of creative work is not made Embodiment, belong to the scope of protection of the invention.
As shown in figure 1, the present invention provides a kind of specific embodiment of wechat public number concurrent message treatment mechanism, specific step It is rapid as follows:
Step 1, wechat message unified interface is pushed information to by wechat public number or wechat(WebAPI), wechat message system One interface(WebAPI)Receive wechat public number or wechat push comes checking is decrypted while information, be verified Carry out following processing step;Specifically:
Whether 1-1, checking wechat message are sended over from wechat public number server, and IP is carried out by wechat server white list Checking.
Whether 1-2, checking message are correct, and rule is decrypted by wechat(AES is decrypted)Message is decrypted.So as to verify Whether message is correct.
1-3, the data after decryption are arranged, and notification message factory (MessageFactory) is handled.
Step 2, message factory (MessageFactory) are received by wechat message unified interface(WebAPI)Push comes Message, and judge type of message.Message parameter information is automatically generated, and loads corresponding processing mould automatically by parameter information Block.After the processing module for finding specified message, message parameter information is passed to designated module to handle.
Step 4, event handler receive the processing task sended over by message factory, and task are tentatively located Reason;Whether event handler validation task needs quickly to handle, and such as clicking on menu needs the message of one setting of Quick-return;Such as The event that fruit receives can not quickly handle reply, at this time just need to call asynchronous task to handle.
Step 5, message handling device receive the processing task sent by message factory, and carry out preliminary treatment to task;Disappear Whether breath processor checking message has triggering keyword to reply, if triggering needs quickly to be handled and return to a reply to disappear Breath.After the completion of quick processing, an asynchronous task processing task can be added automatically.
Step 6, asynchronous message processor are received by (ThreadPool.QueueUserWorkItem) thread pool Lai automatic Distribute pending task.And the message task to receiving carries out the processing of next step;If task needs system to return automatically Multiple message, it will actively send message calling.
Step 7, by actively sending, message device completion is following to be operated:After transmission message task is received, first arrange message and appoint Business;Judge whether this bean vermicelli can actively send message;If can send, wechat transmission interface is called, is pushed messages to Wechat or wechat server.
Finally with respect to the explanation of quick processing and task processing:
Message Processing:After the bean vermicelli click menu event that wechat is sent is received
First judge that menu event should be handled by which specific module by message factory, after the module for finding processing event.Will Message is transmitted to event processing module.
Event processing module arranges message, judges event type, finds automatic reply content corresponding to time Key, generates Reply message.
It will reply message and return to wechat, and establish the task of a message storage, Lai a reception and be returned by this task Multiple Message Record gets off.
Finally it should be noted that:The preferred embodiments of the present invention are the foregoing is only, are not intended to limit the invention, Although the present invention is described in detail with reference to the foregoing embodiments, for those skilled in the art, it still may be used To be modified to the technical scheme described in foregoing embodiments, or equivalent substitution is carried out to which part technical characteristic. Within the spirit and principles of the invention, any modification, equivalent substitution and improvements made etc., it should be included in the present invention's Within protection domain.

Claims (8)

  1. A kind of 1. wechat public number concurrent message treatment mechanism, it is characterised in that including:
    Wechat message unified interface:The message that comes is pushed by wechat and wechat public number for receiving and handling;
    Message factory:For receiving message, judging type of message, message parameter information and automatic by parameter information is automatically generated Processing module corresponding to loading, after the processing module for finding specified message, message parameter information is passed to designated module to handle;
    Event handler:For receiving being sended over by message factory for task and preliminary treatment being carried out to the task, checking is appointed Whether business needs quickly to handle, if the event received can not quickly handle reply, just calls asynchronous task processing;
    Message handling device:For receiving being sent by the message factory for task and carrying out preliminary treatment to the task, checking disappears Whether breath has triggering keyword to reply, if triggering needs quickly to be handled and return to one to reply message;Quickly handling After the completion of, automatic one asynchronous task processing task of addition;
    Asynchronous message processor:For distributing pending task automatically by thread pool, if task needs system to return automatically Multiple message, which is just called, actively sends message device;
    Actively send message device:After transmission message task is received, message task is first arranged;Judge whether this wechat user can be with Actively send message;If can send, wechat transmission interface is called, pushes messages to wechat.
  2. 2. according to a kind of wechat public number concurrent message treatment mechanism described in claim 1, it is characterised in that event type Have:Menu is clicked on, obtains bean vermicelli geographical position;Type of message has:Text, picture, voice, video, picture and text and geographical position.
  3. 3. according to a kind of wechat public number concurrent message treatment mechanism described in claim 1 or 2, it is characterised in that will be micro- It is as follows that letter public number pushes the step of message is handled by wechat message unified interface that come:
    (1), checking wechat message whether sended over from wechat public number server, pass through wechat server white list carry out IP Checking;
    (2), checking message it is whether correct, by wechat decryption rule message is decrypted, so as to verify whether message correct;
    (3), the data after decryption are arranged, and notification message factory is handled.
  4. 4. according to a kind of wechat public number concurrent message treatment mechanism described in claim 1 or 2, it is characterised in that described Message factory is as follows to the basic handling step of received message:
    (1), receive message, judge type of message;
    (2), automatically generate message parameter information, and load corresponding processing module automatically by parameter information;
    (3), find the processing module of specified message after, message parameter information is passed to designated module to handle.
  5. 5. according to a kind of wechat public number concurrent message treatment mechanism described in claim 1 or 2, it is characterised in that described Event handler is as follows to the basic handling step of received task:
    (1), the processing task sent by message factory, preliminary treatment is carried out to task;
    (2), validation task whether need quickly to handle, such as clicking on menu needs the message of the setting of Quick-return one;
    (3)If, the event that receives can not quickly handle reply, at this time just need to call asynchronous task to handle.
  6. 6. according to a kind of wechat public number concurrent message treatment mechanism described in claim 1 or 2, it is characterised in that described Message handling device is as follows to the basic handling step of received task:
    (1), the processing task sent by message factory, preliminary treatment is carried out to task;
    (2), checking message whether there is triggering keyword to reply, if triggering needs quickly to be handled and return to a reply and disappear Breath;
    (3), after the completion of quick processing, an asynchronous task processing task can be added automatically.
  7. 7. according to a kind of wechat public number concurrent message treatment mechanism described in claim 1 or 2, it is characterised in that described Asynchronous message processor is as follows to the basic handling step of received task:
    (1), by thread pool distribute pending task automatically;
    (2), task processing, the processing of next step is carried out to the message task that receives;
    (3)If, task need system to automatically reply message, will call actively send message device.
  8. 8. according to a kind of wechat public number concurrent message treatment mechanism described in claim 1 or 2, it is characterised in that described The basic handling step that message device is actively sent to received task is as follows:
    (1), when receive send message task after, first arrange message task;
    (2), judge whether this bean vermicelli can actively send message;
    (3)If, can send, call wechat transmission interface, push messages to wechat.
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 true CN107341059A (en) 2017-11-10
CN107341059B 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)

Cited By (4)

* 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
CN110266596A (en) * 2019-06-12 2019-09-20 深圳前海微众银行股份有限公司 Message treatment 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
CN113257407A (en) * 2021-05-31 2021-08-13 康键信息技术(深圳)有限公司 Method, device and equipment for processing medical public account message 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》 *

Cited By (4)

* 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
CN110266596A (en) * 2019-06-12 2019-09-20 深圳前海微众银行股份有限公司 Message treatment 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
CN113257407A (en) * 2021-05-31 2021-08-13 康键信息技术(深圳)有限公司 Method, device and equipment for processing medical public account message and storage medium

Also Published As

Publication number Publication date
CN107341059B (en) 2020-08-21

Similar Documents

Publication Publication Date Title
US11206451B2 (en) Information interception processing method, terminal, and computer storage medium
US8848893B2 (en) Method and apparatus for callback processing in telecommunication capability opening
CN105550051B (en) The asynchronous processing method and device of service request
CN107341059A (en) A kind of wechat public number concurrent message treatment mechanism
CN106575222B (en) Js application monitoring
CN103577757A (en) Virus defending method and device
CN107911483A (en) A kind of information transferring method and device
WO2019205555A1 (en) Method and apparatus for pushing message
CN113746722B (en) Information processing method, device, equipment and storage medium
US11553256B2 (en) Method and device for processing message in live broadcast room
CN114338793B (en) Message pushing method and device, electronic equipment and readable storage medium
CN108390786B (en) Business operation and maintenance method and device and electronic equipment
CN110933075A (en) Service calling method and device, electronic equipment and storage medium
CN111367693A (en) Method, system, device and medium for scheduling plug-in tasks based on message queue
CN109725887B (en) Data interaction method and device based on message research and development framework and terminal equipment
CN110928706A (en) Applet interaction method and device, electronic equipment and storage medium
CN112015383A (en) Login method and device
EP3029917A1 (en) Method and system for telecommunication device monitoring
US20160330151A1 (en) Method and system for managing an informational site using a social networking application
CN104702671B (en) Method and server for reporting information
CN115632815A (en) Data updating method and device, electronic equipment and storage medium
CN111988473B (en) Voice communication call control method and device based on intelligent contract
CN113590243A (en) Energy enterprise project creation method and device, computer equipment and medium
US11176021B2 (en) Messaging systems with improved reliability
CN113448931B (en) Data processing method, business transaction platform and business providing platform

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