Detailed Description
Embodiments of the present application are described in detail below, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to like or similar elements or elements having like or similar functions throughout. The embodiments described below by referring to the drawings are illustrative and intended to explain the present application and should not be construed as limiting the application.
The method and apparatus for consuming service messages in the same network environment according to the embodiments of the present application are described below with reference to the accompanying drawings.
Fig. 1 is a flowchart of a service message consumption method of a network environment according to an embodiment of the present application, as shown in fig. 1, the method includes the steps of:
S101, under the same network environment, configuring a plurality of environments for the message consumption terminal according to the environment configuration parameters.
The network environment refers to a broadband, high-speed, comprehensive, wide-area digital telecommunication network constructed on the basis of the combination of an electronic computer and modern communication technology.
Message consumers in the same network environment may be in different environments. For example, the message consumer may be in an online environment, i.e., a production environment, which refers to an environment that is being used on a real subscriber line to provide external services. For example, the message consumption end may be in a pre-sending environment, that is, a pre-publishing environment, where the pre-sending environment is a transition from a testing environment to an online environment, and the testing environment may be limited, for example, some processes or data may not be detected, and verification may be performed in the pre-sending environment, so as to ensure accuracy of the data. The test environment refers to an environment which is similar to an online environment and is simulated based on data.
In the embodiment of the application, the online environment and the prefire environment are configured for the message consumption terminal according to the environment configuration parameters in the same network environment. Optionally, the environment configuration parameters include message subject (topic), environment parameters, data assembly logic, and the like.
Optionally, the message consumption end may be a terminal device, such as a mobile phone, a computer, etc., and the embodiment of the present application does not limit the form of the message consumption end.
S102, receiving service messages transmitted by message subjects in target environments in a plurality of environments.
Optionally, the message sending end generates the service message according to the stock service, the message theme confirms the target environment from the multiple environments according to the topic class where the service message is located, and sends the service message to the message consuming end under the target environment.
In the embodiment of the application, the stock service refers to the service which is already online and released, and the message sending end and the message consuming end both operate. Alternatively, the message sending end may be a server, where the server is used as an electronic device, and provides computing or application services for other clients in the network, such as terminals like personal computing (Personal Computer, PC) sets, smart phones, etc., and even large devices like train systems, etc.
And S103, responding to the service message as the message generated in the target environment, and consuming the service message in the target environment.
In some implementations, whether the service message is a message generated in the target environment may be determined according to the environment identifier carried in the service message, and in response to the service message being a message generated in the target environment, the message consumption terminal consumes the service message in the target environment indicated by the service message, that is, processes the service message in the target environment.
In the embodiment of the application, the service message is taken as an example of power failure of the area A in the time period T, the message consumption terminal processes the service message in the target environment, judges whether the current position of the message consumption terminal is positioned at the place A, and starts the standby power supply in the time period T if the current position is positioned at the place A.
In the embodiment of the application, under the same network environment, a plurality of environments are configured for the message consumption terminal according to the environment configuration parameters, the service message transmitted by the message subject is received under the target environment in the plurality of environments, and the service message is consumed under the target environment. In the embodiment of the application, the message sending end and the message consuming end have no direct calling relation, and the environment isolation of the service message under the network environment is realized only through the transmission of the service message, so that the service message is consumed under the adaptive environment, thereby improving the accuracy of consuming the service message. The system of the embodiment of the application has low invasiveness and low coupling degree, and further improves the performance of a message consumption end.
Fig. 2 is a flowchart of a service message consumption method of a network environment according to an embodiment of the present application, as shown in fig. 2, the method includes the steps of:
s201, under the same network environment, configuring a plurality of environments for the message consumption terminal according to the environment configuration parameters.
S202, receiving service messages transmitted by message subjects in target environments in a plurality of environments.
For the description of step S201 and step S202, reference may be made to the relevant content in the above embodiment, and the description is omitted here.
S203, acquiring the message verification parameters in the target environment.
In some implementations, to increase the accuracy of the consumption of the service message, the service message may be further validated according to the message validation parameters in the target environment.
Alternatively, the message authentication parameter may comprise a content tag storing the service message. In some implementations, when there is a large amount of traffic, message backlog may be caused, and verifying the traffic message according to the content tag may affect the efficiency of consumption of the traffic message. Therefore, in order to balance the efficiency and accuracy of consuming the service message, in the embodiment of the present application, the message verification parameter may include a preset number threshold of service messages to be processed and a content tag of the service message.
S204, judging whether the service message meets the preset condition or not based on the message verification parameter.
In some implementations, a number of service messages to be processed within any one of a plurality of environments is obtained. And determining that the service messages meet the preset conditions in response to the number of the service messages to be processed being greater than or equal to a preset threshold in the message verification parameters.
In some implementations, content tags in the message authentication parameters are obtained in response to the number of service messages to be processed being less than a preset threshold in the message authentication parameters. And determining that the content label hits the service message in response to the content label contained in the service message, wherein the service message meets the preset condition.
Optionally, the content tag may be a service identifier, a data identifier, or a user identifier. In the embodiment of the application, the service message can be identified to confirm whether the service message contains the content tag.
S205, in response to the service message meeting the preset condition, the service message is consumed in the target environment.
For description of consumption of the service message in the target environment, reference may be made to the relevant content in the above embodiment, and details are not repeated here.
In the embodiment of the application, the message verification parameters in the target environment are acquired, whether the service message meets the preset condition is judged based on the message verification parameters, and the service message is consumed in the target environment in response to the service message meeting the preset condition. In the embodiment of the application, the message sending end and the message consuming end have no direct calling relation, and the environment isolation of the service message under the network environment is realized only through the transmission of the service message, so that the service message is consumed under the adaptive environment, and the efficiency and the accuracy of consuming the service message are improved. The system of the embodiment of the application has low invasiveness and low coupling degree, and further improves the performance of a message consumption end.
In some implementations, in response to the service message not having the content tag, the first context identifier in the service message is updated to the second context identifier, an updated service message is generated, and the updated service message is sent to the context identified by the second context identifier. Wherein the second context identifier is configured to instruct consumption of the update service message in the context identified by the second context identifier. In the embodiment of the application, the target environment is taken as an online environment for illustration, if the service message does not hit the content label in the online environment, the online environment identifier in the service message is updated to the prefire environment identifier, the updated service message is generated, and the updated service message is retransmitted to the prefire environment for consumption.
Fig. 3 is a flowchart of a service message consumption method of a network environment according to an embodiment of the present application, as shown in fig. 3, the method includes the steps of:
S301, under the same network environment, configuring a plurality of environments for the message consumption terminal according to the environment configuration parameters.
S302, receiving service messages transmitted by message subjects in target environments in a plurality of environments.
For the description of step S301 and step S302, reference may be made to the relevant content in the above embodiment, and the description is omitted here.
S303, extracting the first environment identifier from the service message.
Alternatively, the first environment identifier may be prd, which is described by taking the environment identifier that the first environment identifier is an online environment as an example.
Alternatively, the description is given taking the environment identifier of the first environment identifier as the prefire environment as an example, and the first environment identifier may be pre.
S304, responding to the first environment identification to indicate a target environment in a plurality of environments, and determining a message generated by the business message under the target environment.
In some implementations, if the first environment identifier is prd and the current target environment is an online environment, a message generated by the service message in the target environment is determined.
In some implementations, if the first environment identifier is pre and the current target environment is a prefire environment, determining a message generated by the service message in the target environment.
S305, consuming the service message in the target environment.
The description of step S305 may be referred to the relevant content in the above embodiment, and will not be repeated here.
In the embodiment of the application, the first environment identifier is extracted from the service message, and the message generated by the service message under the target environment is determined to be consumed under the target environment in response to the first environment identifier indicating the target environment in the plurality of environments. In the embodiment of the application, the message sending end and the message consuming end have no direct calling relation, and the environment isolation of the service message under the network environment is realized only through the transmission of the service message, so that the service message is consumed under the adaptive environment, and the accuracy of consuming the service message is improved. The system of the embodiment of the application has low invasiveness and low coupling degree, and further improves the performance of a message consumption end.
Fig. 4 is a flowchart of a service message consumption method of an on-line environment according to an embodiment of the present application, as shown in fig. 4, where an on-line environment is taken as an example, a message sending end generates a service message according to an inventory service, a message subject sends the service message to a message consumption end in the on-line environment according to a topic class where the service message is located, the message consumption end queries a dynamically configured message verification parameter to obtain a verification switch, if the verification switch is opened, judges whether a content tag hits the service message, if the content tag hits the service message, the service message is consumed in the on-line environment, if the content tag does not hit the service message, an environment identifier carried by the service message is updated into an identifier of a prefastening environment in the on-line environment, an updated service message is generated, and the updated service message is sent to the prefastening environment. In addition, if the service messages to be processed in the online environment exceed the preset quantity threshold, the condition that the current online environment is backlogged is indicated, and at the moment, the verification switch can be switched to improve the message processing efficiency. When the environment on the optional ground wire receives the message backlog reminding of other environments, the verification switch can be switched, so that the message processing efficiency is improved.
Fig. 5 is a flowchart of a service message consumption method in a prefire environment according to an embodiment of the present application, as shown in fig. 5, where the embodiment of the present application is illustrated by taking the prefire environment as an example, a message sending end generates a service message according to an inventory service, a message subject sends the service message to a message consumption end in the prefire environment according to a topic class where the service message is located, the message consumption end queries a dynamically configured verification switch, if the verification switch is opened, determines whether a content tag hits the service message, if the content tag hits the service message, consumes the service message in the prefire environment, if the content tag does not hit the service message, identifies an environment identifier carried by the service message, if the service message carries an environment identifier of the prefire environment, determines that the service message is a prefire message, consumes the service message in the prefire environment, otherwise updates the environment identifier carried by the service message to an environment identifier of an on-line environment, and sends the service message to the on-line environment for consumption. In addition, if the service messages to be processed in the pre-sending environment exceed the preset quantity threshold, the condition that the message backlog occurs in the current pre-sending environment is indicated, and at the moment, the verification switch can be switched to improve the message processing efficiency. Optionally, when the pre-sending environment receives the message backlog reminding of other environments, the verification switch can be switched to improve the message processing efficiency.
As shown in fig. 6, based on the same application concept, an embodiment of the present application further provides a service message consumption apparatus 600 in the same network environment, including:
A configuration module 610, configured to configure a plurality of environments for the message consumer according to the environment configuration parameters in the same network environment;
a receiving module 620, configured to receive a service message transmitted by a message topic in a target environment of a plurality of environments;
And the consumption module 630 is configured to consume the service message in the target environment in response to the service message being a message generated in the target environment.
In some implementations, the consumption module 630 is further to:
acquiring a message verification parameter in a target environment;
judging whether the service message meets preset conditions or not based on the message verification parameters;
And responding to the service message meeting the preset condition, and consuming the service message in the target environment.
In some implementations, the consumption module 630 is further to:
Acquiring the number of service messages to be processed in any one of a plurality of environments;
And determining that the service message meets the preset condition in response to the number of the service messages to be processed being greater than or equal to a preset number threshold in the message verification parameter.
In some implementations, the consumption module 630 is further to:
acquiring content tags in the message verification parameters in response to the number of the service messages to be processed being smaller than a preset number threshold;
and determining that the service message meets the preset condition in response to the content label contained in the service message.
In some implementations, the consumption module 630 is further to:
And in response to the service message not containing the content tag, updating the first environment identifier in the service message to a second environment identifier, and generating an updated service message, wherein the second environment identifier is used for indicating that the updated service message is consumed in the environment identified by the second environment identifier.
In some implementations, the consumption module 630 is further to:
and sending the update service message to the environment identified by the second environment identifier.
In some implementations, the consumption module 630 is further to:
Extracting a first environment identifier from the service message;
And determining a message generated by the business message in the target environment in response to the first environment identification indicating the target environment in the plurality of environments.
In the embodiment of the application, the message sending end and the message consuming end have no direct calling relation, and the environment isolation of the service message under the network environment is realized only through the transmission of the service message, so that the service message is consumed under the adaptive environment, thereby improving the accuracy of consuming the service message. The system of the embodiment of the application has low invasiveness and low coupling degree, and further improves the performance of a message consumption end.
Based on the same application conception, the embodiment of the application also provides electronic equipment.
Fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present application. As shown in fig. 7, the electronic device 700 includes a memory 710, a processor 720 and a computer program product stored in the memory 710 and executable on the processor 720, wherein the processor implements the service message consumption method in the same network environment as described above when executing the computer program.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
Based on the same application concept, the embodiment of the present application further provides a computer readable storage medium having computer instructions stored thereon, where the computer instructions are configured to cause a computer to execute the service message consumption method in the same network environment in the above embodiment.
Based on the same application concept, the embodiment of the present application further provides a computer program product, which comprises a computer program, and the computer program when executed by a processor, is used for the business message consumption method of the same network environment in the embodiment.
It should be noted that in the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The application may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The use of the words first, second, third, etc. do not denote any order. These words may be interpreted as names.
Furthermore, the terms "first," "second," and the like, are used for descriptive purposes only and are not to be construed as indicating or implying a relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include one or more such feature. In the description of the present application, the meaning of "a plurality" is two or more, unless explicitly defined otherwise.
While preferred embodiments of the present application have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. It is therefore intended that the following claims be interpreted as including the preferred embodiments and all such alterations and modifications as fall within the scope of the application.
It will be apparent to those skilled in the art that various modifications and variations can be made to the present application without departing from the spirit or scope of the application. Thus, it is intended that the present application also include such modifications and alterations insofar as they come within the scope of the appended claims or the equivalents thereof.