CN112187785A - Message processing method and device, electronic equipment and storage medium - Google Patents
Message processing method and device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN112187785A CN112187785A CN202011025384.4A CN202011025384A CN112187785A CN 112187785 A CN112187785 A CN 112187785A CN 202011025384 A CN202011025384 A CN 202011025384A CN 112187785 A CN112187785 A CN 112187785A
- Authority
- CN
- China
- Prior art keywords
- application
- message
- sent
- delay
- scene
- 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
Links
- 238000003672 processing method Methods 0.000 title claims abstract description 20
- 238000012545 processing Methods 0.000 claims abstract description 90
- 238000000034 method Methods 0.000 claims abstract description 86
- 238000004590 computer program Methods 0.000 claims description 12
- 230000006870 function Effects 0.000 description 38
- 230000008569 process Effects 0.000 description 29
- 230000007246 mechanism Effects 0.000 description 15
- 238000013475 authorization Methods 0.000 description 14
- 230000003111 delayed effect Effects 0.000 description 12
- 239000008186 active pharmaceutical agent Substances 0.000 description 10
- 238000010586 diagram Methods 0.000 description 8
- 230000005540 biological transmission Effects 0.000 description 7
- 230000001360 synchronised effect Effects 0.000 description 6
- 238000012795 verification Methods 0.000 description 6
- 238000012827 research and development Methods 0.000 description 5
- 238000012544 monitoring process Methods 0.000 description 4
- 230000002085 persistent effect Effects 0.000 description 4
- 238000004891 communication Methods 0.000 description 3
- 230000003993 interaction Effects 0.000 description 3
- 238000007726 management method Methods 0.000 description 3
- 238000012790 confirmation Methods 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 230000003068 static effect Effects 0.000 description 2
- 238000010200 validation analysis Methods 0.000 description 2
- 230000006978 adaptation Effects 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 235000019800 disodium phosphate Nutrition 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005538 encapsulation Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000004806 packaging method and process Methods 0.000 description 1
- 230000002688 persistence Effects 0.000 description 1
- 230000004044 response Effects 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L63/00—Network architectures or network communication protocols for network security
- H04L63/08—Network architectures or network communication protocols for network security for authentication of entities
- H04L63/0807—Network architectures or network communication protocols for network security for authentication of entities using tickets, e.g. Kerberos
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/546—Message passing systems or structures, e.g. queues
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L63/00—Network architectures or network communication protocols for network security
- H04L63/08—Network architectures or network communication protocols for network security for authentication of entities
- H04L63/0876—Network architectures or network communication protocols for network security for authentication of entities based on the identity of the terminal or configuration, e.g. MAC address, hardware or software configuration or device fingerprint
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2209/00—Indexing scheme relating to G06F9/00
- G06F2209/54—Indexing scheme relating to G06F9/54
- G06F2209/547—Messaging middleware
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2209/00—Indexing scheme relating to G06F9/00
- G06F2209/54—Indexing scheme relating to G06F9/54
- G06F2209/548—Queue
Landscapes
- Engineering & Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Computer Security & Cryptography (AREA)
- Computing Systems (AREA)
- Computer Hardware Design (AREA)
- Signal Processing (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Power Engineering (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Storage Device Security (AREA)
Abstract
The invention discloses a message processing method, a message processing device, electronic equipment and a storage medium. The method comprises the following steps: a first application sends first information to a delay platform, wherein the first information comprises a message to be sent, a first token (token), a scene key value and a first application identifier; the first token and the first application identifier are used for authenticating the message to be sent, so that the message to be sent is subjected to delay processing after the authentication is passed, and the message to be sent is sent through a consumption queue corresponding to the scene key value in the delay platform after the delay processing.
Description
Technical Field
The present invention relates to the field of information technologies, and in particular, to a message processing method and apparatus, an electronic device, and a storage medium.
Background
In daily work, scenes which need to send messages in a delayed mode are often involved. The sender of the message, namely the producer, firstly accesses the delay platform, then sends the message to the delay platform, and the delay platform processes the message by using the internal delay logic and then sends the message to the corresponding consumer accessed to the delay platform.
Because the delay platform only verifies the account and the password of the producer or the consumer when the producer sends the message or the consumer receives the message, the producer can send the message to a plurality of queues in the delay platform or the consumer can receive the messages of the plurality of queues, so that the message is not safe in the transmission process.
Therefore, the message sending mode in the related art needs to be optimized.
Disclosure of Invention
In order to solve the related technical problems, embodiments of the present invention provide a message processing method, an apparatus, an electronic device, and a storage medium.
The technical scheme of the embodiment of the invention is realized as follows:
the embodiment of the invention provides a message processing method, which is applied to a first application and comprises the following steps:
sending first information to a delay platform, wherein the first information comprises a message to be sent, a first token (token), a scene key value and a first application identifier; the first token and the first application identifier are used for authenticating the message to be sent, so that the message to be sent is subjected to delay processing after the authentication is passed, and the message to be sent is sent through a consumption queue corresponding to the scene key value in the delay platform after the delay processing.
In the above scheme, the method further comprises:
acquiring a first application key and a scene key value from the delay platform;
generating the first token with the first application key, the first application identification, and based on Chiwikson (JWT).
In the foregoing solution, the obtaining a first application key and a scene key from the delay platform includes:
sending an application access request to the delay platform; receiving a first application key sent by the delay platform based on the application access request;
sending a scene generation request to the delay platform; and receiving a scene key value sent by the delay platform based on the scene generation request.
The embodiment of the invention also provides a message processing method, which is applied to a delay platform and comprises the following steps:
receiving first information sent by a first application, wherein the first information comprises a message to be sent, a first token, a scene key value and a first application identifier;
authenticating the message to be sent by utilizing the first token and the first application identifier;
and after the authentication is passed, performing delay processing on the message to be sent, and after the delay processing is completed, sending the message to be sent to a second application corresponding to a consumption queue through the consumption queue corresponding to the scene key value contained in the first information.
In the above scheme, the method further comprises:
and providing a first application key and a scene key value to the first application.
In the foregoing solution, the providing a first application key and a scenario key value to the first application includes:
receiving an application access request sent by a first application, and sending a first application key to the first application based on the application access request;
receiving a scene generation request sent by a first application, and sending a scene key value to the first application based on the scene generation request.
In the foregoing scheme, the authenticating the message to be sent by using the first token and the first application identifier includes:
the first token is authenticated using the first application key in conjunction with JWT.
In the above scheme, the method further comprises:
receiving a consumption queue acquisition request sent by a second application; the consumption queue acquisition request carries a second token, a scene key value and a second application identifier;
authenticating the second application based on the second token and a second application identifier;
and after the authentication is passed, determining a consumption queue corresponding to the second application based on a scene key value carried by the consumption queue acquisition request.
In the foregoing solution, the authenticating the second application based on the second token and the second application identifier includes:
and verifying the second token by utilizing the second application key and combining JWT.
In the above scheme, the method further comprises:
and providing a second application key and a scene key value to the second application.
In the foregoing solution, the providing a second application key and a scene key to the second application includes:
receiving an application access request sent by a second application, and sending a second application key to the second application based on the application access request;
receiving a scene generation request sent by a second application, and sending a scene key value to the second application based on the scene generation request.
In the above scheme, the method further comprises:
and recording the sending state of the message to be sent.
The embodiment of the invention also provides a message processing method, which is applied to the second application and comprises the following steps:
and receiving a message sent by the delay platform through the consumption queue corresponding to the scene key value of the second application.
In the above scheme, the method further comprises:
sending a consumption queue acquisition request to the delay platform; the consumption queue acquisition request carries a second token, a scene key value of the second application and a second application identifier; the second token and the second application identifier are used for authenticating the second application, so that after the authentication is passed, based on a scene key value of the second application, a consumption queue corresponding to the second application is determined.
In the above scheme, the method further comprises:
acquiring a second application key and a scene key value of a second application from the delay platform;
generating the second token based on JWT using the second application key, the second application identification.
In the foregoing solution, the obtaining a second application key and a scene key value of the second application from the delay platform includes:
sending an application access request to the delay platform; receiving a second application key sent by the delay platform based on the application access request;
sending a scene generation request to the delay platform; receiving a scene key value sent by the delay platform based on the scene generation request
An embodiment of the present invention further provides a message processing apparatus, including:
the system comprises a sending module, a delay platform and a receiving module, wherein the sending module is used for sending first information to the delay platform, and the first information comprises a message to be sent, a first token, a scene key value and a first application identifier; the first token and the first application identifier are used for authenticating the message to be sent, so that the message to be sent is subjected to delay processing after the authentication is passed, and the message to be sent is sent through a consumption queue corresponding to the scene key value in the delay platform after the delay processing.
An embodiment of the present invention further provides a message processing apparatus, including:
the receiving module is used for receiving first information sent by a first application, wherein the first information comprises a message to be sent, a first token, a scene key value and a first application identifier;
the authentication module is used for authenticating the message to be sent by utilizing the first token and the first application identifier;
and the sending module is used for performing delay processing on the message to be sent after the authentication is passed, and sending the message to be sent to a second application corresponding to a consumption queue through the consumption queue corresponding to the scene key value contained in the first message after the delay processing is completed.
An embodiment of the present invention further provides a message processing apparatus, including:
and the receiving module is used for receiving the message sent by the delay platform through the consumption queue corresponding to the scene key value of the second application.
An embodiment of the present invention further provides an electronic device, including: a processor and a memory for storing a computer program capable of running on the processor; wherein,
the processor is configured to execute the steps of any one of the methods of the first application side, or execute the steps of any one of the methods of the delay platform side, or execute the steps of any one of the methods of the second application side when running the computer program.
An embodiment of the present invention further provides a storage medium, where a computer program is stored in the storage medium, and when the computer program is executed by a processor, the steps of any method on the first application side are implemented, or the steps of any method on the delay platform side are implemented, or the steps of any method on the second application side are implemented.
According to the message processing method and device, the electronic device and the storage medium provided by the embodiment of the invention, the first application sends the first information to the delay platform, wherein the first information comprises a message to be sent, a first token, a scene key value and a first application identifier; the first token and the first application identifier are used for authenticating the message to be sent, so that the message to be sent is subjected to delay processing after the authentication is passed, and the message to be sent is sent out through a consumption queue corresponding to the scene key value in the delay platform after the delay processing; after receiving first information sent by a first application, a delay platform authenticates the message to be sent by utilizing the first token and a first application identifier; and after the authentication is passed, performing delay processing on the message to be sent, and after the delay processing is completed, sending the message to be sent to a second application corresponding to a consumption queue through the consumption queue corresponding to the scene key value contained in the first information. According to the scheme of the embodiment of the invention, the token, the scene key value and the application identifier are provided for each accessor (which can be understood as a first application or a second application) of the delay platform, so that each accessor can only send the message to the consumption queue corresponding to the scene key value or obtain the message from the consumption queue corresponding to the scene key value after passing the authentication based on the application identifier and the token, and the safety of the message is ensured.
Drawings
Fig. 1 is a schematic flowchart of a message processing method according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating another message processing method according to an embodiment of the present invention;
FIG. 3 is a system diagram illustrating an exemplary embodiment of the present invention;
FIG. 4 is a schematic diagram of a framework layer for implementing the function of a delay platform according to an embodiment of the present invention;
FIG. 5 is a flow chart of a message flow process according to an embodiment of the present invention;
FIG. 6 is a flow chart of a process for a producer to access a delay platform for applying for authorization according to an embodiment of the present invention;
FIG. 7 is a flowchart illustrating a process of a consumer applying for authorization to access a delay platform according to an embodiment of the present invention;
FIG. 8 is a flow chart illustrating a process for a manufacturer to perform security verification according to an embodiment of the present invention;
FIG. 9 is a flow chart illustrating a process for a consumer to perform security mechanism verification according to an embodiment of the present invention;
FIG. 10 is a diagram illustrating sending log records according to an embodiment of the present invention;
FIG. 11 is a diagram illustrating message flow to log records according to an embodiment of the present invention;
FIG. 12 is a diagram illustrating a message processing apparatus according to an embodiment of the present invention;
FIG. 13 is a diagram illustrating another message processing apparatus according to an embodiment of the present invention;
FIG. 14 is a diagram illustrating a structure of another message processing apparatus according to another embodiment of the present invention;
fig. 15 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples.
Before describing embodiments of the present invention, the following terms are explained:
software Development Kit (SDK), a collection of related documents, paradigms, and tools that assist in developing a certain class of Software. SDKs were developed to reduce programmer workload.
In daily life, there are often scenarios involving the need for delayed transmission of messages, which may be referred to as delayed messages. A delayed message (also referred to as a delayed message) refers to a message that cannot be consumed (i.e., received immediately and processed accordingly) immediately by a consumer (i.e., an application that receives a message and processes the received message accordingly) after a producer (i.e., an application that generates a message to be sent) generates the message, but that needs to wait until a specified sending time before the message can be consumed. The application scenarios are many, for example, after a user places an order, payment needs to be made within a specified time ((e.g. 30 minutes), a message can be sent to remind the user of making payment before the specified time is reached, a short message is sent after the order is generated and delayed for 1 minute (the message is generated by a producer) to remind the user of making payment, and a short message is sent after the short message is sent for 1 minute to remind the user of making payment.
At present, in the related art, when a producer or a consumer transmits a message through a message middleware, only an account and a password are provided, the message middleware only verifies the account and the password of the message, and the message is not associated with a service scene in the transmission mode, so that in the related art, one account can send the message to a plurality of queues or consume the message in any queue, and the concept of a service tenant does not exist, so that the message is not safe in the transmission process.
Based on this, in various embodiments of the present invention, an application identifier and a scene key value are provided for an access party accessing a delay platform, the access party is authenticated by combining a JWT authentication security mechanism based on the application identifier (for example, an application ID), and after the authentication is passed, only a message with the scene key value can be sent by a corresponding consumption queue, and accordingly, a consumer can only obtain the message from the consumption queue corresponding to the scene key value, that is, only the message in the consumption queue corresponding to the scene key value can be consumed. Therefore, the safety of the message in the transmission process is ensured.
The embodiment of the invention provides a message processing method, which is applied to a first application and comprises the following steps:
sending first information to a delay platform, wherein the first information comprises a message to be sent, a first token, a scene key value and a first application identifier;
the first token and the first application identifier are used for the delay platform to authenticate the message to be sent, so that the message to be sent is subjected to delay processing after the authentication is passed, and the message to be sent is sent through a consumption queue corresponding to the scene key value in the delay platform after the delay processing.
In practice, the first application may be understood as a producer of the message, i.e. an application program that generates the message.
In practical applications, the delay platform may be understood as a platform for performing delay processing on a message, and the platform receives a message sent by a producer (which may be understood as a first application), and sends the received message to a consumer (which may be understood as a second application) after performing delay processing on the received message based on delay logic inside the delay platform.
In actual application, the first application needs to obtain a first token; meanwhile, JWT is a JSON-based open standard implemented for passing declarations between network application environments.
Based on this, in an embodiment, a first application utilizes the first application key, the first application identification, and generates the first token based on JWT.
During actual application, before generating the first token, the first application needs to acquire a first application key and a scene key value from the delay platform.
Here, in an embodiment, the acquiring the first application key and the scenario key from the latency platform includes:
sending an application access request to the delay platform; receiving a first application key sent by the delay platform based on the application access request;
sending a scene generation request to the delay platform; and receiving a scene key value sent by the delay platform based on the scene generation request.
Here, in the delay platform, one scene key corresponds to one consumption queue, that is, the scene key corresponds to the consumption queue one to one.
During actual application, the delay platform generates a first application key based on an application access request of the first application, stores the first application key, and authenticates the first token by using the stored first application key in the subsequent message processing process, thereby realizing authentication of the message to be sent.
Correspondingly, an embodiment of the present invention further provides a message processing method, which is applied to a delay platform, and as shown in fig. 1, the method includes:
step 101: receiving first information sent by a first application, wherein the first information comprises a message to be sent, a first token, a scene key value and a first application identifier;
step 102: authenticating the message to be sent by utilizing the first token and the first application identifier;
step 103: and after the authentication is passed, performing delay processing on the message to be sent, and after the delay processing is completed, sending the message to be sent to a second application corresponding to a consumption queue through the consumption queue corresponding to the scene key value contained in the first information.
In practice, the second application may be understood as a recipient of the message, i.e. an application program that receives the message.
In actual application, before first information sent by a first application is received, a first application key and a scene key value are provided for the first application.
In an embodiment, the providing a first application key and a scenario key value to the first application includes:
receiving an application access request sent by a first application, and sending a first application key to the first application based on the application access request;
receiving a scene generation request sent by a first application, and sending a scene key value to the first application based on the scene generation request.
Here, after receiving the scene generation request sent by the first application, the delay platform generates a scene key value for the first application, and creates a corresponding consumption queue, so that the message to be sent is sent through the created consumption queue in the following.
In actual application, before the message to be sent on the consumption queue is sent to the corresponding second application, the second application corresponding to the consumption queue is determined.
Based on this, in an embodiment, the method may further include:
receiving a consumption queue acquisition request sent by a second application; the consumption queue acquisition request carries a second token, a scene key value and a second application identifier;
authenticating the second application based on the second token and a second application identifier;
and after the authentication is passed, determining a consumption queue corresponding to the second application based on a scene key value carried by the consumption queue acquisition request.
In actual application, before receiving a consumption queue acquisition request sent by a second application, the delay platform needs to provide a second application key and a scene key value to the second application.
In an embodiment, the providing a second application key and a scene key to the second application includes:
receiving an application access request sent by a second application, and sending a second application key to the second application based on the application access request;
receiving a scene generation request sent by a second application, and sending a scene key value to the second application based on the scene generation request.
In practical application, after the delay platform generates a second application key based on an application access request of a second application, the delay platform stores the second application key, and authenticates the second token by using the stored second application key in the subsequent message processing process, thereby realizing the authentication of the message to be sent.
In practical application, in order to ensure traceability of the message in the delay platform, the sending state of the message to be sent can be recorded. The sending state of the message to be sent represents whether the message is received or not, whether the message is consumed or not, and the like, and specifically includes: a message has been received and not consumed, or a message has been received and consumed, etc.
Illustratively, when a message to be sent from a first application is received, the sending state of the message to be sent is recorded as 0, and the representation delay platform receives the message and does not send the message to a second application, that is, the representation message is received and is not consumed; and after the delay platform sends the message to the second application, recording the sending state of the message to be sent as 1, and representing that the delay platform sends the message to the second application, namely representing that the message is received and consumed.
By the mode, the sending state of the message can be tracked, the sending state of the message can be inquired, the sending process of the message is monitored, and the inquiry is facilitated when the message is lost.
Correspondingly, the embodiment of the invention also provides a message processing method, which is applied to the second application and comprises the following steps:
and receiving a message sent by the delay platform through the consumption queue corresponding to the scene key value of the second application.
In practical application, before receiving a message sent by a consumption queue corresponding to a scene key value, the consumption queue corresponding to the acquired scene key value needs to be determined.
Based on this, in an embodiment, the method may further include:
sending a consumption queue acquisition request to the delay platform; the consumption queue acquisition request carries a second token, a scene key value of the second application and a second application identifier; wherein,
the second token and the second application identifier are used for the delay platform to authenticate the second application; and after the authentication is passed, determining a consumption queue corresponding to the second application based on the scene key value of the second application.
And in actual application, the second application generates the second token by using the second application key and the second application identifier and based on JWT.
In an embodiment, the obtaining a second application key and a scene key of the second application from the delay platform includes:
sending an application access request to the delay platform; receiving a second application key sent by the delay platform based on the application access request;
sending a scene generation request to the delay platform; and receiving a scene key value sent by the delay platform based on the scene generation request.
In practical application, the specific operation of message transmission between the delay platform and the access person (referring to the producer or the consumer) can be realized based on the SDK, and the SDK encapsulates the intermediate step of accessing the producer or the consumer to the delay platform, so that developers do not need to spend a large amount of time on developing source codes, the workload of the developers is reduced, and the working efficiency of the developers is improved.
An embodiment of the present invention further provides a message processing method, as shown in fig. 2, the method includes:
step 201: a first application sends a first message to a delay platform, wherein the first message comprises a message to be sent, a first token, a scene key value and a first application identifier;
step 202: after receiving the first information, the delay platform authenticates the message to be sent by using the first token and the first application identifier;
step 203: after the authentication of the message to be sent is passed, the delay platform carries out delay processing on the message to be sent, and after the delay processing is finished, the message to be sent is sent to a second application corresponding to a consumption queue through a consumption queue corresponding to a scene key value contained in the first message;
step 204: and the second application receives a message sent by the delay platform through a consumption queue corresponding to the scene key value acquired from the delay platform.
Here, it should be noted that: the specific processing procedures of the first application, the delay platform and the second application are described in detail above, and are not described herein again.
In addition, the system in which the first application is located (or referred to as the hardware device (which may be referred to as an electronic device) in which the first application is located), the latency platform, and the system in which the second application is located (or referred to as the hardware device on which the second application depends) are independent systems. The interaction among the three can be based on a wired mode and can also be based on a wireless mode.
In the message processing method provided by the embodiment of the invention, a first application sends first information to a delay platform, wherein the first information comprises a message to be sent, a first token, a scene key value and a first application identifier; the first token and the first application identifier are used for authenticating the message to be sent, so that the message to be sent is subjected to delay processing after the authentication is passed, and the message to be sent is sent out through a consumption queue corresponding to the scene key value in the delay platform after the delay processing; after receiving first information sent by a first application, a delay platform authenticates the message to be sent by utilizing the first token and a first application identifier; and after the authentication is passed, performing delay processing on the message to be sent, and after the delay processing is completed, sending the message to be sent to a second application corresponding to a consumption queue through the consumption queue corresponding to the scene key value contained in the first information. According to the scheme of the embodiment of the invention, the token, the scene key value and the application identifier are provided for each accessor (which can be understood as a first application or a second application) of the delay platform, so that each accessor can only send the message to the consumption queue corresponding to the scene key value or obtain the message from the consumption queue corresponding to the scene key value after passing the authentication based on the application identifier and the token, and the safety of the message is ensured.
The present invention will be described in further detail with reference to the following application examples.
The present application embodiment provides a new authentication security mechanism, which provides an application identifier and a scenario key value for an access party (which may be understood as a producer or a consumer in the above embodiment) accessing a delay platform, and drives with an SDK, so that the access party can only send authorized messages (i.e., the producer (producer of the message) can only send the authorized messages), and can only consume the messages in an authorized queue (i.e., the consumer (consumer receiving the message) can only consume the messages in the authorized queue).
Taking the scenario "after the user places an order, the user needs to pay within the specified time (for example, 30 minutes), and send a message to remind the user to pay at the 15 th minute before the specified time arrives" as an example, referring to fig. 3, the components and the functions corresponding to the components in the embodiment of the present application are described:
(1) producer (english may be expressed as Producer) (e.g. order system in the above scenario): the method is used for sending a message (equivalent to the message to be sent in the above embodiment) needing time delay to the time delay platform after the user completes the order, wherein the time delay of the message is 15 minutes, and the message content is "you have an unpaid order to pay in time".
(2) Latency platform (english can be expressed as Broker): the message storage module is used for storing the message after receiving the message; the message is delayed, and after the delay processing is completed, the message is sent to a target message queue (which is equivalent to the consumption queue corresponding to the scene key in the above embodiment), so that the message is sent to the consumer through the target message queue.
(3) Consumer (english may be expressed as Consumer) (e.g. the sms system in the above scenario): and the message receiving module is used for receiving the message sent by the delay platform.
It should be noted that the producer, the delay platform, and the consumer may be deployed on multiple devices, and the devices communicate with each other in a wireless or wired manner. In actual application, the hardware resources of each device are independently deployed based on requirements.
As can be seen from the above description, the latency platform mainly implements the latency of the message. The delay platform (also called delay platform) in the embodiment of the application is an independent system, receives the delay message of the specified expiration time sent by the producer, and sends the expiration message to the consumer through the consumption queue.
As shown in fig. 4, the architecture layer for implementing the function of the delay platform is introduced:
graphical management interface (English can express Dashboard) layer: the foreground operation interface is a delay platform and is used for managing authority creation and authority distribution to each producer and consumer, checking the message running state and monitoring the running state of the platform in real time;
and (3) an SDK layer: the system is mainly arranged at the side of an accessor (a producer or a consumer) (also can be understood as an SDK layer installed on equipment where the accessor is located) and is used for helping research and development personnel to access the producer and the consumer to a delay platform, so that the delay platform function is uniformly used in a code program when the producer and the consumer send delay messages and receive delay messages; specifically, the SDK layer is mainly responsible for overall arrangement, and mainly includes intermediate steps of access by a packaging producer or a consumer and message delay processing, so that the producer only needs to provide a message and other information necessary for sending the message, the consumer only needs to determine which producer's message is received, and the specific execution in the message sending process is performed by the SDK layer. The SDK layer may specifically perform uniform format processing on a message generated by a producer, and determine a unique identifier of the message, a stored queue name, an account password, an IP address and a port number of a consumer corresponding to the message, and the like. Here, in practical application, the function of the SDK layer can be implemented by the SDK layer, and a developer does not need to spend a lot of time developing source codes.
Interface (API) layer: for a function interface exposed to the outside by the delay platform (for example, a function of communicating with an item (referring to a producer or a consumer) accessed to an SDK layer), interfaces for receiving delay messages, returning messages, authenticating a user access API, authenticating a configuration rule API of the delay platform, inquiring a message interface (English can express a Trace API) and the like are provided; the system comprises a receiving delay message interface and a message return interface, wherein the receiving delay message interface and the message return interface are used for receiving messages sent by a producer through an SDK layer or sending the messages to a consumer through the SDK layer; the user access API authentication interface, and the configuration rule API and the TraceAPI of the delay platform are used for providing interfaces for functions such as message query and rule configuration.
Interface Service (API-Service) layer: the core service layer for realizing the delay function for the delay platform is used for realizing the functions of Message (Message) encapsulation and adaptation, core delay logic, delay circulation and the like.
A persistent layer: the storage system can be an external storage system connected with the delay platform and used for providing a storage function for the delay platform, persistently storing messages needing to be delayed in the delay platform, and storing the messages through mongoDB (the name of a database based on distributed file storage), Mysql (the name of a relational database management system) and RocktMq (the name of a message middleware). The mongoDB is used for storing flow information such as message flow logs and the like; mysql is used to store received messages; the rocktmq is provided with 18 delay queues with fixed time length, and the corresponding delay time lengths are as follows: 1 second, 5 seconds, 10 seconds, 30 seconds, 1 minute, 2 minutes, 3 minutes, 4 minutes, 5 minutes, 6 minutes, 7 minutes, 8 minutes, 9 minutes, 10 minutes, 20 minutes, 30 minutes, 1 hour, 2 hours. Wherein, the 18 delay queues can realize the storage in the message delay processing process. Here, the delay queue is a queue having a queue function and a delay function.
In the embodiment of the application, scheduling of the delay message is mainly realized in an "API-Service layer" and a "persistent layer" (which can also be understood as delaying the delay message).
In the embodiment of the application, research and development personnel based on JAVA can utilize the SDK layer to realize that a producer or a consumer can quickly access the delay platform and flexibly and uniformly use various functions of the delay queue in the delay platform.
Specifically, referring to fig. 5, the SDK layer includes 3 integrated APIs, which are an authentication interface (english can be expressed as AppAPI), a message processing interface (english can be expressed as MessageAPI), and a driver interface (english can be expressed as ConfigAPI).
Wherein, AppAPI: a functional interface to handle JWT authentication;
MessageAPI: a functional interface for sending and receiving messages;
ConfigAPI: and driving to access various configuration function interfaces of the delay platform.
Here, the 3 functional interfaces of the SDK layer may communicate with interfaces of the API layer, such as a receive delay message, a message return, a user access API authentication, a configuration rule API of the delay platform, and a query message interface (english may express Trace API), so as to jointly implement the message sending and delay functions.
The SDK layer can be used for helping research and development personnel to access the producer and the consumer to the delay platform, so that the platform functions are uniformly used in the code program when the producer and the consumer send delay messages and receive delay messages;
after receiving a message sent by a producer through three interfaces (AppAPI, MessageAPI and ConfigAPI) of an SDK layer, a delay platform records the message in an original event (i.e., InitializationEvent in fig. 5) in an event container (i.e., EventContainer in fig. 5), records a scene key value in the message in an added scene event (i.e., AddSceneEvent in fig. 5), records the message in a forwarding event (i.e., TransterEvent in fig. 5) when the delay platform performs delay processing on the message, wherein when the delay platform performs delay processing on the message, the message is sent to 18 delay queues in a message memory (i.e., MessageHandler in fig. 5) for delay, and after the delay, the message is recorded in a delivery completion event (i.e., devliyifinisevent in fig. 5). The message is then sent to the consumption QUEUE (i.e., delvery _ topic _ XXX _ QUEUE in fig. 5) and then to the consumer via the consumption QUEUE.
Through the above interface, the interaction process of the accessor (producer or consumer) and the delay platform can be divided into two parts: firstly, an access person accesses a delay platform through an SDK layer to apply for an authorization process; the second is the process that the accessor carries out the safety mechanism verification through the SDK layer. Wherein, the time delay platform provides for the access side: an application identifier (such as an application id (app id)), an application key (hereinafter, abbreviated as Secret), and a scene key (hereinafter, abbreviated as scene key).
Wherein, the application identifier: is a globally unique identification of an accessor system (i.e., an accessor);
secret: a key of an application; to encrypt the authorization information (i.e., application identification);
scene key: the access party, whether the access party is a producer or a consumer, needs to provide a scene using the message, and a globally unique identified scene key is generated for the scene by the delay platform. The message to be sent needs a scene key to be configured, and the scene key is also needed for consuming the message in a delay queue.
As shown in fig. 6, the process of accessing the delay platform through the SDK layer and applying for authorization by the producer includes:
step 601: the producer requests application access to the delay platform through the SDK layer;
wherein, the request may carry the APP ID of the producer.
Step 602: the delay platform checks the information and executes the step 603 after the checking is passed;
here, the delay platform performs information validation according to the APP ID of the producer, and verifies the authority of the producer, for example, whether the APP ID of the producer is in the authorization list of the delay platform.
Step 603: the delay platform returns secret to the producer through the SDK layer;
step 604: after receiving the secret, the producer requests the delay platform for scene access (i.e. applies for creating a new scene) through the SDK layer;
here, after the producer receives the secret, the producer needs to continue to request scene access from the delay platform.
Step 605: after receiving the request, the delay platform creates a scene key, writes the created scene key into a scene table, and then executes step 606;
here, after receiving the request, the delay platform creates a scene key for the producer, and writes the created scene key into the scene table, so that the producer is verified in the subsequent processing process of the message. Meanwhile, recording is carried out after the scene key is created, and the recorded rw defaults to 0, which indicates that the scene key has a corresponding producer but does not have a corresponding consumer.
Step 606: and the delay platform returns a scene key to the producer through the SDK layer.
After the above steps are completed, the producer completes the access process of the delay platform.
As shown in fig. 7, the process of accessing the delayed platform by the consumer through the SDK layer to apply for authorization includes:
step 701: a consumer requests application access to the delay platform through the SDK layer;
wherein, the request may carry the APP ID of the consumer.
Step 702: the delay platform checks the information and executes step 703 after the checking is passed;
here, the delay platform performs information validation according to the APP ID of the consumer, and verifies the authority of the consumer, for example, whether the APP ID of the producer is in the delay platform authorization list.
Step 703: the delay platform returns the secret to the consumer through the SDK layer;
step 704: after receiving the secret, the consumer requests the delay platform for scene access (namely consuming the existing scene) through the SDK layer;
here, after the consumer receives the secret, the consumer needs to continue to request scene access from the delay platform.
Step 705: writing a scene table into the delay platform;
after receiving the request, the delay platform provides a scene key for the consumer based on the service requirement, and simultaneously records the scene key after providing the scene key, and changes the recorded rw from 0 to 1, which indicates that the scene key has a corresponding producer and also has a corresponding consumer.
Step 706: and the delay platform returns a scene key to the consumer through the SDK layer.
After the steps are completed, the consumer completes the access process of the delay platform.
As shown in fig. 8, the process of performing security mechanism verification on the producer includes:
step 801: the producer configures secret, APP ID and scene key into the project;
step 802: the producer reads the authorization information of the producer by using the ConfigAPI of the delay platform to carry out SDK initialization (namely, the initialization of an SDK layer is completed);
step 803: the producer uses JWT encryption mechanism to generate token (also called token string) from secret and APP ID through SDK layer;
step 804: a producer requests a consumption queue from a delay platform through an SDK layer, and an AppApi of the delay platform carries an APP ID, a token and a scene key in the request;
step 805: the delayed platform calls the authority interface to realize the safety identity authentication, namely JWT decryption, and verifies that the APP ID is valid;
here, the latency platform verifies token in conjunction with JWT based on secret.
Step 806: after the authentication is passed, the delay platform queries the scene table to obtain a consumption queue corresponding to the scene key;
here, one scene key corresponds to one consumption queue.
Step 807: the delay platform returns the queue identification of the consumption queue to the producer through the SDK layer;
here, in actual application, this step is optional, and the delay platform may return the queue identifier of the consumption queue to the producer, or may not return the queue identifier of the consumption queue to the producer.
Step 808: the producer monitors the consumption queue;
step 809: a producer sends a delay message (also called delay message) through an SDK layer, wherein the delay message carries an APP ID, a scene key and a token;
here, the delay message includes a message content and a corresponding delay time.
Step 810: after the delay platform receives the message, the security mechanism verifies the message, i.e. JWT verifies that the APP ID is valid, and then step 810 is executed;
step 811: the delay platform queries the scene table, verifies whether the APP ID has write permission, and executes step 812 after verifying that the APP ID has write permission;
step 812: after the delay platform writes the message into a persistent queue (which can be understood as a queue in which Mysql stores data in the persistent layer), step 813 is executed;
and when the APP ID has the write right, the delay platform writes the message into the persistence queue.
Step 813: the delayed platform returns an Acknowledgement (ACK) to the producer through the SDK layer.
Here, in actual application, this step is optional, and the delay platform may or may not return a confirmation character to the producer.
The producer performs the above process of security mechanism verification, which is a remote core function of the delay platform, i.e. the delay platform.
Based on the above process, the delay platform receives the message sent by the producer, and after receiving the message, performs delay processing on the message, and sends the expiration message after delay processing to the consumer. The process of sending a message to a consumer is described below from the perspective of the messenger.
As shown in fig. 9, the process of performing security mechanism authentication on the consumer includes:
step 901: configuring a secret, an APP ID and a scene key into a project by a consumer;
step 902: the consumer reads the authorization information of the consumer by using the ConfigApi of the delay platform to carry out SDK initialization;
step 903: a consumer generates a token (also called a token string) from the secret and the APP ID through the SDK layer by using a JWT encryption mechanism;
step 904: a consumer requests a consumption queue from a delay platform through an SDK layer, and an AppApi of the delay platform carries an APP ID, a token and a scene key in the request;
step 905: the delay platform realizes the safe identity authentication of the calling authority interface, namely JWT decryption, and verifies that the APP ID is valid;
here, the latency platform verifies token in conjunction with JWT based on secret.
Step 906: after the authentication is passed, the delay platform queries the scene table to obtain a consumption queue corresponding to the scene key;
here, one scene key corresponds to one consumption queue.
Step 907: the delay platform returns the queue identification of the consumption queue to the consumer through the SDK layer;
step 908: the consumer monitors the consumption queue;
step 909: after the delay platform receives the message sent by the producer, the queue consumption message is persisted;
step 910: the delay platform processes the message by using delay logic;
step 911: the delay platform sends the expiration message to the consumer through the SDK layer;
here, the delay platform may use a delay queue in the rocktmq to perform delay processing on the message, and since the rockmq has a strong message monitoring mechanism, in this embodiment, the function based on the rockmq performs processing on the message, and it may be ensured that the message is not lost.
Step 912: the consumer team message is processed.
The above process of the consumer performing the security mechanism verification is a remote core function of the delay platform, i.e. the delay platform.
During Message processing, the interface of the SDK layer enables a producer to send a uniform Message format, defines a Message body containing a scene key (also called a sceneKey), a Message expiration time (holdetime), a Message expiration time unit (timeUnit), and a service Message content (body), and may be defined as a Message body. The message body mainly defines the simplest fields for sending messages, namely 4 fields which are necessary for a producer to send messages, the fields required by other message middleware, such as a message unique identifier, a queue name, an account password of the message middleware, an IP address and a port number of the message, connection pool information and the like, are encapsulated by an SDK layer, and all messages sent by all messages can be acquired through a Config API by using a unique scene key. Therefore, the defined Message body with the unified format is encapsulated by the SDK layer, so that the encoding for a producer can be greatly simplified, and the producer can pay more attention to the functions of the Message service.
The interface of the SDK layer also realizes the uniform message format of consumer consumption. A message body including a message version (version), a message type (messageType), a scene key (also called sceneKey), a delay time (delaytime), a unique message identifier (messageId), and a service message content (messageBody) is defined, and the name may be defined as a ZiroomDelayMessage message body. The message body mainly defines the message field received by the consumer, and other information such as the consumption queue of the message, the queue name of the message middleware, the account number and the password of the message middleware, the IP address and the port number of the message, the connection pool information and the like are encapsulated by the SDK layer. Therefore, the defined ZiroomDelayMessage message body with the uniform format is encapsulated by the SDK layer, so that the coding for the consumer can be greatly simplified, and the method is more beneficial for the consumer to pay attention to the function of the message service.
The interface of the SDK layer also defines a message unique identifier messageId, and a global unique identifier for identifying the message is automatically generated when each message is sent in the SDK layer through the message unique identifier messageId. Global means that the cross-service application across the computer room keeps the generated identifier each time to be a unique and unrepeatable identifier. The method can be used for the identification of different access systems of different machine rooms in different cities. Can be used for message tracing.
The interface of the SDK layer also defines a FoxyProducer interface for sending messages, and accesses a DefaultFoxProducer tool class through the SDK layer based on the optimized Message middleware, so that the function of converting the format of the Message into the format of the full-volume information is mainly realized, the function of a MessageAPI is realized, and the function of sending confirmation can be further realized. Therefore, after the FoxyProducer interface for sending the message is packaged in the SDK layer, the encoding of a producer can be greatly simplified, and the function of paying attention to the message service by the producer is facilitated.
The interface of the SDK layer also defines a FoxyConsumer annotation for consuming expired messages, which is an annotation obtained by customization based on the annotation of Spring. The annotation needs to be combined with the FoxyListener interface, so that the customer can receive the expired delay message by using the customized onMessage method in the FoxyListener interface when accessing the annotation. And when the message is expired, the message is uniformly pushed into the message queue by the delay platform, and the SDK layer is responsible for establishing connection with the message queue to monitor all messages in the queue. A queue for monitoring messages needs a large amount of codes and connection information, and after the SDK layer is completely packaged, a consumer can obtain all the connection information only by borrowing a scene key. The consumption only concerns the realization of the service processing function after receiving the message, and does not concern the connection state of the message queue any more. Therefore, after the FoxyConsumer annotation of the consumption due message is packaged by the SDK layer, the coding of the consumer can be greatly simplified, and the function of paying attention to the message service by the consumer is facilitated.
In summary, the interface of the SDK layer can implement a Message body and a ZiroomDelayMessage body in a unified Message format, and can also implement globally unique generation of a Message unique identifier Message id in a unified manner; the FoxyProducer interface for sending the message can be realized uniformly; FoxyConsumer annotation of consumption expired messages may be implemented uniformly.
Meanwhile, in the application embodiment, the delay platform is responsible for generating the unique identifier of the message, and logs are reserved to track the sending when the message is sent; after the consumer consumes the expiration message, whether the message is consumed successfully or consumed unsuccessfully is also kept in the log; message consumption can be tracked. Referring specifically to fig. 10-11, a log record of the message is made. The delay platform records the sending state of the message when receiving the message or after sending the message to the consumer, wherein fig. 10 is a log record when receiving the producer message, and fig. 11 is a log record after sending the message to the consumer.
The application embodiment has the following effects and advantages:
(1) unified and efficient code access;
in the related art, accessing to the conventional message middleware requires knowing which consumption queue the message is in, the queue name of the message middleware, the account password of the message middleware, the IP address and port number of the message, the connection pool information, and the like. And access can be realized only by using a large amount of codes, so that the repeated labor efficiency is low, the hidden coding danger exists, and variables are difficult to maintain and use for enterprise-level development. In the embodiment of the application, the SDK layer is used for providing simplified access information for access, and encapsulates the intermediate step of message connection. In the embodiment of the application, after the SDK layer is packaged, the coding of an access person can be greatly simplified, the performance is greatly improved, and the access cost is greatly reduced. The complex distributed delay function can be easily realized for the research and development personnel who do not use the message middleware.
(2) A new JWT authentication security mechanism;
in the related art, the traditional message middleware account password is that once the password is created, various messages can be sent to the queue, the messages in the queue can be consumed at will, and messages which are not concerned about by the user can be sent by mistake and consumed easily. In the embodiment of the application, a new security mechanism is used for uniformly authorizing the application identifier and the scene key with the multi-tenant function for the access person, one scene key corresponds to one consumption queue, only the message with the scene key can be sent by the corresponding consumption queue based on the scene key, and the consumer can only obtain the message from the consumption queue corresponding to the scene key, so that the authorization is carried out by using the scene key, and the same system can provide mutually isolated queues by using the multi-tenant concept, so that the authorization is more accurate. The method can be accurate to whether each message is safe or not and whether the authorization is legal or not, so that a more accurate security authorization mechanism is provided.
(3) Realization of message traceability (message traceability function of the whole flow);
in the related art, the conventional message middleware only provides transmission and consumption of a queue function. There is no traceability of sent messages and no traceability of consumed messages. In the embodiment of the application, the sending message and the consuming message are packaged based on the SDK layer, and meanwhile, the global unique identifier is generated uniformly and used for recording the sending circulation and the consuming of the messages. The unified log is put in storage for query, and a message full-flow tracking function can be provided for service access.
(4) Control of client versions (SDK layer version management control function);
in the embodiment of the application, the client version of the access person can be controlled through the SDK layer, the delay platform can be accessed only through the verified client version, and the delay platform cannot be accessed without the verified client version.
In summary, a platform using message middleware in the conventional manner does not have an SDK layer, and a large amount of codes are additionally implemented to access and implement a message queue; and the enterprise research and development team can hardly ensure uniform and efficient code access due to human factors. The embodiment solves the problem, can support the SDK layer developed based on JAVA to quickly, flexibly and conveniently access the delay message queue, and can conveniently realize message consumption in various modes. Meanwhile, when the traditional mode is accessed to the traditional message middleware, because the coding implementation modes are different, the message sent by a producer is easy to lose, or a consumer has no response and no log after consuming; the lack of uniform delayed message tracking capability makes the monitoring of messages difficult in reality. The embodiment solves the problem, the saved log is sent in the message tracking, the message is transferred to the saved log in the delay platform, and the same message is sent from the transmitted stream to the final consumption to be inquired in the three links of consuming the saved log by the consumer.
In order to implement the method according to the embodiment of the present invention, an embodiment of the present invention further provides a message processing apparatus, as shown in fig. 12, a message processing apparatus 1200 includes: a sending module 1201; wherein,
the sending module 1201 is configured to send first information to a delay platform, where the first information includes a message to be sent, a first token, a scene key value, and a first application identifier; the first token and the first application identifier are used for authenticating the message to be sent, so that the message to be sent is subjected to delay processing after the authentication is passed, and the message to be sent is sent through a consumption queue corresponding to the scene key value in the delay platform after the delay processing.
In an embodiment, the message processing apparatus 1200 further includes a generating module 1202, where the generating module 1202 is specifically configured to:
acquiring a first application key and a scene key value from the delay platform;
generating the first token using the first application key, the first application identification, and based on JWT.
In an embodiment, the generating module 1202 is specifically configured to:
sending an application access request to the delay platform; receiving a first application key sent by the delay platform based on the application access request;
sending a scene generation request to the delay platform; and receiving a scene key value sent by the delay platform based on the scene generation request.
In practical applications, the sending module 1201 and the generating module 1202 may be implemented by a processor in a message processing apparatus.
In practical applications, the function of the message processing apparatus 1200 is equivalent to that of the producer in the above application embodiments.
In order to implement the method according to the embodiment of the present invention, an embodiment of the present invention further provides a message processing apparatus, as shown in fig. 13, a message processing apparatus 1300 includes: a receiving module 1301, an authentication module 1302 and a sending module 1303; wherein,
the receiving module 1301 is configured to receive first information sent by a first application, where the first information includes a message to be sent, a first token, a scene key value, and a first application identifier;
the authentication module 1302 is configured to authenticate the message to be sent by using the first token and the first application identifier;
the sending module 1303 is configured to perform delay processing on the message to be sent after the authentication is passed, and send the message to be sent to a second application corresponding to a consumption queue through the consumption queue corresponding to the scene key value included in the first message after the delay processing is completed.
In an embodiment, the message processing apparatus 1300 further includes a first providing module 1304, where the first providing module 1304 is specifically configured to:
and providing a first application key and a scene key value to the first application.
In an embodiment, the first providing module 1304 is specifically configured to:
receiving an application access request sent by a first application, and sending a first application key to the first application based on the application access request;
receiving a scene generation request sent by a first application, and sending a scene key value to the first application based on the scene generation request.
In an embodiment, the authentication module 1302 is specifically configured to:
the first token is authenticated using the first application key in conjunction with JWT.
In an embodiment, the message processing apparatus 1300 further includes a determining module 1305, where the determining module 1305 is specifically configured to:
receiving a consumption queue acquisition request sent by a second application; the consumption queue acquisition request carries a second token, a scene key value and a second application identifier;
authenticating the second application based on the second token and a second application identifier;
and after the authentication is passed, determining a consumption queue corresponding to the second application based on a scene key value carried by the consumption queue acquisition request.
In an embodiment, the determining module 1305 is specifically configured to:
and verifying the second token by utilizing the second application key and combining JWT.
In an embodiment, the message processing apparatus 1300 further includes a second providing module 1306, where the second providing module 1306 is specifically configured to:
and providing a second application key and a scene key value to the second application.
In an embodiment, the second providing module 1306 is specifically configured to:
receiving an application access request sent by a second application, and sending a second application key to the second application based on the application access request;
receiving a scene generation request sent by a second application, and sending a scene key value to the second application based on the scene generation request.
In an embodiment, the message processing apparatus 1300 further includes a recording module 1307, where the recording module 1307 is specifically configured to:
and recording the sending state of the message to be sent.
In practical applications, the receiving module 1301, the authenticating module 1302, the sending module 1303, the first providing module 1304, the determining module 1305, the second providing module 1306, and the recording module 1307 may be implemented by a processor in a message processing apparatus.
In practical applications, the function of the message processing apparatus 1300 is equivalent to the function of the delay platform in the above application embodiments.
In order to implement the method according to the embodiment of the present invention, an embodiment of the present invention further provides a message processing apparatus, as shown in fig. 14, a message processing apparatus 1400 includes: a receiving module 1401; wherein,
the receiving module 1401 is configured to receive a message sent by the delay platform through a consumption queue corresponding to the scene key value of the second application.
In an embodiment, the message processing apparatus 1400 further includes a sending module 1402, where the sending module 1402 is specifically configured to:
sending a consumption queue acquisition request to the delay platform; the consumption queue acquisition request carries a second token, a scene key value of the second application and a second application identifier; the second token and the second application identifier are used for authenticating the second application, so that after the authentication is passed, based on a scene key value of the second application, a consumption queue corresponding to the second application is determined.
In an embodiment, the message processing apparatus 1400 further includes a generating module 1403, where the generating module 1403 is specifically configured to:
acquiring a second application key and a scene key value of the second application from the delay platform;
generating the second token based on JWT using the second application key, the second application identification.
In an embodiment, the generating module 1403 is specifically configured to:
sending an application access request to the delay platform; receiving a second application key sent by the delay platform based on the application access request;
sending a scene generation request to the delay platform; and receiving a scene key value sent by the delay platform based on the scene generation request.
In practical applications, the receiving module 1401, the sending module 1402 and the generating module 1403 may be implemented by a processor in a message processing apparatus.
In practical applications, the function of the message processing apparatus 1400 is equivalent to that of the consumer in the above application embodiments.
It should be noted that: the message processing apparatus provided in the foregoing embodiment is only exemplified by the division of the program modules when processing a message, and in practical applications, the processing may be distributed to different program modules as needed, that is, the internal structure of the terminal may be divided into different program modules to complete all or part of the processing described above. In addition, the message processing apparatus and the message processing method provided in the above embodiments belong to the same concept, and specific implementation processes thereof are described in the method embodiments and are not described herein again.
Based on the hardware implementation of the program module, and in order to implement the method according to the embodiment of the present invention, an embodiment of the present invention further provides an electronic device, as shown in fig. 15, where the electronic device 1500 includes:
a communication interface 1501 capable of exchanging information with other devices (such as network devices, terminals, and the like);
the processor 1502 is connected with the communication interface 1501 to realize information interaction with other devices, and is used for executing the method provided by one or more technical embodiments when running a computer program;
a memory 1503 for storing computer programs capable of running on the processor 1502.
It should be noted that: the process of the processor 1502 for specifically executing the above operations is detailed in the method embodiment, and is not described herein again.
Here, the electronic device 1500 may be a device in which the first application is located, may be a delay platform, and may be a device in which the second application is located.
Of course, in practice, the various components in the electronic device 1500 are coupled together by a bus system 1504. It is understood that the bus system 1504 is used to enable connected communication between these components. The bus system 1504 includes, in addition to the data bus, a power bus, a control bus, and a status signal bus. For clarity of illustration, however, the various buses are designated as bus system 1504 in fig. 15.
The method disclosed by the above embodiments of the present invention can be applied to the processor 1502, or can be implemented by the processor 1502. The processor 1502 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by instructions in the form of hardware, integrated logic circuits, or software in the processor 1502. The Processor 1502 may be a general purpose Processor, a Digital Signal Processor (DSP), or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, or the like. The processor 1502 may implement or perform the methods, steps, and logic blocks disclosed in embodiments of the present invention. A general purpose processor may be a microprocessor or any conventional processor or the like. The steps of the method disclosed by the embodiment of the invention can be directly implemented by a hardware decoding processor, or can be implemented by combining hardware and software modules in the decoding processor. The software modules may be located in a storage medium located in the memory 1503 and the processor 1502 reads the information in the memory 1503 to perform the steps of the aforementioned methods in conjunction with its hardware.
In an exemplary embodiment, the electronic Device 1500 may be implemented by one or more Application Specific Integrated Circuits (ASICs), DSPs, Programmable Logic Devices (PLDs), Complex Programmable Logic Devices (CPLDs), Field Programmable Gate Arrays (FPGAs), general purpose processors, controllers, Micro Controllers (MCUs), microprocessors (microprocessors), or other electronic components for performing the foregoing methods.
It is to be understood that the memory 1503 of embodiments of the present invention can be either volatile memory or nonvolatile memory, and can include both volatile and nonvolatile memory. Among them, the nonvolatile Memory may be a Read Only Memory (ROM), a Programmable Read Only Memory (PROM), an Erasable Programmable Read-Only Memory (EPROM), an Electrically Erasable Programmable Read-Only Memory (EEPROM), a magnetic random access Memory (FRAM), a Flash Memory (Flash Memory), a magnetic surface Memory, an optical disk, or a Compact Disc Read-Only Memory (CD-ROM); the magnetic surface storage may be disk storage or tape storage. Volatile Memory can be Random Access Memory (RAM), which acts as external cache Memory. By way of illustration and not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Synchronous Static Random Access Memory (SSRAM), Dynamic Random Access Memory (DRAM), Synchronous Dynamic Random Access Memory (SDRAM), Double Data Rate Synchronous Dynamic Random Access Memory (DDRSDRAM), Enhanced Synchronous Dynamic Random Access Memory (ESDRAM), Enhanced Synchronous Dynamic Random Access Memory (Enhanced DRAM), Synchronous Dynamic Random Access Memory (SLDRAM), Direct Memory (DRmb Access), and Random Access Memory (DRAM). The described memory for embodiments of the present invention is intended to comprise, without being limited to, these and any other suitable types of memory.
In an exemplary embodiment, the embodiment of the present invention further provides a storage medium, i.e., a computer storage medium, specifically a computer readable storage medium, for example, including a memory 1503 storing a computer program, which can be executed by a processor 1502 of the electronic device 1500 to implement the steps of the foregoing method. The computer readable storage medium may be Memory such as FRAM, ROM, PROM, EPROM, EEPROM, Flash Memory, magnetic surface Memory, optical disk, or CD-ROM.
It should be noted that: first, second, etc. are used to distinguish between similar objects and not necessarily to describe a particular order or sequence.
In addition, the technical solutions described in the embodiments of the present invention may be arbitrarily combined without conflict.
The above description is only a preferred embodiment of the present invention, and is not intended to limit the scope of the present invention.
Claims (21)
1. A message processing method is applied to a first application and comprises the following steps:
sending first information to a delay platform, wherein the first information comprises a message to be sent, a first token, a scene key value and a first application identifier; the first token and the first application identifier are used for authenticating the message to be sent, so that the message to be sent is subjected to delay processing after the authentication is passed, and the message to be sent is sent through a consumption queue corresponding to the scene key value in the delay platform after the delay processing.
2. The method of claim 1, further comprising:
acquiring a first application key and a scene key value from the delay platform;
generating the first token with the first application key, the first application identification, and based on Chiwikson JWT.
3. The method of claim 2, wherein the obtaining the first application key and the context key from the latency platform comprises:
sending an application access request to the delay platform; receiving a first application key sent by the delay platform based on the application access request;
sending a scene generation request to the delay platform; and receiving a scene key value sent by the delay platform based on the scene generation request.
4. A message processing method is applied to a delay platform and comprises the following steps:
receiving first information sent by a first application, wherein the first information comprises a message to be sent, a first token, a scene key value and a first application identifier;
authenticating the message to be sent by utilizing the first token and the first application identifier;
and after the authentication is passed, performing delay processing on the message to be sent, and after the delay processing is completed, sending the message to be sent to a second application corresponding to a consumption queue through the consumption queue corresponding to the scene key value contained in the first information.
5. The method of claim 4, further comprising:
and providing a first application key and a scene key value to the first application.
6. The method of claim 5, wherein providing the first application with a first application key and a context key comprises:
receiving an application access request sent by a first application, and sending a first application key to the first application based on the application access request;
receiving a scene generation request sent by a first application, and sending a scene key value to the first application based on the scene generation request.
7. The method of claim 4, wherein authenticating the message to be sent using the first token and the first application identifier comprises:
the first token is authenticated using the first application key in conjunction with JWT.
8. The method of claim 4, further comprising:
receiving a consumption queue acquisition request sent by a second application; the consumption queue acquisition request carries a second token, a scene key value and a second application identifier;
authenticating the second application based on the second token and a second application identifier;
and after the authentication is passed, determining a consumption queue corresponding to the second application based on a scene key value carried by the consumption queue acquisition request.
9. The method of claim 8, wherein authenticating the second application based on the second token and a second application identification comprises:
and verifying the second token by utilizing the second application key and combining JWT.
10. The method of claim 8, further comprising:
and providing a second application key and a scene key value to the second application.
11. The method of claim 10, wherein providing the second application with a second application key and a scene key value comprises:
receiving an application access request sent by a second application, and sending a second application key to the second application based on the application access request;
receiving a scene generation request sent by a second application, and sending a scene key value to the second application based on the scene generation request.
12. The method according to any one of claims 4 to 11, further comprising:
and recording the sending state of the message to be sent.
13. A message processing method applied to a second application comprises the following steps:
and receiving a message sent by the delay platform through the consumption queue corresponding to the scene key value of the second application.
14. The method of claim 13, further comprising:
sending a consumption queue acquisition request to the delay platform; the consumption queue acquisition request carries a second token, a scene key value of the second application and a second application identifier; wherein,
the second token and the second application identifier are used for authenticating the second application, so that after the authentication is passed, based on the scene key value of the second application, the consumption queue corresponding to the second application is determined.
15. The method of claim 14, further comprising:
acquiring a second application key and a scene key value of the second application from the delay platform;
generating the second token based on JWT using the second application key, the second application identification.
16. The method of claim 15, wherein the obtaining a second application key and a context key of the second application from the latency platform comprises:
sending an application access request to the delay platform; receiving a second application key sent by the delay platform based on the application access request;
sending a scene generation request to the delay platform; and receiving a scene key value sent by the delay platform based on the scene generation request.
17. A message processing apparatus, comprising:
the system comprises a sending module, a delay platform and a receiving module, wherein the sending module is used for sending first information to the delay platform, and the first information comprises a message to be sent, a first token, a scene key value and a first application identifier; the first token and the first application identifier are used for authenticating the message to be sent, so that the message to be sent is subjected to delay processing after the authentication is passed, and the message to be sent is sent through a consumption queue corresponding to the scene key value in the delay platform after the delay processing.
18. A message processing apparatus, comprising:
the receiving module is used for receiving first information sent by a first application, wherein the first information comprises a message to be sent, a first token, a scene key value and a first application identifier;
the authentication module is used for authenticating the message to be sent by utilizing the first token and the first application identifier;
and the sending module is used for performing delay processing on the message to be sent after the authentication is passed, and sending the message to be sent to a second application corresponding to a consumption queue through the consumption queue corresponding to the scene key value contained in the first message after the delay processing is completed.
19. A message processing apparatus, comprising:
and the receiving module is used for receiving the message sent by the delay platform through the consumption queue corresponding to the scene key value of the second application.
20. An electronic device, comprising: a processor and a memory for storing a computer program capable of running on the processor; wherein,
the processor, when being configured to execute the computer program, is configured to perform the steps of the method of any one of claims 1 to 3, or is configured to perform the steps of the method of any one of claims 4 to 12, or is configured to perform the steps of the method of any one of claims 13 to 16.
21. A storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, performs the steps of the method of any one of claims 1 to 3, or performs the steps of the method of any one of claims 4 to 12, or performs the steps of the method of any one of claims 13 to 16.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011025384.4A CN112187785B (en) | 2020-09-25 | 2020-09-25 | Message processing method and device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011025384.4A CN112187785B (en) | 2020-09-25 | 2020-09-25 | Message processing method and device, electronic equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112187785A true CN112187785A (en) | 2021-01-05 |
CN112187785B CN112187785B (en) | 2023-01-31 |
Family
ID=73943978
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011025384.4A Active CN112187785B (en) | 2020-09-25 | 2020-09-25 | Message processing method and device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112187785B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115396831A (en) * | 2021-05-08 | 2022-11-25 | 中国移动通信集团浙江有限公司 | Interaction model generation method, device, equipment and storage medium |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107391271A (en) * | 2017-05-17 | 2017-11-24 | 阿里巴巴集团控股有限公司 | A kind of delayed tasks triggering method and device based on Message Queuing system |
CN109413040A (en) * | 2018-09-21 | 2019-03-01 | 深圳前海微众银行股份有限公司 | Message authentication method, equipment, system and computer readable storage medium |
CN110661849A (en) * | 2019-08-30 | 2020-01-07 | 中国人民财产保险股份有限公司 | Request processing method and device, electronic equipment and storage medium |
CN110730224A (en) * | 2019-09-30 | 2020-01-24 | 深圳市金证前海金融科技有限公司 | Data reporting method and device |
CN111538600A (en) * | 2020-02-25 | 2020-08-14 | 远景智能国际私人投资有限公司 | Message processing method and device, computer equipment and storage medium |
-
2020
- 2020-09-25 CN CN202011025384.4A patent/CN112187785B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107391271A (en) * | 2017-05-17 | 2017-11-24 | 阿里巴巴集团控股有限公司 | A kind of delayed tasks triggering method and device based on Message Queuing system |
CN109413040A (en) * | 2018-09-21 | 2019-03-01 | 深圳前海微众银行股份有限公司 | Message authentication method, equipment, system and computer readable storage medium |
CN110661849A (en) * | 2019-08-30 | 2020-01-07 | 中国人民财产保险股份有限公司 | Request processing method and device, electronic equipment and storage medium |
CN110730224A (en) * | 2019-09-30 | 2020-01-24 | 深圳市金证前海金融科技有限公司 | Data reporting method and device |
CN111538600A (en) * | 2020-02-25 | 2020-08-14 | 远景智能国际私人投资有限公司 | Message processing method and device, computer equipment and storage medium |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115396831A (en) * | 2021-05-08 | 2022-11-25 | 中国移动通信集团浙江有限公司 | Interaction model generation method, device, equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN112187785B (en) | 2023-01-31 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111914269B (en) | Data security sharing method and system in blockchain and cloud storage environment | |
US20220329422A1 (en) | Data processing method, apparatus, computer program, and storage medium | |
US9026577B1 (en) | Distributed workflow management system | |
CN102171652B (en) | The method providing trusted software for electronic installation | |
US9572025B2 (en) | Method, server, computer program and computer program product for communicating with secure element | |
CN113014475B (en) | Message pushing integration method and device | |
CN111492355B (en) | Method and control system for controlling and/or monitoring a device | |
CN112307515B (en) | Database-based data processing method and device, electronic equipment and medium | |
US20220414088A1 (en) | Performance efficient blockchain application programming interfaces | |
CN115299011B (en) | Privacy center data security in cloud environments | |
CN112511653A (en) | Service authority activation method, configuration method and registration method of Internet of things equipment | |
CN112187785B (en) | Message processing method and device, electronic equipment and storage medium | |
US11151551B2 (en) | Systems and methods related to executing transactions in a hybrid cloud environment | |
US20220182231A1 (en) | Decentralized broadcast encryption and key generation facility | |
CN103559430B (en) | application account management method and device based on Android system | |
CN112148506A (en) | Message processing method, device, platform and storage medium | |
CN117113392A (en) | Private data processing method, device, computer equipment and storage medium | |
CN110852139B (en) | Biometric identification method, device, apparatus and storage medium | |
CN116451280A (en) | Asset management method and device based on blockchain | |
US20220263712A1 (en) | Device provisioning using a supplemental cryptographic identity | |
CN111698087B (en) | Micro cipher machine and information processing method | |
CN113741912A (en) | Model management system, method, device and equipment | |
WO2023093139A1 (en) | Resource creation method and apparatus, and electronic device and storage medium | |
CN113660245B (en) | Terminal access right control method, device, equipment and medium | |
US20230188368A1 (en) | Method for determining an authorization to implement a composite resource, blockchain, devices and corresponding program |
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 |