CN111309492A - Data transmission method and device - Google Patents

Data transmission method and device Download PDF

Info

Publication number
CN111309492A
CN111309492A CN201811517801.XA CN201811517801A CN111309492A CN 111309492 A CN111309492 A CN 111309492A CN 201811517801 A CN201811517801 A CN 201811517801A CN 111309492 A CN111309492 A CN 111309492A
Authority
CN
China
Prior art keywords
order
message
data object
data
type
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
CN201811517801.XA
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.)
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information 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 Beijing Jingdong Century Trading Co Ltd, Beijing Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN201811517801.XA priority Critical patent/CN111309492A/en
Publication of CN111309492A publication Critical patent/CN111309492A/en
Pending legal-status Critical Current

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/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • 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
    • G06Q30/00Commerce
    • G06Q30/06Buying, selling or leasing transactions
    • G06Q30/0601Electronic shopping [e-shopping]
    • G06Q30/0633Lists, e.g. purchase orders, compilation or processing
    • G06Q30/0635Processing of requisition or of purchase orders

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Finance (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Accounting & Taxation (AREA)
  • General Engineering & Computer Science (AREA)
  • Development Economics (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Strategic Management (AREA)
  • General Business, Economics & Management (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

The invention discloses a data transmission method and device, and relates to the technical field of computers. One embodiment of the method comprises: respectively receiving an order message and an order packing message transmitted in a paging transmission mode; the order packing message comprises an order packing message and/or an order box message; respectively assembling an order data object and an order packaging data object according to the order message and the order packaging message; wherein the order packed data object comprises an order parcel data object and/or an order box data object; and storing the order data object and the order packaging data object into a database. The implementation mode can solve the technical problem that the memory cannot be released due to mass data transmission.

Description

Data transmission method and device
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a data transmission method and apparatus.
Background
In the existing data transmission across systems and applications, a large number of asynchronous transmission modes of MQ (message queue) are used, the transmission modes need to define messages for transmission in advance upstream and downstream according to service requirements, a producer assembles data and sends the messages according to a message format for data transmission, and a consumer also analyzes the messages according to the message format for subsequent service processing.
For example, when the warehouse returns the delivery data detail, an order will return a large number of data fields, such as: the order master file, the order details, the packaged package data, the packaged box data, the consumable material information and the like are required to be combined, assembled and stored in the database. It can be seen that when the order delivery data transmission is performed, the existing message is a large message, all fields are placed in the message, and the transmission is performed through an MQ.
In the process of implementing the invention, the inventor finds that at least the following problems exist in the prior art:
for the current data transmission mode, the medium and small data volume can not affect the system performance, but when the data volume is increased, the message is also increased, and the message transmission of several to tens of megabytes is caused. In order to process the messages with large data volume, the system inevitably generates large data objects, and the objects are always in the memory, so that the memory can not be released and the CPU utilization rate is high during data storage and processing.
Disclosure of Invention
In view of this, embodiments of the present invention provide a data transmission method and apparatus, so as to solve the technical problem that a memory cannot be released due to mass data transmission.
To achieve the above object, according to an aspect of an embodiment of the present invention, there is provided a data transmission method including:
respectively receiving an order message and an order packing message transmitted in a paging transmission mode; the order packing message comprises an order packing message and/or an order box message;
respectively assembling an order data object and an order packaging data object according to the order message and the order packaging message; wherein the order packed data object comprises an order parcel data object and/or an order box data object;
and storing the order data object and the order packaging data object into a database.
Optionally, the order message includes an order number, an order type, a current page number, and a total page number; the order package message comprises an order number, a package type, a current page number and a total page number; the order box message includes an order number, a box type, a current page number, and a total number of pages.
Optionally, before assembling the order data object and the order packed data object according to the order message and the order packed message, respectively, the method further includes:
respectively generating a key and a value according to the received order message and the order packing message, and storing the key and the value in a cache; the key comprises an order number, a message type, a current page number and a total page array, the value is the receiving time of the order message or the order packaging message, and the message type is one of the order type, the package type and the box type.
Optionally, assembling an order data object and an order packed data object according to the order message and the order packed message, respectively, including:
respectively generating keys according to the order message and the order packing message;
comparing whether the key is the same as the key stored in the cache or not; if not, assembling the order message into an order data object, assembling the order packed message into the order packed data object, and storing the key and the value corresponding to the key into a cache; if yes, the process is ended.
Optionally, after the order data object and the order packed data object are stored in the database, the method further includes:
writing the message type, page number data and deletion state of the order message and the order packaging message into a task table;
scanning data records in the task table, wherein the deleted state is undeleted;
and for each message type, if the sum of the page number data of the message type in the task table is the same as the total page number of the message type, deleting all the data records of the message type in the task table.
Optionally, after writing the message type, the page number data, and the deletion state of the order message and the order packaging message into a task table, the method further includes:
scanning data records with undeleted deletion states in the task table at intervals;
and for each message type, if the sum of the page number data of the message type in the task table is less than the total page number of the message type, sending a data pulling request, wherein the data pulling request carries the message type and the missing page number data corresponding to the message type.
In addition, according to another aspect of the embodiments of the present invention, there is provided a data transmission apparatus including:
the receiving module is used for respectively receiving the order message and the order packing message transmitted in a paging transmission mode; the order packing message comprises an order packing message and/or an order box message;
the assembling module is used for respectively assembling the order data object and the order packaging data object according to the order message and the order packaging message; wherein the order packed data object comprises an order parcel data object and/or an order box data object;
and the storage module is used for storing the order data object and the order packed data object into a database.
Optionally, the order message includes an order number, an order type, a current page number, and a total page number; the order package message comprises an order number, a package type, a current page number and a total page number; the order box message includes an order number, a box type, a current page number, and a total number of pages.
Optionally, the assembly module is further configured to:
before an order data object and an order packed data object are assembled respectively according to the order message and the order packed message, respectively generating a key and a value according to the received order message and the order packed message, and storing the key and the value in a cache; the key comprises an order number, a message type, a current page number and a total page number, the value is the receiving time of the order message or the order packaging message, and the message type is one of the order type, the package type and the box type.
Optionally, the assembly module is configured to:
respectively generating keys according to the order message and the order packing message;
comparing whether the key is the same as the key stored in the cache or not; if not, assembling the order message into an order data object, assembling the order packed message into the order packed data object, and storing the key and the value corresponding to the key into a cache; if yes, the process is ended.
Optionally, the system further comprises a deleting module, configured to:
after the order data object and the order packaging data object are stored in a database, writing the message types, page number data and deletion states of the order message and the order packaging message into a task table;
scanning data records in the task table, wherein the deleted state is undeleted;
and for each message type, if the sum of the page number data of the message type in the task table is the same as the total page number of the message type, deleting all the data records of the message type in the task table.
Optionally, the system further comprises a timing task module, configured to:
after the order data object and the order packed data object are stored in a database, scanning data records in the task table, the deleted state of which is not deleted, at intervals;
and for each message type, if the sum of the page number data of the message type in the task table is less than the total page number of the message type, sending a data pulling request, wherein the data pulling request carries the message type and the missing page number data corresponding to the message type.
According to another aspect of the embodiments of the present invention, there is also provided an electronic device, including:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any of the embodiments described above.
According to another aspect of the embodiments of the present invention, there is also provided a computer readable medium, on which a computer program is stored, which when executed by a processor implements the method of any of the above embodiments.
One embodiment of the above invention has the following advantages or benefits: because the technical means of respectively receiving the order message and the order packed message transmitted in a paging transmission mode and respectively assembling the order message and the order packed message into the order data object and the order packed data object is adopted, the technical problem that the memory cannot be released due to large-batch data transmission is solved. The embodiment of the invention divides the original message into a plurality of messages and further pages the messages, thereby carrying out data blocking and batch processing in a paging transmission mode and avoiding generating large data objects. Therefore, after the page data is stored, the embodiment of the invention can quickly release the memory, thereby reducing the utilization rate of the CPU, and particularly having more obvious effect in the scene of large order delivery messages.
Further effects of the above-mentioned non-conventional alternatives will be 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 schematic diagram of a main flow of a data transmission method according to an embodiment of the present invention;
fig. 2 is a schematic diagram of splitting an existing message according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of saving data according to an embodiment of the invention;
FIG. 4 is a schematic diagram of initiating a timed task according to an embodiment of the present invention;
fig. 5 is a schematic diagram of a main flow of a data transmission method according to a referential embodiment of the present invention;
FIG. 6 is a schematic diagram of the main modules of a data transmission device according to an embodiment of the present invention;
FIG. 7 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
fig. 8 is a schematic structural diagram of a computer system suitable for implementing a terminal device or a server according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as 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.
Fig. 1 is a schematic diagram of a main flow of a data transmission method according to an embodiment of the present invention. As an embodiment of the present invention, as shown in fig. 1, the data transmission method may include:
step 101, receiving an order message and an order packing message transmitted in a paging transmission mode respectively; the order packing message comprises an order packing message and/or an order box message.
Aiming at the problem of large data volume transmission in the prior art, the embodiment of the invention splits the existing message, so that the message can be transmitted in blocks and processed in batches. Specifically, the existing message is split into an order message and an order packing message, wherein the order packing message includes an order packing message and/or an order box message. It should be noted that, depending on the warehouse-out requirement, the order packaging data may include package data (delivered in a package manner), box data (delivered in a box manner), and both package data and box data.
As shown in fig. 2, the existing message is a large message, all fields are placed in the large message, and the existing message mainly comprises an order master file, order details, packaged package data, packaged box data and the like, and is transmitted through an MQ. The embodiment of the invention divides the existing message into an order message (order master file + order details), an order wrapping message (order number + wrapped data) and an order box message (order number + wrapped box data), and transmits the three messages through three MQ.
And when the data volume is large, performing paging transmission processing on the order message, the order package message and the order box message respectively. The order message comprises an order main file, paging information and order details, the order package message comprises an order number, paging information, package information and package details, and the order box message comprises the order number, the paging information, box information and box details. Wherein the current page number and the total number of pages.
Generally, for shipping data with large data volume, one order number may correspond to a plurality of packages and a plurality of boxes, and after the order message, the order package message and the order box message are subjected to paging processing, each page is transmitted according to a predetermined data volume, and the data of each page constitutes one message. The paged messages are subjected to data transmission through the corresponding MQ, for example, the order messages are transmitted through the order MQ, the order package messages are transmitted through the package MQ, and the order box messages are transmitted through the box MQ. Therefore, the embodiment of the invention respectively receives the order message and the order packing message transmitted in a paging transmission mode, so that the messages can be processed in batches in the subsequent steps.
102, respectively assembling an order data object and an order packaging data object according to the order message and the order packaging message; wherein the order packed data object comprises an order parcel data object and/or an order box data object.
After receiving the order message and the order packing message transmitted in a paging transmission mode, respectively assembling the order message and the order packing message into an order data object and an order packing data object. Optionally, the assembly may be performed by means of field mapping. For example, the order master document message is a DeliveryBatch object that needs to be converted to a SoMain object in the database.
After each part of paging messages is received, data re-protection processing is required based on idempotent consideration, for example, verification can be performed in a re-protection key mode. In another embodiment of the present invention, before step 102, the method further comprises: respectively generating a key and a value according to the received order message and the order packing message, and storing the key and the value in a cache; the key comprises an order number, a message type, a current page number and a total page number, the value is the receiving time of the order message or the order packaging message, and the message type is one of the order type, the package type and the box type. Therefore, the embodiment of the invention adopts a key-value form to store in the cache, so that the re-check is prevented through the key, and the repeated storage of data is avoided.
As still another embodiment of the present invention, the step 102 may specifically include: respectively generating a key and a value according to the order message and the order packaging message; comparing whether the key is the same as the key stored in the cache or not; if not, assembling the order message into an order data object, assembling the order packed message into the order packed data object, and storing the key and the value corresponding to the key into a cache; if yes, the process is ended.
Optionally, the key may be composed of an order number + underline + message type + underline + current page number + underline + total page number, and the order message, the order package message, and the order box message are still taken as examples for detailed description. As shown in fig. 3, if an order message is received, generating a key, namely, order number _ order type _ current page number _ total page number, according to field information in the order message; if an order package message is received, generating a key according to field information in the order package message, wherein the key comprises an order number, a package type, a current page number and a total page number; if an order box message is received, generating a key according to field information in the order box message, wherein the order number is the order box type, the current page number is the total page number. And comparing the generated key with the stored key in the cache, and if the same key does not exist, indicating that the message is not stored in the database, and assembling nth page data according to the field information in the message as shown in fig. 3. If the same key exists, the message is stored in the database, and the message can be discarded without being processed.
And 103, storing the order data object and the order packed data object in a database.
In this step, the order data object and the order packed data object assembled in step 102 are saved to a database. Wherein the order packed data object comprises an order parcel data object and/or an order box data object. As shown in fig. 3, the assembled nth page order data is stored in the database, the assembled nth page order package data is stored in the database, and the assembled nth page order box data is stored in the database.
Optionally, for each type of message, determining whether all the messages of the type have been transmitted and stored according to the number of pages of the stored data and the total number of pages, if so, performing subsequent logic processing, and if not, continuing to receive the message data.
As a further embodiment of the present invention, after step 103, the method further comprises: writing the message type, page number data and deletion state of the order message and the order packaging message into a task table; scanning data records in the task table, wherein the deleted state is undeleted; and for each message type, if the sum of the page number data of the message type in the task table is the same as the total page number of the message type, deleting all the data records of the message type in the task table. In this embodiment, a task table (msgdata _ task) needs to be created first, and after the order data object and the order packed data object are stored in the database, the message type, the page number data, and the deletion state of the order message and the order packed message are written in the task table. For example, taking the order type as an example, as shown in fig. 4, after the order data object is saved in the database, the order type, the current page number, the total page number, the message receiving time, and the deletion state (yn is 1) are written into the task table, the data record in the deletion state of 1 in the task table is scanned, and if the sum of the page number data corresponding to the order type in the data task table is the same as the total page number of the order type, which indicates that the order data of each page is completely transmitted, all the data records corresponding to the order type in the task table are deleted (yn is 0). In the embodiment of the present invention, yn in the task table refers to logical deletion, 1 indicates not deleted, 0 indicates deleted, and only data records with yn being 1 are scanned.
In yet another embodiment of the present invention, after writing the message type, the page number data, and the deletion status of the order message and the order packaging message into a task table, the method further includes: scanning data records with undeleted deletion states in the task table at intervals; and for each message type, if the sum of the page number data of the message type in the task table is less than the total page number of the message type, sending a data pulling request, wherein the data pulling request carries the message type and the missing page number data corresponding to the message type.
In consideration of the disorder of message transmission and the condition that messages are possibly lost in transmission, the embodiment of the invention ensures that all pages of the three types of messages are completely transmitted through a message timing pulling mechanism. The mechanism is implemented by using a clover timing task, and a time threshold can be configured in advance, for example, the clover task scans once every hour, scans once every three hours, or scans once every six hours, and the like, and the configuration is performed as required.
As shown in fig. 4, when receiving the message data of each page, the message type, the current page number, the total page number, the message receiving time, the deletion state, and the like are saved in the msgdata _ task table (yn is 1), it is determined whether all the page numbers have been received and saved by scanning the msgdata _ task table, and if all the page numbers have been received and saved, all the data records corresponding to the same message type (order type, order parcel type, or order box type) are logically deleted from the msgdata _ task table (yn is 0), which means that a clover is not required to scan these data records.
When a preset time is reached (for example, scanning is performed once every hour), a timing task clover is started, and the clover scans all data records which are not completely transmitted within one hour (yn is 1), so that page data which are not received within one hour are obtained. And if the data of a certain page of a certain type is not received after more than one hour, sending a data pulling request, wherein the data pulling request carries the message type and the missing page number data corresponding to the message type. For example, an interface for pulling a message in the warehouse may be called to notify the warehouse of a message with a corresponding number of pages that is not returned, and data is received again.
According to the various embodiments described above, it can be seen that the technical means of the present invention is to receive the order message and the order packet message transmitted in the paging transmission manner, and assemble the order message and the order packet message into the order data object and the order packet data object, respectively, thereby solving the problem that the memory cannot be released due to the mass data transmission. The embodiment of the invention divides the original message into a plurality of messages and further pages the messages, thereby carrying out data blocking and batch processing in a paging transmission mode and avoiding generating large data objects. Therefore, after the page data is stored, the embodiment of the invention can quickly release the memory, thereby reducing the utilization rate of the CPU, and particularly having more obvious effect in the scene of large order delivery messages.
Fig. 5 is a schematic diagram of a main flow of a data transmission method according to a reference embodiment of the present invention, where the data transmission method may specifically include:
step 501, receiving an order message, an order package message and an order box message transmitted in a paging transmission mode respectively;
step 502, according to the order message, the order package message and the order box message, keys are respectively carried out; the order number, the order type, the current page number and the total page number are used as keys, the order number, the package type, the current page number and the total page number are used as keys, and the order number, the box type, the current page number and the total page number are used as keys;
step 503, comparing whether the key is the same as the key stored in the cache; if yes, ending; if not, go to step 504;
step 504, assembling the order message into an order data object, assembling the order wrapped message into an order wrapped data object, and assembling the order box message into an order box data object;
step 505, storing the order data object, the order package data object and the order box data object in a database;
step 506, storing the key and the value corresponding to the key into a cache;
step 507, storing the order message, the message types of the order wrapping message and the order box message, the current page number, the total page number, the message receiving time, the deleting state and the like into an msgdata _ task table;
step 508, scanning the data records in the msgdata _ task table, wherein the deleted state is not deleted;
step 509, for each message type, if the sum of the page number data of the message type in the task table is the same as the total page number of the message type, deleting all the data records of the message type in the task table.
In addition, in one embodiment of the present invention, the detailed implementation of the data transmission method is described in detail above, so that the repeated content will not be described herein.
Fig. 6 is a schematic diagram of main modules of a data transmission device according to an embodiment of the present invention, and as shown in fig. 6, the data transmission device 600 includes a receiving module 601, an assembling module 602, and a storing module 603. The receiving module 601 receives an order message and an order packing message transmitted in a paging transmission manner, respectively; the order packing message comprises an order packing message and/or an order box message; the assembling module 602 assembles an order data object and an order packed data object respectively according to the order message and the order packed message; wherein the order packed data object comprises an order parcel data object and/or an order box data object; the saving module 603 saves the order data object and the order packed data object in a database.
Optionally, the order message includes an order number, an order type, a current page number, and a total page number; the order package message comprises an order number, a package type, a current page number and a total page number; the order box message includes an order number, a box type, a current page number, and a total number of pages.
Optionally, before respectively assembling the order data object and the order packed data object according to the order message and the order packed message, the assembling module 602 respectively generates a key and a value according to the received order message and the received order packed message, and stores the key and the value in the cache; the key comprises an order number, a message type, a current page number and a total page number, the value is the receiving time of the order message or the order packaging message, and the message type is one of the order type, the package type and the box type.
Optionally, the assembling module 602 generates keys according to the order message and the order packing message respectively; comparing whether the key is the same as the key stored in the cache or not; if not, assembling the order message into an order data object, assembling the order packed message into the order packed data object, and storing the key and the value corresponding to the key into a cache; if yes, the process is ended.
Optionally, the apparatus further includes a deletion module, and after the order data object and the order packed data object are stored in a database, the deletion module writes the message type, the page number data, and the deletion state of the order message and the order packed message into a task table; scanning data records in the task table, wherein the deleted state is undeleted; and for each message type, if the sum of the page number data of the message type in the task table is the same as the total page number of the message type, deleting all the data records of the message type in the task table.
Optionally, the apparatus further includes a timed task module, and after the order data object and the order packed data object are stored in the database, the timed task module scans data records in the task table, which are deleted at intervals and are in an undeleted state; and for each message type, if the sum of the page number data of the message type in the task table is less than the total page number of the message type, sending a data pulling request, wherein the data pulling request carries the message type and the missing page number data corresponding to the message type.
According to the various embodiments described above, it can be seen that the technical means of the present invention is to receive the order message and the order packet message transmitted in the paging transmission manner, and assemble the order message and the order packet message into the order data object and the order packet data object, respectively, thereby solving the problem that the memory cannot be released due to the mass data transmission. The embodiment of the invention divides the original message into a plurality of messages and further pages the messages, thereby carrying out data blocking and batch processing in a paging transmission mode and avoiding generating large data objects. Therefore, after the page data is stored, the embodiment of the invention can quickly release the memory, thereby reducing the utilization rate of the CPU, and particularly having more obvious effect in the scene of large order delivery messages.
It should be noted that, in the implementation of the data transmission device of the present invention, the data transmission method has been described in detail above, and therefore, the repeated content herein is not described again.
Fig. 7 shows an exemplary system architecture 700 to which the data transmission method or the data transmission apparatus of the embodiments of the present invention can be applied.
As shown in fig. 7, the system architecture 700 may include terminal devices 701, 702, 703, a network 704, and a server 705. The network 704 serves to provide a medium for communication links between the terminal devices 701, 702, 703 and the server 705. Network 704 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
A user may use the terminal devices 701, 702, 703 to interact with a server 704 over a network 704 to receive or send messages or the like. The terminal devices 701, 702, 703 may have installed thereon various communication client applications, such as a shopping-like application, a web browser application, a search-like application, an instant messaging tool, a mailbox client, social platform software, etc. (by way of example only).
The terminal devices 701, 702, 703 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 705 may be a server providing various services, such as a background management server (for example only) providing support for shopping websites browsed by users using the terminal devices 701, 702, 703. The background management server may analyze and process the received data such as the product information query request, and feed back a processing result (for example, target push information and product information — only an example) to the terminal device.
It should be noted that the data transmission method provided in the embodiment of the present invention is generally executed on the terminal devices 701, 702, and 703 in the public place, and may also be executed by the server 705, and accordingly, the data transmission apparatus is generally installed on the terminal devices 701, 702, and 703 in the public place, and may also be installed in the server 705.
It should be understood that the number of terminal devices, networks, and servers in fig. 7 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 8, shown is a block diagram of a computer system 800 suitable for use with a terminal device implementing an embodiment of the present invention. The terminal device shown in fig. 8 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 8, the computer system 800 includes a Central Processing Unit (CPU)801 that can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)802 or a program loaded from a storage section 808 into a Random Access Memory (RAM) 803. In the RAM803, various programs and data necessary for the operation of the system 800 are also stored. The CPU 801, ROM 802, and RAM803 are connected to each other via a bus 804. An input/output (I/O) interface 805 is also connected to bus 804.
The following components are connected to the I/O interface 805: an input portion 806 including a keyboard, a mouse, and the like; an output section 807 including a signal such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 808 including a hard disk and the like; and a communication section 809 including a network interface card such as a LAN card, a modem, or the like. The communication section 809 performs communication processing via a network such as the internet. A drive 810 is also connected to the I/O interface 805 as necessary. A removable medium 811 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 810 as necessary, so that a computer program read out therefrom is mounted on the storage section 808 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the 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 illustrated in the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication section 809 and/or installed from the removable medium 811. The computer program executes the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 801.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination 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 present invention, 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, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. 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 flowchart 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 described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor includes a receiving module, an assembling module, and a storing module, where the names of the modules do not in some cases constitute a limitation on the modules themselves.
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 separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise: respectively receiving an order message and an order packing message transmitted in a paging transmission mode; the order packing message comprises an order packing message and/or an order box message; respectively assembling an order data object and an order packaging data object according to the order message and the order packaging message; wherein the order packed data object comprises an order parcel data object and/or an order box data object; and storing the order data object and the order packaging data object into a database.
According to the technical scheme of the embodiment of the invention, because the technical means of respectively receiving the order message and the order packed message transmitted in the paging transmission mode and respectively assembling the order message and the order packed message into the order data object and the order packed data object is adopted, the technical problem that the memory cannot be released due to mass data transmission is solved. The embodiment of the invention divides the original message into a plurality of messages and further pages the messages, thereby carrying out data blocking and batch processing in a paging transmission mode and avoiding generating large data objects. Therefore, after the page data is stored, the embodiment of the invention can quickly release the memory, thereby reducing the utilization rate of the CPU, and particularly having more obvious effect in the scene of large order delivery messages.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (14)

1. A method of data transmission, comprising:
respectively receiving an order message and an order packing message transmitted in a paging transmission mode; the order packing message comprises an order packing message and/or an order box message;
respectively assembling an order data object and an order packaging data object according to the order message and the order packaging message; wherein the order packed data object comprises an order parcel data object and/or an order box data object;
and storing the order data object and the order packaging data object into a database.
2. The method of claim 1, wherein the order message includes an order number, an order type, a current page number, and a total number of pages; the order package message comprises an order number, a package type, a current page number and a total page number; the order box message includes an order number, a box type, a current page number, and a total number of pages.
3. The method of claim 2, wherein before assembling the order data object and the order packed data object from the order message and the order packed message, respectively, further comprising:
respectively generating a key and a value according to the received order message and the order packing message, and storing the key and the value in a cache; the key comprises an order number, a message type, a current page number and a total page number, the value is the receiving time of the order message or the order packaging message, and the message type is one of the order type, the package type and the box type.
4. The method of claim 2, wherein assembling the order data object and the order packed data object from the order message and the order packed message, respectively, comprises:
respectively generating keys according to the order message and the order packing message;
comparing whether the key is the same as the key stored in the cache or not; if not, assembling the order message into an order data object, assembling the order packed message into the order packed data object, and storing the key and the value corresponding to the key into a cache; if yes, the process is ended.
5. The method of claim 2, wherein after saving the order data object and the order packed data object to the database, further comprising:
writing the message type, page number data and deletion state of the order message and the order packaging message into a task table;
scanning data records in the task table, wherein the deleted state is undeleted;
and for each message type, if the sum of the page number data of the message type in the task table is the same as the total page number of the message type, deleting all the data records of the message type in the task table.
6. The method of claim 5, wherein after writing the message type, page number data, and deletion status of the order message and the order package message into a task table, further comprising:
scanning data records with undeleted deletion states in the task table at intervals;
and for each message type, if the sum of the page number data of the message type in the task table is less than the total page number of the message type, sending a data pulling request, wherein the data pulling request carries the message type and the missing page number data corresponding to the message type.
7. A data transmission apparatus, comprising:
the receiving module is used for respectively receiving the order message and the order packing message transmitted in a paging transmission mode; the order packing message comprises an order packing message and/or an order box message;
the assembling module is used for respectively assembling the order data object and the order packaging data object according to the order message and the order packaging message; wherein the order packed data object comprises an order parcel data object and/or an order box data object;
and the storage module is used for storing the order data object and the order packed data object into a database.
8. The apparatus of claim 7, wherein the order message includes an order number, an order type, a current page number, and a total number of pages; the order package message comprises an order number, a package type, a current page number and a total page number; the order box message includes an order number, a box type, a current page number, and a total number of pages.
9. The apparatus of claim 8, wherein the assembly module is further configured to:
before an order data object and an order packed data object are assembled respectively according to the order message and the order packed message, respectively generating a key and a value according to the received order message and the order packed message, and storing the key and the value in a cache; the key comprises an order number, a message type, a current page number and a total page number, the value is the receiving time of the order message or the order packaging message, and the message type is one of the order type, the package type and the box type.
10. The apparatus of claim 8, wherein the assembly module is to:
respectively generating keys according to the order message and the order packing message;
comparing whether the key is the same as the key stored in the cache or not; if not, assembling the order message into an order data object, assembling the order packed message into the order packed data object, and storing the key and the value corresponding to the key into a cache; if yes, the process is ended.
11. The apparatus of claim 7, further comprising a deletion module to:
after the order data object and the order packaging data object are stored in a database, writing the message types, page number data and deletion states of the order message and the order packaging message into a task table;
scanning data records in the task table, wherein the deleted state is undeleted;
and for each message type, if the sum of the page number data of the message type in the task table is the same as the total page number of the message type, deleting all the data records of the message type in the task table.
12. The apparatus of claim 11, further comprising a timing task module configured to:
after the order data object and the order packed data object are stored in a database, scanning data records in the task table, the deleted state of which is not deleted, at intervals;
and for each message type, if the sum of the page number data of the message type in the task table is less than the total page number of the message type, sending a data pulling request, wherein the data pulling request carries the message type and the missing page number data corresponding to the message type.
13. An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-6.
14. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-6.
CN201811517801.XA 2018-12-12 2018-12-12 Data transmission method and device Pending CN111309492A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811517801.XA CN111309492A (en) 2018-12-12 2018-12-12 Data transmission method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811517801.XA CN111309492A (en) 2018-12-12 2018-12-12 Data transmission method and device

Publications (1)

Publication Number Publication Date
CN111309492A true CN111309492A (en) 2020-06-19

Family

ID=71161295

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811517801.XA Pending CN111309492A (en) 2018-12-12 2018-12-12 Data transmission method and device

Country Status (1)

Country Link
CN (1) CN111309492A (en)

Similar Documents

Publication Publication Date Title
US10142398B2 (en) Method and system for file transfer over a messaging infrastructure
US10249070B2 (en) Dynamic interaction graphs with probabilistic edge decay
CN110572422A (en) Data downloading method and device
CN110928905B (en) Data processing method and device
CN110795315A (en) Method and device for monitoring service
CN111339057A (en) Method, apparatus and computer readable storage medium for reducing back-to-source requests
CN110555068A (en) Data export method and device
CN112748866A (en) Method and device for processing incremental index data
CN113535420A (en) Message processing method and device
CN113452733A (en) File downloading method and device
CN113127225A (en) Method, device and system for scheduling data processing tasks
CN109241040B (en) Data cleaning method and device
CN111309492A (en) Data transmission method and device
CN113347052B (en) Method and device for counting user access data through access log
CN111177109A (en) Method and device for deleting overdue key
CN113760861A (en) Data migration method and device
CN114116675A (en) Data archiving method and device
CN114490050A (en) Data synchronization method and device
CN114493875A (en) Transaction execution method, computer device, and storage medium
CN112688982B (en) User request processing method and device
CN112699116A (en) Data processing method and system
CN112148705A (en) Data migration method and device
CN113704222A (en) Method and device for processing service request
CN113626176A (en) Service request processing method and device
CN112152915A (en) Message forwarding network system and message forwarding method

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