CN115374023B - Unit addressing method and device and electronic equipment - Google Patents

Unit addressing method and device and electronic equipment Download PDF

Info

Publication number
CN115374023B
CN115374023B CN202210887587.7A CN202210887587A CN115374023B CN 115374023 B CN115374023 B CN 115374023B CN 202210887587 A CN202210887587 A CN 202210887587A CN 115374023 B CN115374023 B CN 115374023B
Authority
CN
China
Prior art keywords
service
target
unit
identifier
address
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.)
Active
Application number
CN202210887587.7A
Other languages
Chinese (zh)
Other versions
CN115374023A (en
Inventor
刘磊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhongdian Jinxin Software Co Ltd
Original Assignee
Zhongdian Jinxin Software Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhongdian Jinxin Software Co Ltd filed Critical Zhongdian Jinxin Software Co Ltd
Priority to CN202210887587.7A priority Critical patent/CN115374023B/en
Publication of CN115374023A publication Critical patent/CN115374023A/en
Application granted granted Critical
Publication of CN115374023B publication Critical patent/CN115374023B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/04Addressing variable-length words or parts of words

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The embodiment of the application provides a unit addressing method, a unit addressing device and electronic equipment, and relates to the field of network communication. The method comprises the following steps: acquiring a first service request, and determining a first service identifier of a first target service called by the first service request, wherein the first service identifier comprises a plurality of characters; according to the preset key character, at least one character is intercepted from a plurality of characters to serve as a first key character; and determining a first target unit address corresponding to the first key character according to the corresponding relation between the preset key character and the unit address, wherein the first target unit address is the address of the unit where the first target service is located. On the premise of little changing the application program, the service request is automatically transferred to the corresponding unit, and a plurality of characters are intercepted, so that the data quantity required to be stored is greatly reduced, the corresponding relation between the characters and the addresses of the units can be stored in any storage medium, on one hand, the economic burden is reduced, and on the other hand, the burden of program operation is reduced.

Description

Unit addressing method and device and electronic equipment
Technical Field
The present application relates to the field of network communication technologies, and in particular, to a unit addressing method, an electronic device, and a computer readable storage medium.
Background
In the current mass data processing of a large system, great access pressure is caused to a business system, under a novel system, enterprises can divide so much mass data, for example, according to administrative regions, or according to data quantity (for example, each millions is one order of magnitude), the data are stored on different physical storages after being divided, then the same sets of application programs are deployed on the data, a system for storing the mass data originally is achieved, a plurality of independent 'unit' systems are formed, each unit only bears the flow of own unit data, for example, beijing only stores Beijing data, shanghai only stores Shanghai data, and in this case, how to automatically transfer a service request to a corresponding unit to perform data operation is realized by reducing the change of the application programs as much as possible, which is a problem to be solved.
In the related technology, the corresponding relation between a plurality of characters in a service identifier of a service request and a unit address of a target service is directly stored in a storage medium in a directory form, at first, a terminal sends at least one service calling request to a gateway for calling at least one target service, the gateway sends a query request to the storage medium after receiving the at least one service calling request, acquires the unit address of a unit where the at least one target service is located from the storage medium, and sends the at least one service calling request to the unit where the at least one target service is located. On one hand, the gateway performs service positioning and service distribution, and the gateway operates the load; on the other hand, the length of the plurality of characters stored in the storage medium is long, which results in a large data volume and requires a storage medium having a hierarchical directory relationship, and the demand for the storage medium is high.
Disclosure of Invention
Embodiments of the present application provide a method, apparatus, electronic device, computer-readable storage medium, and computer program product for addressing units, which can solve the above-mentioned problems. The technical proposal is as follows:
according to an aspect of embodiments of the present application, there is provided a method of cell addressing, the method comprising:
acquiring a first service request, and determining a first service identifier of a first target service called by the first service request, wherein the first service request is used for requesting to call a first target service on a unit, and the first service identifier comprises a plurality of characters;
according to the preset key character, at least one character is intercepted from a plurality of characters to serve as a first key character;
and determining a first target unit address corresponding to the first key character according to the corresponding relation between the preset key character and the unit address, wherein the first target unit address is the address of the unit where the first target service is located.
As an alternative embodiment, determining the first target unit address corresponding to the first key character further includes:
the first target unit address and the first service request are sent to the gateway to instruct the gateway to send the first service request to the first target unit address.
As an alternative embodiment, the first target unit address and the first service request are sent to the gateway, and then further comprising:
acquiring a second service request, wherein the second service request is used for calling a second target service, and determining a second service identifier of the second target service, and the second service identifier comprises a plurality of characters;
according to the preset key character, at least one character is intercepted from the second service identifier to serve as a second key character;
and determining a second target unit address corresponding to the second key character and a second target unit identifier according to the corresponding relation between the pre-configured key character and the unit address, wherein the second target unit address is the address of the second target service.
As an optional embodiment, determining the second target unit address and the second target unit identifier corresponding to the second key character further includes:
if the second target unit identifier is different from the first target unit identifier, sending a second target unit address and a second service request to the first target service to instruct the first target service to perform the following operations:
and sending the second service request to a second target unit address, and calling the second target service, wherein the first target unit identifier is the unit identifier of the unit where the first target service is located.
As an optional embodiment, determining the second target unit address and the second target unit identifier corresponding to the second key character further includes:
if the second target unit identifier is the same as the unit identifier where the first target service is located, the second service request is sent to the first target service to instruct the first target service to send the second service request to the first target unit address, so that the second target service is called.
As an alternative embodiment, according to a pre-configured key character, at least one character is intercepted from a plurality of characters as a first key character, further comprising:
and obtaining the characters from the first service identifier according to the fields occupied by the characters in the first service identifier.
As an optional embodiment, determining, according to a correspondence between a preconfigured key character and a unit address, a first target unit address corresponding to the first key character includes:
determining a first target unit identifier corresponding to the first key character according to the corresponding relation between the preset key character and the unit identifier;
and determining a first target unit address corresponding to the first target unit identifier according to the corresponding relation between the preconfigured unit identifier and the unit address.
According to a second aspect of embodiments of the present application, there is provided a cell addressing apparatus comprising:
the first acquisition module is used for acquiring a first service request, wherein the first service request is used for requesting to call a first target service on a unit, and determining a first service identifier of the first target service, and the first service identifier comprises a plurality of characters;
a first intercepting module for intercepting at least one character from a plurality of characters as a first key character;
the first determining module is used for determining a first target unit address corresponding to the first key character according to the corresponding relation between the preset key character and the unit address, wherein the first target unit address is the address of the first target service.
As an alternative embodiment, determining the first target unit address corresponding to the first key character further includes:
and the sending module is used for sending the first target unit address and the first service request to the gateway so as to instruct the gateway to send the first service request to the first target unit address.
As an alternative embodiment, the first target unit address and the first service request are sent to the gateway, and then further comprising:
the second acquisition module is used for acquiring a second service request, wherein the second service request is used for calling a second target service and determining a second service identifier of the second target service, and the second service identifier comprises a plurality of characters;
The second intercepting module is used for intercepting at least one character from the second service identifier as a second key character according to the pre-configured key character;
and the second determining module is used for determining a second target unit address corresponding to the second key character and a second target unit identifier according to the corresponding relation between the pre-configured key character and the unit address, wherein the second target unit address is the address of the second target service.
As an optional embodiment, determining the second target unit address and the second target unit identifier corresponding to the second key character further includes:
the first judgment sending module is used for sending the second target unit address and the second service request to the first target service to instruct the first target service to perform the following operations if the second target unit identifier is different from the first target unit identifier:
and sending the second service request to a second target unit address, and calling the second target service, wherein the first target unit identifier is the unit identifier of the unit where the first target service is located.
As an optional embodiment, determining the second target unit address and the second target unit identifier corresponding to the second key character further includes:
And the second judging and transmitting module is used for transmitting a second service request to the first target service if the second target unit identifier is the same as the unit identifier where the first target service is located, so as to instruct the first target service to transmit the second service request to the first target unit address and call the second target service.
As an alternative embodiment, according to a pre-configured key character, at least one character is intercepted from a plurality of characters as a first key character, further comprising:
and the character acquisition module is used for acquiring the characters from the first service identifier according to the fields occupied by the preconfigured characters in the first service identifier.
As an optional embodiment, determining, according to a correspondence between a preconfigured key character and a unit address, a first target unit address corresponding to the first key character includes:
the identification determining module is used for determining a first target unit identification corresponding to the first key character according to the corresponding relation between the preset key character and the unit identification;
and an address determination module. And the method is used for determining a first target unit address corresponding to the first target unit identifier according to the corresponding relation between the preconfigured unit identifier and the unit address.
According to a third aspect of embodiments of the present application, there is provided an electronic device including: a memory, a processor and a computer program stored on the memory, the processor executing the computer program to perform the steps of the cell addressing method of the first aspect described above.
According to a fourth aspect of embodiments of the present application, there is provided a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the cell addressing method of the first aspect described above.
The beneficial effects that technical scheme that this application embodiment provided brought are: determining a first service identifier of a first target service called by a first service request by acquiring the first service request, wherein the first service identifier comprises a plurality of characters and is used for requesting to call a first target service on a unit; according to the preset key characters, at least one character is intercepted from the plurality of characters to serve as a first key character, and the data size to be stored is greatly reduced through intercepting the plurality of characters; and determining a first target unit address corresponding to the first key character according to the corresponding relation between the preset key character and the unit address, wherein the first target unit address is the address of the unit where the first target service is located. The service request is automatically transferred to the corresponding unit, and the corresponding relation between the characters and the unit address can be stored in any storage medium, so that the economic burden is reduced, and the burden of program operation is reduced.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings that are required to be used in the description of the embodiments of the present application will be briefly described below.
Fig. 1 is a schematic diagram of an architecture for implementing a cell addressing method according to an embodiment of the present application;
fig. 2 is a schematic flow chart of a unit addressing method according to an embodiment of the present application;
FIG. 3 is a flow chart of a method for addressing units of inter-service requests according to an embodiment of the present disclosure;
fig. 4 is a flow chart of a unit addressing method based on a terminal request and an inter-service request according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of an electronic device according to a unit addressing method according to an embodiment of the present application.
Detailed Description
Embodiments of the present application are described below with reference to the drawings in the present application. It should be understood that the embodiments described below with reference to the drawings are exemplary descriptions for explaining the technical solutions of the embodiments of the present application, and the technical solutions of the embodiments of the present application are not limited.
As used herein, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless expressly stated otherwise, as understood by those skilled in the art. It will be further understood that the terms "comprises" and "comprising," when used in this application, specify the presence of stated features, information, data, steps, operations, elements, and/or components, but do not preclude the presence or addition of other features, information, data, steps, operations, elements, components, and/or groups thereof, all of which may be included in the present application. It will be understood that when an element is referred to as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element or intervening elements may be present. Further, "connected" or "coupled" as used herein may include wirelessly connected or wirelessly coupled. The term "and/or" as used herein indicates that at least one of the items defined by the term, e.g., "a and/or B" may be implemented as "a", or as "B", or as "a and B".
For the purpose of making the objects, technical solutions and advantages of the present application more apparent, the embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
The present application provides a unit addressing method, apparatus, electronic device, computer readable storage medium and computer program product, which aim to solve the above technical problems in the prior art.
The technical solutions of the embodiments of the present application and technical effects produced by the technical solutions of the present application are described below by describing several exemplary embodiments. It should be noted that the following embodiments may be referred to, or combined with each other, and the description will not be repeated for the same terms, similar features, similar implementation steps, and the like in different embodiments.
Referring to fig. 1, fig. 1 is a schematic architecture diagram of a method for implementing cell addressing according to an embodiment of the present application, where the method includes: terminal 101, unit addressing means 102, gateway 103, unit 104, storage server 105. The specific application scene is as follows: the terminal 101 sends a service call request to the gateway 103, the unit addressing device 102 intercepts the service call request sent by the terminal 101, and processes the service call request and the storage server 105 in a combined way to obtain a target unit address of the service call request, the target unit address and the service request are sent to the gateway 103, and the gateway 103 sends the service request to the unit address where the target service is located.
The terminal 101 may be a computer device, such as a desktop computer, a notebook computer, a bank self-service terminal, etc., and the terminal 101 may send a service request to a gateway for enabling invocation of the target service by the terminal 101.
The unit addressing device 102 is mainly used for intercepting a service request sent by the terminal 101, analyzing the service request, calculating a unit address where a target service is located according to a data corresponding relation queried in the storage server 105, and sending the calculated and determined target unit address and a service request to the gateway 103, where the unit addressing device may be a unitized routing component.
The gateway 103 is mainly used for sending a service request to a target unit address, and the gateway receives the target unit address and the service request returned by the unit addressing device 102 and sends the service request to the target unit address according to the target unit address.
The unit 104 is mainly used for storing the segmented data and services, and each unit can deploy the same service, but each unit stores different data, so that when the terminal 101 invokes the service, the destination unit address needs to be defined. The unit 104 may receive external service requests, and the service in the unit may issue call requests to the outside.
The storage server 105 is mainly used for storing data required for calculating the target unit address, and when the unit addressing device 102 is operating, the storage server 105 can be queried for the required data.
An embodiment of the present application provides a unit addressing method, as shown in fig. 2, which exemplarily illustrates a flowchart of the unit addressing method provided in the embodiment of the present application, where the method may at least include:
s201, acquiring a first service request, and determining a first service identifier of a first target service called by the first service request, wherein the first service request is used for requesting to call a first target service on a unit, and the first service identifier comprises a plurality of characters;
in the embodiment of the invention, when the user wants to realize the function of a certain service, the request is initiated through the terminal, the terminal can adopt a visual interface, and the operations executable by the user at the terminal include but are not limited to clicking operation, voice input and the like. In the present invention, the service refers to a generic term for supporting various services that realize various functions, and may be an application program.
As an alternative embodiment, when the user wishes to inquire the sales amount of the A commodity in the Shanghai region, the user only needs to check the inquiry task instruction, such as the "Shanghai region", "A commodity" and "sales amount", on the interface when submitting the task at the terminal, and the terminal definitely needs to call the service according to the inquiry instruction and sends a first service request to the gateway.
Specifically, the request sent by the terminal to the gateway may be intercepted by the unit addressing device, where the first service request includes a first service identifier of the first target service, where the first service identifier may be a message/parameter of the first service request, and the plurality of characters included in the first service request may be a keyword of the message/parameter of the first service request, where the length of the keyword is generally longer, and may be 6333123423453456, for example.
S202, according to a preset key character, at least one character is intercepted from a plurality of characters to serve as a first key character;
in this embodiment of the present invention, if the first service identifier does not include a character corresponding to the target unit address, that is, the message/parameter of the first service request does not include information of the target unit address, the unit addressing device may intercept a certain number of characters from the plurality of characters as the first key character according to a preset correspondence between key characters and unit addresses, for example, may intercept a one-bit tail number, intercept a two-bit tail number, and so on.
S203, determining a first target unit address corresponding to the first key character according to the corresponding relation between the pre-configured key character and the unit address, wherein the first target unit address is the address of the unit where the first target service is located.
Specifically, the correspondence between the preset key characters and the unit addresses is established through the correspondence between the key characters and the unit identifiers and the correspondence between the unit identifiers and the unit addresses, wherein table 1 and table 2 exemplarily show the correspondence between the key characters and the unit identifiers.
When the 2-bit tail numbers of the preconfigured characters correspond to the unit identifications, the corresponding relation between the key characters and the unit identifications is as follows:
key character Unit identification
0 Unit 1
1 Unit 2
2 Unit 3
…… ……
99 Unit 100
TABLE 1 correspondence table of key characters and unit identifications
When the step values of a plurality of characters are preconfigured, each ten million corresponds to one unit identifier, the corresponding relation between the key characters and the unit identifier is as follows:
key character Unit identification
0 Unit 1
10000000 (in the future) Unit 2
20000000 (in the future) Unit 3
…… ……
90000000 (in the future) Unit 10
TABLE 2 Another correspondence table of key characters and cell identifiers
On the basis of the foregoing embodiments, as an optional embodiment, determining the first target unit address corresponding to the first key character further includes:
the first target unit address and the first service request are sent to the gateway to instruct the gateway to send the first service request to the first target unit address.
After the unit addressing device determines the first target unit address of the first target service according to the corresponding relation, the first target unit address and the first service request are returned to the gateway, and after the gateway receives the first service request and the first target unit address, the gateway can send the first service request to the first target unit address, so that the calling of the first target service is realized.
Based on the foregoing embodiments, as an optional embodiment, if the service identifier of the first target service includes a character corresponding to the first target unit address, the first target unit address and the first service request are sent to the gateway.
In this embodiment of the present invention, the service identifier of the first target service may include a character corresponding to the first target unit address, that is, the service message/parameter of the first target service may include the unit address of the unit where the target service is located, and at this time, the first target unit address of the first target service is not required to be calculated, but the first service request and the target unit address are directly sent to the gateway, so as to instruct the gateway to directly send the first service request to the first target unit address for calling the target service.
Referring to fig. 3, as an alternative embodiment based on the foregoing embodiments, fig. 3 illustrates that the application sends the first target unit address and the first service request to the gateway, and then further includes:
s301, acquiring a second service request, wherein the second service request is used for calling a second target service, and determining a second service identifier of the second target service, and the second service identifier comprises a plurality of characters;
in this embodiment of the present application, after the first target service is invoked, the first target service may also issue a second service request to invoke the second target service, where the second service identifier may be a message/parameter of the second service request, and the second target service also includes a plurality of characters, where the plurality of characters included in the second service identifier may be a keyword of the message/parameter of the second service request, where the length of the keyword is generally longer, for example, may be 6333123423453111.
S302, according to the preset key characters, at least one character is intercepted from the second service identifier to serve as a second key character;
specifically, the unit addressing device may intercept a certain number of characters from the plurality of characters as the second key character according to the correspondence between the preset key characters and the unit address, for example, may intercept a one-bit tail number, intercept a two-bit tail number, and the like.
S303, determining a second target unit address corresponding to the second key character and a second target unit identifier according to the corresponding relation between the pre-configured key character and the unit address, wherein the second target unit address is the address of the second target service.
The corresponding relation between the preset key characters and the unit addresses is established through the corresponding relation between the key characters and the unit identifiers and the corresponding relation between the unit identifiers and the unit addresses.
On the basis of the foregoing embodiments, as an optional embodiment, determining, according to a correspondence between the preconfigured key character and the unit address, a second target unit address corresponding to the second key character includes:
determining a second target unit identifier corresponding to the second key character according to the corresponding relation between the preset key character and the unit identifier;
and determining a second target unit address corresponding to the second target unit identifier according to the corresponding relation between the preconfigured unit identifier and the unit address.
The correspondence between the preset key characters and the unit addresses in the embodiment of the application is established through the correspondence between the key characters and the unit identifiers and the correspondence between the unit identifiers and the unit addresses. The correspondence of the key character "0" with the cell address "http(s):// cell 1" may be achieved, for example, by configuring the key character "0" to correspond to "cell 1" and "cell 1" to correspond to the cell address "http(s):// cell 1" of cell 1.
On the basis of the above embodiments, as an alternative embodiment, the method further includes:
and if the service identifier of the second target service comprises the character corresponding to the second target unit address, sending the target unit address and the second service request to the first target service.
In this embodiment, the service identifier of the second target service may include a character corresponding to the first target unit address, that is, the service message/parameter of the second service request may include the unit address of the unit where the second target service is located, and at this time, the second target unit address is not required to be calculated, but the first service request and the target unit address are directly sent to the first target service, so as to instruct the first target service to directly send the first service request to the first target unit address for invoking the target service.
On the basis of the foregoing embodiments, as an optional embodiment, determining the second target unit address and the second target unit identifier corresponding to the second key character further includes:
if the second target unit identifier is different from the first target unit identifier, sending a second target unit address and a second service request to the first target service to instruct the first target service to perform the following operations:
And sending the second service request to a second target unit address, and calling the second target service, wherein the first target unit identifier is the unit identifier of the unit where the first target service is located.
In this embodiment of the present invention, after a first target service is started, a unit identifier corresponding to the first target service may be determined according to a corresponding relationship between a service configured in advance in the service and the unit identifier, and the unit addressing device may calculate and determine a second target unit identifier and compare the second target unit identifier with the first target unit identifier, where when the two identifiers are different, it is indicated that units where the second target service and the first target service are located are not uniform.
The unit addressing device sends the second target unit address and the second service request to the first target service, and the first target service directly sends the second service request to the second target service after obtaining the second target unit address, thereby realizing the direct connection between the services. In the embodiment of the application, when the service sends the call request to the external unit, the service is not required to be filtered by the routing gateway and then distributed by the gateway, but the direct connection between the service and the service is realized through the unit addressing device, the service is not required to be connected through the gateway, and the cost is saved.
On the basis of the foregoing embodiments, as an optional embodiment, determining the second target unit address and the second target unit identifier corresponding to the second key character further includes:
if the second target unit identifier is the same as the unit identifier where the first target service is located, sending a second service request to the first target service; to instruct the first target service to send a second service request to the first target unit address to invoke the second target service.
In this embodiment of the present application, the second target service may be in the same unit as the first target service, and the unit addressing device compares the calculated second target unit identifier with the first target unit identifier, and when the second target unit identifier and the first target unit identifier are the same, it is stated that the second target service and the first target service are in the same unit.
The unit addressing means returns this information to the first target service, which will invoke the second target service directly in the unit.
For example, when a user takes money from a bank card to a bank counter, the balance is displayed after taking money, and assuming that service a represents a money taking function and service b represents a balance calculating and displaying function, service a invokes service b. And after the user performs the money taking operation on the counter, the terminal calls the service a to perform the money taking function, and the service a calls the service b of the same unit to calculate and display the balance.
On the basis of the foregoing embodiments, as an optional embodiment, according to a pre-configured key character, intercepting at least one character from a plurality of characters as a first key character, further includes:
and obtaining the characters from the first service identifier according to the fields occupied by the characters in the first service identifier.
In this embodiment of the present application, after intercepting the service identifier, the unit addressing device analyzes the service identifier, and according to the position of a plurality of characters having a corresponding relationship with the target service address, which is pre-configured, in the service identifier, the position of a keyword in a service request parameter/message in the parameter/message may be, for example, a hierarchical relationship format: if the level of the plurality of characters in the storage medium is level2, the unit addressing device analyzes the service identifier according to the storage position of the plurality of characters in the service identifier, and obtains the plurality of characters, for example, 6333123423453456 from a storage path with the level of level 2.
On the basis of the above embodiments, as an alternative embodiment, the method further includes:
And if the service identifier of the second target service comprises a character corresponding to the second target unit address, the unit addressing device sends the target unit address and the second service request to the first target service.
In this embodiment of the present invention, the service identifier of the second target service may include a character corresponding to the address of the second target unit, that is, the service message/parameter of the second service request may include the unit address of the unit where the second target service is located, and the unit addressing device does not need to calculate the second target unit address any more, but directly sends the first service request and the target unit address to the first target service, where the first target service directly sends the first service request to the first target unit address for invoking the target service.
On the basis of the foregoing embodiments, as an optional embodiment, determining, according to a correspondence between a preconfigured key character and a unit address, a first target unit address corresponding to the first key character includes:
determining a first target unit identifier corresponding to the first key character according to the corresponding relation between the preset key character and the unit identifier;
and determining a first target unit address corresponding to the first target unit identifier according to the corresponding relation between the preconfigured unit identifier and the unit address.
The correspondence between the preset key characters and the unit addresses in the embodiment of the application is established through the correspondence between the key characters and the unit identifiers and the correspondence between the unit identifiers and the unit addresses. The correspondence of the key character "7" with the cell address "http(s):// cell 1" may be achieved, for example, by configuring the key character "7" to correspond to "cell 1" and "cell 1" to correspond to the cell address "http(s):// cell 1" of cell 1.
On the basis of the foregoing embodiments, as an optional embodiment, determining, according to a predetermined correspondence between key characters and unit addresses, a target unit address corresponding to the key characters includes:
the unit addressing device determines a target unit identifier corresponding to the key character according to the corresponding relation between the preset key character and the unit identifier;
and determining the target unit address corresponding to the target unit identifier according to the corresponding relation between the preconfigured unit identifier and the unit address.
As an alternative embodiment, further comprising:
for each unit, storing a correspondence between a unit identifier of the unit and a unit address of the unit in a storage server;
in the embodiment of the application, the preconfigured unit identifier corresponds to a unit address, that is, one unit identifier uniquely corresponds to one unit address. The unit identifier may also be a unit name, and each unit may define a corresponding identifier, for example, the identifier may be set for different units according to the region where the unit is located, the number arrangement sequence, and the like. The unit address is an address of the unit, which is accessible, typically a domain name or an IP address, and may be, for example: http(s):// cell 1 or http(s): //10.10.10.10.
For each service, storing the positions of a plurality of characters corresponding to the unit address where the service is located in the service identifier of the service, the correspondence between key characters and the unit identifier of the unit where the service is located, and storing the unit identifier of the unit where the service is located in the service in a storage server.
In this embodiment of the present application, the pre-configuring the positions of the plurality of characters having a corresponding relationship with the target unit address where the target service is located in the service identifier may be configuring the positions of the keywords in the message/parameter of the service request, so as to accurately obtain the plurality of characters according to the positions of the plurality of characters in the identifier. For example, hierarchical relationship format: root/level1/level2.
The correspondence between the key characters and the unit identifiers of the units where the service is located can be set by the user during configuration, and each key character can be uniquely corresponding to one unit, or a certain key character can be corresponding to one unit, as shown in table 1 and table 2. The specific corresponding rule scheme is not limited at all, and only needs to satisfy the requirement that the corresponding unit address is found according to the key character finally.
When each service is started, the unit identifier of the unit where the service is located is configured in the service, wherein the corresponding relation between the service and the unit identifier is stored locally, the service only needs to introduce the unit identifier of the unit where the service is located when the service is started, and the unit identifier is consistent with the unit identifier in the storage server, for example, after the service a in the unit 1 is called, the service a needs to send other service calling requests to the outside, and at this time, the locally configured unit identifier of "unit 1" is acquired in the service a.
Optionally, a service name of the service is configured in the storage server, and the service name is not particularly limited, for example, http:// domain name/day/search/history, and "day/search/history" may be configured as a service name, and "history" may be configured as a service name; the service path url accessed can also be configured, and can be a part behind the time domain name of the browser, for example, http:// domain name/search.do/name=xxxx, wherein "search.do" is the name of the service, and "name=xxx" is the url parameter of the service. The function of configuring the service name is that the service name is used as a basis for intercepting a service request sent by a terminal or a service request sent by a certain service by the unit addressing device, if the service which is expected to be invoked is found to be not configured, the unit addressing device does not intercept or calculate the service request, and only the service invoking step of the original terminal or service is executed.
Optionally, the format of the service identifier and the plurality of characters in the service identifier, such as the format of the message/parameter of the service request, may be configured, and the format of the service identifier may be varied, including, but not limited to, json format, xml format, url parameter format, header format of the http request, and the like.
In addition, each configuration item in the embodiment may be stored in any storage medium, and the present solution does not limit this, and only needs to ensure that configured information can be read in the unit addressing method after pre-configuration. Therefore, the embodiment of the application does not need to use a specific type of storage medium, and the extra expense caused by preparing the specific storage medium can be avoided.
Referring to fig. 4, fig. 4 is a schematic flow chart illustrating a unit addressing method according to a complete embodiment of the present application, which may include:
s401, a terminal sends a first service request to a gateway, wherein the first service request is used for requesting to call a first target service on a unit;
s402, the unit addressing device acquires a first service request, and determines a first service identifier of a first target service in the first service request, wherein the first service identifier comprises a plurality of characters;
s403, if the first service identifier does not comprise a character corresponding to the first target unit address, the unit addressing device intercepts at least one character from the first service identifier as a first key character, determines the first target unit address corresponding to the first key character according to the corresponding relation between the preset key character and the unit address, and sends the first target unit address and the first service request to the gateway;
S404, the gateway sends a first service request to a first target unit address so that the terminal invokes a first target service;
s405, the first target service sends a second service request to the gateway, wherein the second service request is used for calling the second target service;
s406, the unit addressing device acquires a second service request, and determines a second service identifier of a second target service in the second service request, wherein the second service identifier comprises a plurality of characters;
s407, if the second service identifier does not comprise a character corresponding to the second target unit address, the unit addressing device intercepts at least one character from the second service identifier as a second key character, and determines the second target unit address and the second target unit identifier corresponding to the second key character according to the corresponding relation between the preset key character and the unit address;
s408, if the second target unit identifier is the same as the unit identifier where the first target service is located, sending a second service request to the first target service;
s409, the first target service sends a second service request to the unit address, so that the first target service calls the second target service.
S410, if the second target unit identifier is different from the first target unit identifier, sending a second target unit address and a second service request to the first target service; the first target unit identifier is a unit identifier of a unit where the first target service is located;
S411, the first target service sends a second service request to the second target unit address, so that the first target service calls the second target service.
For example, in an alternative embodiment, assume that a Z company is located in Beijing.
If the sales situation of the Z company in Beijing is to be inquired, including the customers of the Z company and sales amount corresponding to each customer, a user operates at the terminal, and the terminal generates an inquiry service calling request for calling the inquiry service to inquire the customers of the Z company and sales amount of the customers and sends the inquiry service to the gateway;
the unit addressing device intercepts the query service request to obtain a service identifier of the service, analyzes the service identifier to obtain a plurality of characters, cuts out key characters in the plurality of characters according to a preconfigured rule, determines that the target unit address of the request is a Beijing unit according to the corresponding relation between the key characters and the target unit address, and sends the address of the Beijing unit and the request to the gateway, and the gateway sends the request to the Beijing unit to call the service A with the function of querying the customer information of the company Z.
After inquiring the clients of the Z company, the service A needs to calculate the sales amount between the Z company and all the clients, and sends out a request for calling the service B, wherein the service B can collect the sales amount in the unit. And at startup, service a configures the unit identifier of "beijing unit" in service a locally.
Assuming that the company Z sells goods only in beijing, the unit addressing device intercepts the request for calling the service B, obtains the service identifier of the service B, analyzes the service identifier to obtain a plurality of characters, cuts out key characters in the plurality of characters according to a preconfigured rule, determines that the target unit identifier of the request is a "beijing unit" according to the corresponding relationship between the key characters and the target unit identifier, and sends the information to the service a as the unit identifier configured in the service a, wherein the service a only needs to call in the unit.
Assuming that the Z company only sells goods in the open sea, the unit addressing device determines that the target unit identifier of the request is an "open sea unit" after performing the above operation, and the unit addressing device provides the request for calling the service B and the unit address of the "open sea unit" to the service a, and the service a sends the request for calling the service B to the open sea unit for calculating the total sales amount of the summarized Z company in the open sea, which is different from the unit identifier preconfigured by the service a.
The embodiment of the application provides a unit addressing device, which comprises a first acquisition module 501, a first interception module 502 and a first determination module 503, wherein:
The first acquisition module is used for acquiring a first service request, wherein the first service request is used for requesting to call a first target service on a unit, and determining a first service identifier of the first target service, and the first service identifier comprises a plurality of characters;
the first intercepting module is used for intercepting at least one character from a plurality of characters as a first key character according to a preset key character;
the first determining module is used for determining a first target unit address corresponding to the first key character according to the corresponding relation between the preset key character and the unit address, wherein the first target unit address is the address of the first target service.
The apparatus of the embodiments of the present application may perform the method provided by the embodiments of the present application, and implementation principles of the method are similar, and actions performed by each module in the apparatus of each embodiment of the present application correspond to steps in the method of each embodiment of the present application, and detailed functional descriptions of each module of the apparatus may be referred to in the corresponding method shown in the foregoing, which is not repeated herein.
As an alternative embodiment, determining the first target unit address corresponding to the first key character further includes:
And the sending module is used for sending the first target unit address and the first service request to the gateway so as to instruct the gateway to send the first service request to the first target unit address.
As an alternative embodiment, the first target unit address and the first service request are sent to the gateway, and then further comprising:
the second acquisition module is used for acquiring a second service request, wherein the second service request is used for calling a second target service and determining a second service identifier of the second target service, and the second service identifier comprises a plurality of characters;
the second intercepting module is used for intercepting at least one character from the second service identifier as a second key character according to the pre-configured key character;
and the second determining module is used for determining a second target unit address corresponding to the second key character and a second target unit identifier according to the corresponding relation between the pre-configured key character and the unit address, wherein the second target unit address is the address of the second target service.
As an optional embodiment, determining the second target unit address and the second target unit identifier corresponding to the second key character further includes:
the first judgment sending module is used for sending the second target unit address and the second service request to the first target service to instruct the first target service to perform the following operations if the second target unit identifier is different from the first target unit identifier:
And sending the second service request to a second target unit address, and calling the second target service, wherein the first target unit identifier is the unit identifier of the unit where the first target service is located.
As an optional embodiment, determining the second target unit address and the second target unit identifier corresponding to the second key character further includes:
and the second judging and transmitting module is used for transmitting a second service request to the first target service if the second target unit identifier is the same as the unit identifier where the first target service is located, so as to instruct the first target service to transmit the second service request to the first target unit address and call the second target service.
As an alternative embodiment, according to a pre-configured key character, at least one character is intercepted from a plurality of characters as a first key character, further comprising:
and the character acquisition module is used for acquiring the characters from the first service identifier according to the fields occupied by the preconfigured characters in the first service identifier.
As an optional embodiment, determining, according to a correspondence between a preconfigured key character and a unit address, a first target unit address corresponding to the first key character includes:
The identification determining module is used for determining a first target unit identification corresponding to the first key character according to the corresponding relation between the preset key character and the unit identification;
and an address determination module. And the method is used for determining a first target unit address corresponding to the first target unit identifier according to the corresponding relation between the preconfigured unit identifier and the unit address.
An embodiment of the present application provides an electronic device, including a memory, a processor, and a computer program stored on the memory, where the processor executes the computer program to implement steps of a unit addressing method, and compared with the related art, the steps of the unit addressing method may be implemented: determining a first service identifier of a first target service called by a first service request by acquiring the first service request, wherein the first service identifier comprises a plurality of characters and is used for requesting to call a first target service on a unit; according to the preset key characters, at least one character is intercepted from the plurality of characters to serve as a first key character, and the data size to be stored is greatly reduced through intercepting the plurality of characters; and determining a first target unit address corresponding to the first key character according to the corresponding relation between the preset key character and the unit address, wherein the first target unit address is the address of the unit where the first target service is located. The service request is automatically transferred to the corresponding unit, and the corresponding relation between the characters and the unit address can be stored in any storage medium, so that the economic burden is reduced, and the burden of program operation is reduced.
In an alternative embodiment, there is provided an electronic device, as shown in fig. 5, the electronic device 4000 shown in fig. 5 includes: a processor 4001 and a memory 4003. Wherein the processor 4001 is coupled to the memory 4003, such as via a bus 4002. Optionally, the electronic device 4000 may further comprise a transceiver 4004, the transceiver 4004 may be used for data interaction between the electronic device and other electronic devices, such as transmission of data and/or reception of data, etc. It should be noted that, in practical applications, the transceiver 4004 is not limited to one, and the structure of the electronic device 4000 is not limited to the embodiment of the present application.
The processor 4001 may be a CPU (Central Processing Unit ), general purpose processor, DSP (Digital Signal Processor, data signal processor), ASIC (Application Specific Integrated Circuit ), FPGA (Field Programmable Gate Array, field programmable gate array) or other programmable logic device, transistor logic device, hardware components, or any combination thereof. Which may implement or perform the various exemplary logic blocks, modules, and circuits described in connection with this disclosure. The processor 4001 may also be a combination that implements computing functionality, e.g., comprising one or more microprocessor combinations, a combination of a DSP and a microprocessor, etc.
Bus 4002 may include a path to transfer information between the aforementioned components. Bus 4002 may be a PCI (Peripheral Component Interconnect, peripheral component interconnect standard) bus or an EISA (Extended Industry Standard Architecture ) bus, or the like. The bus 4002 can be divided into an address bus, a data bus, a control bus, and the like. For ease of illustration, only one thick line is shown in fig. 5, but not only one bus or one type of bus.
Memory 4003 may be, but is not limited to, ROM (Read Only Memory) or other type of static storage device that can store static information and instructions, RAM (Random Access Memory ) or other type of dynamic storage device that can store information and instructions, EEPROM (Electrically Erasable Programmable Read Only Memory ), CD-ROM (Compact Disc Read Only Memory, compact disc Read Only Memory) or other optical disk storage, optical disk storage (including compact discs, laser discs, optical discs, digital versatile discs, blu-ray discs, etc.), magnetic disk storage media, other magnetic storage devices, or any other medium that can be used to carry or store a computer program and that can be Read by a computer.
The memory 4003 is used for storing a computer program that executes an embodiment of the present application, and is controlled to be executed by the processor 4001. The processor 4001 is configured to execute a computer program stored in the memory 4003 to realize the steps shown in the foregoing method embodiment.
Embodiments of the present application provide a computer readable storage medium having a computer program stored thereon, where the computer program, when executed by a processor, may implement the steps and corresponding content of the foregoing method embodiments.
The embodiments of the present application also provide a computer program product, which includes a computer program, where the computer program can implement the steps of the foregoing method embodiments and corresponding content when executed by a processor.
The terms "first," "second," "third," "fourth," "1," "2," and the like in the description and in the claims of this application and in the above-described figures, if any, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the present application described herein may be implemented in other sequences than those illustrated or otherwise described.
It should be understood that, although the flowcharts of the embodiments of the present application indicate the respective operation steps by arrows, the order of implementation of these steps is not limited to the order indicated by the arrows. In some implementations of embodiments of the present application, the implementation steps in the flowcharts may be performed in other orders as desired, unless explicitly stated herein. Furthermore, some or all of the steps in the flowcharts may include multiple sub-steps or multiple stages based on the actual implementation scenario. Some or all of these sub-steps or phases may be performed at the same time, or each of these sub-steps or phases may be performed at different times, respectively. In the case of different execution time, the execution sequence of the sub-steps or stages may be flexibly configured according to the requirement, which is not limited in the embodiment of the present application.
The foregoing is merely an optional implementation manner of some implementation scenarios of the present application, and it should be noted that, for those skilled in the art, other similar implementation manners based on the technical ideas of the present application are adopted without departing from the technical ideas of the solution of the present application, which also belongs to the protection scope of the embodiments of the present application.

Claims (10)

1. A method of cell addressing comprising:
acquiring a first service request, and determining a first service identifier of a first target service called by the first service request, wherein the first service request is used for requesting to call a first target service on a unit, and the first service identifier comprises a plurality of characters; wherein, the first service identifier is a message or parameter of a first service request;
intercepting at least one character from the plurality of characters as a first key character according to a pre-configured key character;
and determining a first target unit address corresponding to the first key character according to the corresponding relation between the preset key character and the unit address, wherein the first target unit address is the address of the unit where the first target service is located.
2. The method of claim 1, wherein the determining the first target unit address corresponding to the first key character further comprises:
the first target unit address and the first service request are sent to a gateway to instruct the gateway to send the first service request to the first target unit address.
3. The method of claim 2, wherein the issuing the first target unit address and the first service request to a gateway further comprises:
Acquiring a second service request, wherein the second service request is used for calling a second target service, and determining a second service identifier of the second target service, and the second service identifier comprises a plurality of characters;
according to the preconfigured key character, at least one character is intercepted from the second service identifier to serve as a second key character;
and determining a second target unit address and a second target unit identifier corresponding to the second key character according to the corresponding relation between the pre-configured key character and the unit address, wherein the second target unit address is the address of the second target service.
4. The method of claim 3, wherein the determining the second target unit address and the second target unit identifier corresponding to the second key character further comprises:
if the second target unit identifier is different from the first target unit identifier, the second target unit address and the second service request are sent to the first target service to instruct the first target service to perform the following operations:
and sending the second service request to the second target unit address, and calling the second target service, wherein the first target unit identifier is the unit identifier of the unit where the first target service is located.
5. The method of claim 3, wherein the determining the second target unit address and the second target unit identifier corresponding to the second key character further comprises:
and if the second target unit identifier is the same as the unit identifier where the first target service is located, sending the second service request to the first target service to instruct the first target service to send the second service request to the first target unit address, so as to call the second target service.
6. The method of claim 1, wherein said intercepting at least one character from said plurality of characters as a first key character according to a pre-configured key character further comprises:
and obtaining the characters from the first service identifier according to the fields occupied by the preconfigured characters in the first service identifier.
7. The method according to claim 1, wherein determining the first target unit address corresponding to the first key character according to the correspondence between the pre-configured key character and the unit address includes:
determining a first target unit identifier corresponding to the first key character according to the corresponding relation between the preset key character and the unit identifier;
And determining a first target unit address corresponding to the first target unit identifier according to the corresponding relation between the preconfigured unit identifier and the unit address.
8. A cell addressing apparatus, comprising:
the first acquisition module is used for acquiring a first service request, wherein the first service request is used for requesting to call a first target service on a unit, and determining a first service identifier of the first target service, and the first service identifier comprises a plurality of characters; wherein, the first service identifier is a message or parameter of a first service request;
the first intercepting module is used for intercepting at least one character from the plurality of characters as a first key character according to a preset key character;
the first determining module is used for determining a first target unit address corresponding to the first key character according to the corresponding relation between the preset key character and the unit address, wherein the first target unit address is the address of the first target service.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory, characterized in that the processor executes the computer program to carry out the steps of the method according to any one of claims 1-7.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method according to any of claims 1-7.
CN202210887587.7A 2022-07-26 2022-07-26 Unit addressing method and device and electronic equipment Active CN115374023B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210887587.7A CN115374023B (en) 2022-07-26 2022-07-26 Unit addressing method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210887587.7A CN115374023B (en) 2022-07-26 2022-07-26 Unit addressing method and device and electronic equipment

Publications (2)

Publication Number Publication Date
CN115374023A CN115374023A (en) 2022-11-22
CN115374023B true CN115374023B (en) 2023-06-16

Family

ID=84063506

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210887587.7A Active CN115374023B (en) 2022-07-26 2022-07-26 Unit addressing method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN115374023B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109151025A (en) * 2018-08-22 2019-01-04 京信通信系统(中国)有限公司 Load-balancing method, device, computer storage medium and equipment based on URL
CN112491717A (en) * 2019-09-12 2021-03-12 华为技术有限公司 Service routing method and device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108494755B (en) * 2018-03-13 2020-04-03 华为技术有限公司 Method and device for transmitting Application Programming Interface (API) request

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109151025A (en) * 2018-08-22 2019-01-04 京信通信系统(中国)有限公司 Load-balancing method, device, computer storage medium and equipment based on URL
CN112491717A (en) * 2019-09-12 2021-03-12 华为技术有限公司 Service routing method and device

Also Published As

Publication number Publication date
CN115374023A (en) 2022-11-22

Similar Documents

Publication Publication Date Title
CN107798038B (en) Data response method and data response equipment
CN106202096A (en) Customer terminal webpage rendering intent and device
US20180309802A1 (en) Infinite micro-services architecture
CN113645304B (en) Data service processing method and related equipment
AU2016382909A1 (en) Method and device for processing short link, and short link server
US8731151B2 (en) Methods and apparatus for partially updating a web page using an embedded iFrame
CN109729187B (en) Proxy communication method, system, device and storage medium
CN108279987A (en) The method for edition management and device of application program
CN108200196B (en) Data storage and query method and system based on distributed architecture
CN106878367B (en) Method and device for realizing asynchronous call of service interface
CN112866421A (en) Intelligent contract operation method and device based on distributed cache and NSQ
CN103944942A (en) Multi-WEB environment data access method and device
CN106028311B (en) A kind of terminal registration method and device
CN114185973A (en) Parameter calling method, device, equipment and computer readable storage medium
CN115374023B (en) Unit addressing method and device and electronic equipment
CN111464574B (en) Calling, loading, registering and managing method and route, server, node and medium
CN109561048A (en) A kind of communication management method and device
CN108830441B (en) Resource query method and device
CN108563492B (en) Data acquisition method, virtual machine and electronic equipment
US7881735B2 (en) Messaging gateway and method
CN108920277B (en) Service execution system, method and device and service isolation system
CN114217883A (en) Service registration method and method for calling service according to registration information
CN109788015A (en) Application service invocation system, method and device
CN105117932A (en) Marketing system
CN104980329A (en) Address book management method address book management device and mobile agent server

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