CN103150601A - Message queue for processing asynchronous electronic ticket businesses - Google Patents

Message queue for processing asynchronous electronic ticket businesses Download PDF

Info

Publication number
CN103150601A
CN103150601A CN 201310050107 CN201310050107A CN103150601A CN 103150601 A CN103150601 A CN 103150601A CN 201310050107 CN201310050107 CN 201310050107 CN 201310050107 A CN201310050107 A CN 201310050107A CN 103150601 A CN103150601 A CN 103150601A
Authority
CN
China
Prior art keywords
formation
middleware
program
ticket
ticket purchasing
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.)
Pending
Application number
CN 201310050107
Other languages
Chinese (zh)
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.)
Individual
Original Assignee
Individual
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 Individual filed Critical Individual
Priority to CN 201310050107 priority Critical patent/CN103150601A/en
Publication of CN103150601A publication Critical patent/CN103150601A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The invention discloses a message queue for processing asynchronous electronic ticket businesses. A ticket buying request queue middleware is imported between a traditional ticket-booking system and a final user; a ticket buying request is stored in a ticket buying request queue by using a queue assembly in the middleware; a message in the queue is processed by using a message consumer program in the middleware; and requests with certain quantity are taken out in batches at intervals according to certain time by the message consumer program according to the processing capacity of the ticket-booking system; the asynchronous interaction is realized by an asynchronous ticket buying window program in the middleware and the user; and the processing is carried out according to an asynchronous mode and the ticket-booking system processes the allocated requests at constant speed under the permission of the processing capacity. According to the method, the problem that a system cannot provide effective service at busy hour is solved.

Description

A kind of message queue of processing non-same period of electronic bill
Technical field
The present invention relates to e-commerce field, relate in particular to the electronic bill field of ecommerce.
Background technology
1. background
In relating to the railway electronic bill, system can't be born for peak treatment capacity seasonal and moment property.For huge treatment capacity, usually adopt multiple servers to carry out dispersion treatment, yet the problem due to China's system and population, adopt common disposal route still to be difficult to deal with problems, in order to bear the peak processing of seasonal and moment property, import the method that a large amount of servers neither an efficient on operating cost.
The Another reason that seat reservation system can't effectively be processed on the peak service is, a transaction (Transaction) needs the time to be processed oversize, in closing the transaction (commit) before, to keep for a long time a session (Session), keep for a long time the information of Session and Transaction and do not discharge, system causes ample resources to be disabled and takies, to such an extent as to can't effectively provide stable service.
And on the other hand, seat reservation system is except the peak period, and system is in the leisure state usually, if can effectively utilize the processing power of its leisure state, just can solve peak treatment capacity problem.
2. problem
Adopt new mode to process the order of electronic bill, problem is processed on the peak that solves 1. seasonalities and moment property, 2. the problem of long-time Session and a large amount of consumption of natural resource of Transaction.
3. invention target
Based on above problem, the present invention proposes new disposal route, process the ticket booking business by ticket purchasing request formation middleware (the Middleware of Request Messages Queue) independently, ticket purchasing request formation middleware becomes the buffering of processing requirements, process wait by formation, shorten the Session of original system and the time of Transaction, thereby the assurance system effectively utilizes resource more.
Summary of the invention
Import ticket purchasing request formation middleware, in order to control 1. ticket booking requirements, 2. the distribution services resource, 3. by noncontemporaneous response mode, return to service result to the user.
Progressive of the present invention is:
1. improve the system service quality by message queue, be specially:
(1) queue management
Described method can avoid a large number of users repeatedly system to be filed a request in order to book tickets
(2) queue priority management
Described method can according to commercial requirement, add priority processing
2. noncontemporaneous reply management, needn't wait for the service processing result online
Description of drawings
Fig. 1 system overview figure
Fig. 2 ticket purchasing request formation of the present invention middleware structure figure
Fig. 3 processing sequential chart of the present invention
Fig. 4 information consumption person routine processes flow process
Embodiment
Before original seat reservation system, import and process the booking queue management middleware that booking requires.
1. requests of disposing in middleware require formation, 2. queue processing disposal route, and are connected with original system.
Middleware does not change the structure of original system as independent product allocation.
Based on above-mentioned background, the present invention adopts as structure as described in figure below:
Fig. 1 system overview figure
As shown in the figure, middleware provided by the invention, and as follows with the system architecture of middleware correlation unit formation of the present invention:
1. the user terminal 10 that uses of user 1 and user
2. network 4
By network, transmit HTTP, SMTP, SMS, PushNotification
3. ticket purchasing request formation middleware 2 of the present invention
In ticket purchasing request formation middleware, management ticket purchasing request 20 consists of if former seat reservation system is the multiple services device, by the partition management algorithm, will ask balance to be assigned to (Load Balancer) seat reservation system 3.
4. seat reservation system.
The present invention is connected with seat reservation system, but does not relate to the seat reservation system inter-process.Seat reservation system belongs to public's knowledge for existing service.
5. the database 31 of former seat reservation system.
In order to control the formation number, middleware of the present invention adopts the directly mode of inquiry vacant seat data.
Fig. 2 ticket purchasing request formation of the present invention middleware structure figure
As shown in the figure, ticket purchasing request formation middleware structure 2 of the present invention is:
1. the formation assembly 21
Adopt queue data structure, JMS (Java Message Service) that also can Application standard EnterpriseJava definition, the existing assemblies such as IBM webSphere MQ.Described JMS and MQ have the processed function, utilize the said goods, only need to set the priority project.As not using the said goods, construct voluntarily queue structure, also can add prioritized item in data structure, by to prioritization, adjust the order in formation.Sort method and queue structure are general public's knowledge.
2. the ticket purchasing request formation 22
Definition in formation assembly 21, the ticket purchasing request formation, according to practical business, the maximum length of definition formation, the maximum length of every information, the store method of definition formation can adopt file to preserve or the database store method in practice.
3. the booking window writing routine 23
HTTP post mode is used at the ticketing interface that replaces original system to provide, and the ticket purchasing request of user's input is passed to system, and is different with the ticketing interface of original system, and what HTTP returned is not transaction results, but ticket purchasing request is accepted notice.Described booking window writing routine uses the WEB program code to realize, usually uses JSP and java servlet also can use other equivalent technology to replace.
4. information consumption person's program 24
Be used for monitoring the event of message queue, when in message queue 22, request message being arranged, request processed, proxy results is returned to the user.Information consumption person's program 24 is started by upper MessageDrivenBean (MDB), for guaranteeing threadSafe, adopts the constructive accounting actual loads such as singleton, and message event monitors by MessageListener.Information consumption person's program is taken out message from message queue 22, and processes.Information consumption person's program processing method is described in detail in follow-up chapters and sections.
Fig. 3 processing sequential chart of the present invention
As shown in the figure, the present invention processes sequential and is
S1. user 1 user holds end 10, and access booking window writing routine 23 in the booking picture that booking window writing routine 23 provides, is filled in required booking information,
S2. the booking window writing routine 23, receive booking information by the Post mode of http, and user profile, and submit booking information to ticket purchasing request formation 23
S3. the booking window writing routine 23, do not wait for the result of original system and directly return to the user, and submit to the user to accept result.The user selects online ajax pattern to wait for, or the modes such as note, mail, IM, non-same period the reception ﹠ disposal result;
S4. the ticket purchasing request formation 23, write ticket purchasing request information, and according to prioritization.
S5. information consumption person's program 24, by Listener, receive message event
S6. information consumption person's program 24, take out the message of some (n) bars, and process
S7. information consumption person's program 24 with the booking requirement, is transferred to original system (for newly-built system, only transmitting Data Object) by original http post mode
S8. original system according to original processing, is completed the ticket booking transaction, and is returned to result
S9. information consumption person's program 24, return to result by Ajax, if the user has selected off-line waiting, send the non-synchronizing modes such as note
If S10. message queue 23 is empty, information consumption person's program 24 enters resting state, otherwise information consumption person's program 24 continues to receive the message of some bars
Information consumption person's program structure
Information consumption person's program of the present invention is take the Message Driven Bean of Java as the example explanation.Information consumption person's program actual load MDB and MessageListener
public?class?TicketRequestQCMDB?implements?MessageDrivenBean,?MessageListener
And under the onMessage method, add initiation message consumer's method, as:
Figure BDA0000283223711
For guaranteeing ThreadSafe, information consumption person (Consumer Class) uses singlton pattern actual load.
Fig. 4 information consumption person routine processes flow process
C1. information consumption person's program 24 is received message event
When adopting MDB to control, in order to economize on resources, can end the control of MDB.Also can by the setting of suspend-seconds, allow MDB have a rest.
C2. information consumption person's program 24, according to priority level, and the certain hour interval, the requirement of taking out certain number of packages,
(1) requirement of described certain number of packages, its number of packages are larger (m, n), i.e. m, and the higher value in n, wherein
N processes number of packages, and described processing number of packages for the best thread number of original system, is namely processed best number of packages simultaneously.In case of necessity, original system is carried out the optimum test, to determine the optimization process number of packages
The remaining number of packages of m formation
For reducing repeatedly with reference to formation, can be at information consumption person's program program inner setting variable: the remaining number of packages of formation.Larger (m, n)=m the time, set m=m-n
(2) described certain hour interval T is being processed a collection of needed optimal time interval that requires for the ticket booking disposal system, in case of necessity, seat reservation system is carried out the optimum test, with calculating optimal time interval.
(3) sequence of described priority is processed, and is completed by formation assembly 21.Sequence is treated to public's knowledge.
(4) definition of described prioritization, definition in ticket purchasing request formation 22, the definition of priority is carried out according to business need, generally can be according to give a definition
1. member's grade
2. preengage the time on date
3. require the class of service
According to the preservation form of message queue, can use different sort methods.As preserving when the message opposition adopts database mode, can sort by the function that database provides, in the situation that the employing document form is preserved, sort by sequencer program, the algorithm of the insertion position of the new data after sequence uses 2 fork number traversals.Above algorithm is general public's knowledge.
C3. information consumption person's program 24, according to equalization algorithm, will require to pass to seat reservation system
Described equalization algorithm, can simply adopt the Round-robin mode, the Round-robin disposal route is general public's knowledge, as former seat reservation system according to load equalizer need not in middleware of the present invention to set this function, otherwise use the equalization algorithm of middleware lower than load equalizer cost.
C4. process the vacant seat number, vacant seat number=vacant seat number-processing number
Described vacant seat number for avoiding repeatedly accessing the database 31 of original system, is therefore preserved in the total field of described middleware (internal memory), if middleware adopts multi thread, perhaps multiplex needs the problem of consideration thread safe.
C5. notify booking window writing routine vacant seat number
As equal replacement, the booking window writing routine can be initiatively with reference to the vacant seat number, and expression is to the online user.
C6. judge whether formation is empty, if enter C7, otherwise, repeat C2 after rest certain hour interval T
C7. wait for the next group processing requirements, information consumption person's program enters resting state.
By above implementation method, the present invention has realized utilizing the method for the non-ticket service same period of queue processing
More than used specific case that specific embodiments of the invention are described, the explanation of this embodiment just is used for helping to understand method of the present invention and core concept; For one of ordinary skill in the art, according to thought of the present invention, all have in specific embodiments and applications change and change part simultaneously, such as
1. little modification structure of the present invention, increase/reduce non-significant element, and it is intensive or be independent of correlation unit;
2. the inching of implementation step order will not be as there is no the processing transposing of sequencing;
Therefore, this description should not be construed as limitation of the present invention, and all any modifications of doing within the spirit and principles in the present invention, the improvement of replacing on an equal basis, deleting additional step all are included in of the present invention comprising in scope.
Any improvement that proposes on basis of the present invention, according to its advance, originality, the claim limitation that not proposed by the present invention.

Claims (4)

1. ticket purchasing request formation middleware of processing non-same period of electronic bill, described ticket purchasing request formation middleware is characterized in that
(1) be connected with user terminal by network
(2) reply user's result of booking tickets the non-same period
(3) according to priority, according to certain intervals some ground, submit to seat reservation system to process ticket purchasing request in formation.
2. ticket purchasing request formation middleware as claimed in claim 1, is characterized in that comprising
(1) formation assembly is used for the physics save data
(2) ticket purchasing request formation is for the treatment of ticket purchasing request
(3) booking window writing routine, for the treatment of and user interactions
(4) information consumption person's program is for the treatment of request.
3. as claim 2, described information consumption person's program is characterized in that comprising following steps in the processing messages method
(1) information consumption person's program is received message event
(2) information consumption person's program according to priority level, according to the certain hour interval, is taken out the requirement of certain number of packages,
(3) information consumption person's program according to equalization algorithm, will require to pass to seat reservation system
(4) process the vacant seat number
(5) notice booking window writing routine vacant seat number
(6) judge that whether formation is empty, if the dormant state of entering, otherwise repeating step (2) behind rest certain hour interval.
4. as claim 2, described ticket purchasing request formation, information consumption person's program is characterized in that carrying out prioritization for message request processes.
CN 201310050107 2013-02-07 2013-02-07 Message queue for processing asynchronous electronic ticket businesses Pending CN103150601A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 201310050107 CN103150601A (en) 2013-02-07 2013-02-07 Message queue for processing asynchronous electronic ticket businesses

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 201310050107 CN103150601A (en) 2013-02-07 2013-02-07 Message queue for processing asynchronous electronic ticket businesses

Publications (1)

Publication Number Publication Date
CN103150601A true CN103150601A (en) 2013-06-12

Family

ID=48548662

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 201310050107 Pending CN103150601A (en) 2013-02-07 2013-02-07 Message queue for processing asynchronous electronic ticket businesses

Country Status (1)

Country Link
CN (1) CN103150601A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105989632A (en) * 2015-02-27 2016-10-05 深圳市金溢科技股份有限公司 Free flow system and transaction method and device thereof
TWI713802B (en) * 2017-11-20 2020-12-21 拓元股份有限公司 Deployment system for internet ticketing operations

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105989632A (en) * 2015-02-27 2016-10-05 深圳市金溢科技股份有限公司 Free flow system and transaction method and device thereof
CN105989632B (en) * 2015-02-27 2019-05-10 深圳市金溢科技股份有限公司 A kind of free flow system and its method of commerce and device
TWI713802B (en) * 2017-11-20 2020-12-21 拓元股份有限公司 Deployment system for internet ticketing operations

Similar Documents

Publication Publication Date Title
CN106657193B (en) A kind of request processing method, device, terminal device and server
CN102426542B (en) Resource management system for data center and operation calling method
CN105306277A (en) Message scheduling method and message scheduling device for message queues
CN105160572A (en) Device and method for controlling order to generate, and seckilling system
CN103024014A (en) Method and system for distributing and processing mass data passing through message queues
CN108111554B (en) Control method and device for access queue
US20140304713A1 (en) Method and apparatus for distributed processing tasks
CN109961306B (en) Method and device for distributing inventory of articles
US20120278513A1 (en) Priority scheduling for multi-channel context aware communication technology
CN110866709A (en) Order combination method and device
US20170155596A1 (en) Method And Electronic Device For Bandwidth Allocation
Das et al. A QoS and profit aware cloud confederation model for IaaS service providers
CN103294548A (en) Distributed file system based IO (input output) request dispatching method and system
KR101612682B1 (en) Method, system and computer program product for sequencing asynchronous messages in a distributed and parallel environment
CN112686528B (en) Method, device, server and medium for distributing customer service resources
CN104731645A (en) Task scheduling method and device and data downloading method and device
CN108681481A (en) The processing method and processing device of service request
WO2011150601A1 (en) Transaction processing system
CN103475730A (en) Method for selecting web services guided by user certainty degree in Cloud environment
CN103150601A (en) Message queue for processing asynchronous electronic ticket businesses
CN110365749A (en) Information push method, message push system and a kind of storage medium
CN110247808B (en) Information transmission method, device, equipment and readable storage medium
CN106506660A (en) A kind of online request processing method, server and system
Shen A hierarchical task scheduling strategy in mobile edge computing
CN102915497B (en) Internet-based safety information interaction device and method

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C02 Deemed withdrawal of patent application after publication (patent law 2001)
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20130612