Application interface communication method and system based on bus mode

文档序号:1362540 发布日期:2020-08-11 浏览:11次 中文

阅读说明:本技术 一种基于总线模式的应用接口通信方法和系统 (Application interface communication method and system based on bus mode ) 是由 刘友龙 于 2020-04-22 设计创作,主要内容包括:本发明公开了一种基于总线模式的应用接口通信方法和系统,涉及接口通信领域。该方法包括:发送建立连接请求给多总线集群,在多总线集群中获取可用的总线与接口客户端建立连接;接口客户端通过可用的总线对应的状态可用的适配器联通外围应用;接口客户端通过可用的总线与外围应用进行信息交互,实现了对外围应用的接入管控以及降低外围应用异常对总线及业务侧的阻塞影响,增加系统自动恢复能力,丰富系统监控手段,减少人工干预。(The invention discloses an application interface communication method and system based on a bus mode, and relates to the field of interface communication. The method comprises the following steps: sending a connection establishment request to a multi-bus cluster, and acquiring an available bus in the multi-bus cluster to establish connection with an interface client; the interface client communicates with the peripheral application through the available state adapter corresponding to the available bus; the interface client side performs information interaction with the peripheral application through the available bus, realizes access control on the peripheral application, reduces the blocking influence of peripheral application abnormity on the bus and a service side, increases the automatic recovery capability of the system, enriches the monitoring means of the system, and reduces manual intervention.)

1. An application interface communication method based on a bus mode is characterized by comprising the following steps:

s1, sending a connection establishment request to a multi-bus cluster, and acquiring an available bus in the multi-bus cluster to establish connection with an interface client;

s2, the interface client communicates with the peripheral application through the available state adapter corresponding to the available bus;

and S3, the interface client performs information interaction with the peripheral application through the available bus.

2. The method according to claim 1, wherein the S1 specifically includes: sending a connection establishment request, and acquiring an available bus in the multi-bus cluster through a zookeeper, wherein the bus is connected with an interface client; the available bus specifically includes an adapter that is available corresponding to the bus presence status.

3. The method according to claim 1 or 2, wherein the S1 further includes: checking the adapter registration information of the current bus of the interface client, and if the corresponding state of the current bus is an available adapter, the current bus is an available bus; and if the current bus has no corresponding adapter or the state is unavailable, searching the bus available for the next corresponding adapter as the available bus.

4. The method according to claim 3, wherein the adapter registration information and the adapter status information are stored in a shared memory; and the current bus and other buses perform information interaction through the shared memory.

5. The method according to claim 4, further comprising: s4, monitoring the adapter state, and executing at least one operation of starting a new adapter or restarting the adapter with an unavailable state through the adapter process according to the adapter configuration table information and the adapter state information in the shared memory; the adapter configuration table is used for storing adapter configuration information when the adapters are added.

6. An application interface communication system based on a bus mode, comprising: a service system, an interface client device, a bus cluster, an adapter and a peripheral application;

the service system is used for sending a connection establishment request to the multi-bus cluster, and acquiring an available bus in the multi-bus cluster to establish connection with an interface client;

the interface client device is used for communicating the peripheral application through the adapter with the available bus corresponding to the available state; and performing information interaction with the peripheral application through the available bus.

7. The application interface communication system based on the bus mode as claimed in claim 6, wherein the service system is specifically configured to send a connection establishment request, acquire an available bus in a multi-bus cluster through a zookeeper, and establish a connection with an interface client; the available bus specifically includes an adapter that is available corresponding to the bus presence status.

8. The system according to claim 6 or 7, wherein the service system is further configured to check adapter registration information of a current bus of the interface client, and if there is an adapter whose corresponding status is available in the current bus, the current bus is an available bus; and if the current bus has no corresponding adapter or the state is unavailable, searching the bus available for the next corresponding adapter as the available bus.

9. The bus mode based application interface communication system of claim 8, further comprising: the shared memory conversion device is used for storing the registration information of the adapter and the state information of the adapter; and the method is also used for information interaction between the current bus and other buses.

10. The bus mode based application interface communication system of claim 9, further comprising: the adapter monitoring device is used for monitoring the state of the adapter and executing at least one operation of starting a new adapter or restarting the adapter with an unavailable state through an adapter process according to the adapter configuration table information and the state information of the adapter in the shared memory; the adapter configuration table is used for storing adapter configuration information when the adapters are added.

Technical Field

The present invention relates to the field of interface communication, and in particular, to a method and a system for application interface communication based on a bus mode.

Background

With the increase of independent application of the internet, the diversity of peripheral application accessed by a system also starts to increase, the robustness is also good, and the interface communication management of the application needs to be effectively solved; when multiple peripheral applications access the same bus, the abnormal conditions have an impact on each other.

Disclosure of Invention

The invention aims to solve the technical problem of the prior art and provides an application interface communication method and system based on a bus mode.

The technical scheme for solving the technical problems is as follows:

an application interface communication method based on a bus mode comprises the following steps:

s1, sending a connection establishment request to a multi-bus cluster, and acquiring an available bus in the multi-bus cluster to establish connection with an interface client;

s2, the interface client communicates with the peripheral application through the available state adapter corresponding to the available bus;

and S3, the interface client performs information interaction with the peripheral application through the available bus.

The invention has the beneficial effects that: according to the scheme, the available buses are acquired through the multi-bus cluster to establish connection with the interface client, and the interface client is communicated with the peripheral application through the available adapters in the states corresponding to the available buses; the interface client side performs information interaction with the peripheral application through the available bus, realizes access control on the peripheral application, reduces the blocking influence of peripheral application abnormity on the bus and a service side, increases the automatic recovery capability of the system, enriches the monitoring means of the system, and reduces manual intervention.

Further, the S1 specifically includes: sending a connection establishment request, and acquiring an available bus in the multi-bus cluster through a zookeeper, wherein the bus is connected with an interface client; the available bus specifically includes an adapter that is available corresponding to the bus presence status.

The beneficial effect of adopting the further scheme is that: according to the scheme, a zookeeper is used for acquiring an available bus in a multi-bus cluster, and the bus is connected with an interface client; the client can acquire the live bus through the zookeeper to realize the multi-live of the bus, and even if the use of the system is not influenced by the exception of part of the bus, the new connection can be allocated to other available bus takeover.

Further, the S1 further specifically includes: checking the adapter registration information of the current bus of the interface client, and if the corresponding state of the current bus is an available adapter, the current bus is an available bus; and if the current bus has no corresponding adapter or the state is unavailable, searching the bus available for the next corresponding adapter as the available bus.

The beneficial effect of adopting the further scheme is that: by checking the adapter registration information of the current bus of the interface client, if the current bus has an available adapter in a corresponding state, the current bus is an available bus, otherwise, the available bus of the next corresponding adapter is searched, so that the bus and the adapter connected with the current interface client are both available, the interface application is not influenced when the bus is abnormal, and the normal information interaction between the interface client and the external application is ensured; when the interface client is prevented from being connected to an available bus, the link is considered to be not in problem, and the adapter state is ignored, so that the problem of unsuccessful information interaction with the external application is caused.

Further, the adapter registration information and the adapter state information are stored in a shared memory; and the current bus and other buses perform information interaction through the shared memory.

The beneficial effect of adopting the further scheme is that: storing the registration information of the adapter and the state information of the adapter in a shared memory; the current bus and other buses carry out information interaction through the shared memory, so that if the current bus has no corresponding adapter or is unavailable in state, the adapter on the next available bus is searched, the connection is transferred to the corresponding bus, and the peripheral platform can be automatically recovered without manual operation when the peripheral platform is recovered after abnormal.

Further, monitoring the state of the adapter, and executing at least one operation of starting a new adapter or restarting the adapter with an unavailable state through an adapter process according to the adapter configuration table information and the state information of the adapter in the shared memory; the adapter configuration table is used for storing adapter configuration information when the adapters are added.

The beneficial effect of adopting the further scheme is that: this scheme is through monitoring adapter state, and when a certain peripheral platform interface was unusual, other interface applications can normal communication, were not influenced to can be through the information and the state of all access applications of directly perceived management and control.

Another technical solution of the present invention for solving the above technical problems is as follows:

an application interface communication system based on a bus mode, comprising: a service system, an interface client device, a bus cluster, an adapter and a peripheral application;

the service system is used for sending a connection establishment request to the multi-bus cluster, and acquiring an available bus in the multi-bus cluster to establish connection with an interface client;

the interface client device is used for communicating the peripheral application through the adapter with the available bus corresponding to the available state; and performing information interaction with the peripheral application through the available bus.

The invention has the beneficial effects that: according to the scheme, the available buses are acquired through the multi-bus cluster to establish connection with the interface client, and the interface client is communicated with the peripheral application through the available adapters in the states corresponding to the available buses; the interface client side performs information interaction with the peripheral application through the available bus, realizes access control on the peripheral application, reduces the blocking influence of peripheral application abnormity on the bus and a service side, increases the automatic recovery capability of the system, enriches the monitoring means of the system, and reduces manual intervention.

Further, the service system is specifically configured to send a connection establishment request, acquire an available bus in the multi-bus cluster through the zookeeper, and establish connection between the bus and the interface client; the available bus specifically includes an adapter that is available corresponding to the bus presence status.

The beneficial effect of adopting the further scheme is that: according to the scheme, a zookeeper is used for acquiring an available bus in a multi-bus cluster, and the bus is connected with an interface client; the client can acquire the live bus through the zookeeper to realize the multi-live of the bus, and even if the use of the system is not influenced by the exception of part of the bus, the new connection can be allocated to other available bus takeover.

Further, the service system is further specifically configured to view adapter registration information of a current bus of the interface client, and if an adapter corresponding to the current bus and having a state of being available exists, the current bus is an available bus; and if the current bus has no corresponding adapter or the state is unavailable, searching the bus available for the next corresponding adapter as the available bus.

The beneficial effect of adopting the further scheme is that: by checking the adapter registration information of the current bus of the interface client, if the current bus has an available adapter in a corresponding state, the current bus is an available bus, otherwise, the available bus of the next corresponding adapter is searched, so that the bus and the adapter connected with the current interface client are both available, the interface application is not influenced when the bus is abnormal, and the interface client and the external application are ensured to be in normal information interaction; when the interface client is prevented from being connected to an available bus, the link is considered to be not in problem, and the adapter state is ignored, so that the problem of unsuccessful information interaction with the external application is caused.

Further, still include: the shared memory conversion device is used for storing the registration information of the adapter and the state information of the adapter; and the method is also used for information interaction between the current bus and other buses.

The beneficial effect of adopting the further scheme is that: storing the registration information of the adapter and the state information of the adapter in a shared memory; the current bus and other buses carry out information interaction through the shared memory, so that if the current bus has no corresponding adapter or is unavailable in state, the adapter on the next available bus is searched, the connection is transferred to the corresponding bus, and the peripheral platform can be automatically recovered without manual operation when the peripheral platform is recovered after abnormal.

Further, still include: the adapter monitoring device is used for monitoring the state of the adapter and executing at least one operation of starting a new adapter or restarting the adapter with an unavailable state through an adapter process according to the adapter configuration table information and the state information of the adapter in the shared memory; the adapter configuration table is used for storing adapter configuration information when the adapter is added.

The beneficial effect of adopting the further scheme is that: this scheme is through monitoring adapter state, and when a certain peripheral platform interface was unusual, other interface applications can normal communication, were not influenced to can be through the information and the state of all access applications of directly perceived management and control.

Advantages of additional aspects of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention.

Drawings

Fig. 1 is a schematic flowchart of an application interface communication method based on a bus mode according to an embodiment of the present invention;

FIG. 2 is a block diagram of an application interface communication system based on a bus mode according to another embodiment of the present invention;

fig. 3 is an architecture diagram of an application interface communication system based on a bus mode according to another embodiment of the present invention.

Detailed Description

The principles and features of this invention are described below in conjunction with the following drawings, which are set forth to illustrate, but are not to be construed to limit the scope of the invention.

As shown in fig. 1, a bus mode-based application interface communication method provided in an embodiment of the present invention includes:

s1, sending a connection establishment request to the multi-bus cluster, and acquiring an available bus in the multi-bus cluster to establish connection with the interface client;

it should be noted that, in a multi-bus cluster, the number of clusters is configurable, the number of clusters can be in a range of 4-8, information interaction is performed between buses through a shared memory, and bus access management is performed through a zookeeper.

S2, the interface client communicates with the peripheral application through the available state adapter corresponding to the available bus;

it should be noted that, in a certain embodiment, the number of adapters started may not exceed the number of bus starts, and each bus can only connect one adapter for one peripheral system; the heartbeat of the adapter to the peripheral platform is realized through the adapter monitoring process, when the peripheral platform is recovered, the adapter monitoring program realizes the communication between the adapter and the peripheral platform again, and meanwhile, the state of the adapter is updated to the shared memory, and the new transaction request is automatically connected to the adapter with the available state. The peripheral interface adapter configuration table is added to include contents, as shown in table 1:

APPID URL adapter version Concurrent number

TABLE 1

And S3, the interface client performs information interaction with the peripheral application through the available bus.

It should be noted that the interface client interacts with the peripheral application, and performs bus access management through the zookeeper, that is, as shown in the ZK part in fig. 3, the zookeeper acquires an available bus and an available adapter according to the states of the bus and the adapter stored in the shared memory, so that the interface client is connected with the corresponding peripheral application.

According to the scheme, the available buses are acquired through the multi-bus cluster to establish connection with the interface client, and the interface client is communicated with the peripheral application through the available adapters in the states corresponding to the available buses; the interface client side performs information interaction with the peripheral application through the available bus, realizes access control on the peripheral application, reduces the blocking influence of peripheral application abnormity on the bus and a service side, increases the automatic recovery capability of the system, enriches the monitoring means of the system, and reduces manual intervention.

Preferably, in any of the above embodiments, S1 specifically includes: sending a connection establishment request, acquiring an available bus in the multi-bus cluster through a zookeeper, and establishing connection between the bus and an interface client; the available bus specifically includes an adapter whose corresponding bus presence state is available.

According to the scheme, the zookeeper is used for acquiring the available buses in the multi-bus cluster, and the buses are connected with the interface client; the client can acquire the live bus through the zookeeper to realize the multi-live of the bus, and even if the use of the system is not influenced by the exception of part of the bus, the new connection can be allocated to other available bus takeover.

Preferably, in any of the above embodiments, S1 further specifically includes: checking the adapter registration information of the current bus of the interface client, and if the corresponding state of the current bus is an available adapter, the current bus is an available bus; if the current bus has no corresponding adapter or the status is unavailable, the available bus of the next corresponding adapter is searched as the available bus.

By checking the adapter registration information of the current bus of the interface client, if the corresponding state of the current bus is an available adapter, the current bus is an available bus, otherwise, the available bus of the next corresponding adapter is searched, so that the bus and the adapter connected with the current interface client are both available, the interface application is not influenced when the bus is abnormal, and the normal information interaction between the interface client and the external application is ensured; when the interface client is prevented from being connected to an available bus, the link is considered to be not in problem, and the adapter state is ignored, so that the problem of unsuccessful information interaction with the external application is caused.

Preferably, in any of the above embodiments, the adapter registration information and the state information of the adapter are stored in the shared memory; and the current bus and other buses perform information interaction through the shared memory.

It should be noted that, by sharing the memory, the corresponding relationship of the adapter registration bus and the adapter process state are stored and controlled. In one embodiment, when a bus receives a request for establishing connection with a client, according to the api, that is, for a service interface identifier of a peripheral application, the registration information of the adapter corresponding to the interface is queried, the registration information of the adapter of the current bus is checked first, if there is a corresponding available adapter under the current bus, the connection is established, if there is no corresponding adapter or the state is unavailable, the adapter on the next available bus is searched, and the connection is transferred to the corresponding bus. In a certain embodiment, the judgment on whether the adapter is available may be performed by performing heartbeat monitoring and actual communication result detection on the adapter connected to the bus, judging whether the adapter is available, and considering that the adapter is unavailable if no response or corresponding abnormality is made through X consecutive requests, otherwise, the adapter is available, and the main management and control information may include: APPID, URL, adapter version, concurrency number, bus ID, unique pipelining, registration time, and adapter status, etc.

Storing the registration information of the adapter and the state information of the adapter in a shared memory; the current bus and other buses carry out information interaction through the shared memory, so that if the current bus does not have a corresponding adapter or the state is unavailable, the adapter on the next available bus is searched, the connection is transferred to the corresponding bus, and the automatic recovery can be realized without manual operation when the peripheral platform is recovered after abnormity.

Preferably, in any of the above embodiments, the adapter state is monitored, and at least one of an operation of starting a new adapter or an operation of restarting an adapter whose state is unavailable is executed by an adapter process according to adapter configuration table information and state information of the adapter in the shared memory; the adapter configuration table is used for storing adapter configuration information when the adapter is added.

It should be noted that, the adapter process is restarted through the adapter configuration table and the shared memory adapter state; in one embodiment, when the default concurrency of the a-interface adapter is 3, but there are only 2 in the shared memory and 1 state is unavailable, the process restarts an adapter process, and the unavailable adapter process is restarted.

This scheme is through monitoring adapter state, and when a certain peripheral platform interface was unusual, other interface applications can normal communication, were not influenced to can be through the information and the state of all access applications of directly perceived management and control.

In one embodiment, as shown in fig. 2, an application interface communication system based on a bus mode includes: a business system 11, an interface client device 12, a bus cluster 13, an adapter 14, and a peripheral application 15; the service system 11 is configured to send a connection establishment request to the multi-bus cluster 13, and obtain an available bus in the multi-bus cluster 13 to establish connection with the interface client;

the interface client device 12 is used for communicating the peripheral application 15 through the adapter 14 whose available bus corresponds to the available state; the information interaction with the peripheral application 15 takes place via the available bus.

According to the scheme, the available buses are acquired through the multi-bus cluster 13 to establish connection with the interface client, and the interface client is communicated with the peripheral application 15 through the available adapter 14 corresponding to the available buses in the available state; the interface client side performs information interaction with the peripheral application 15 through the available bus, realizes access control on the peripheral application 15, reduces the blocking influence of peripheral application 15 abnormity on the bus and a service side, increases the automatic recovery capability of the system, enriches the monitoring means of the system, and reduces manual intervention.

Preferably, in any of the embodiments described above, the service system 11 is specifically configured to send a connection establishment request, acquire an available bus in the multi-bus cluster 13 through the zookeeper, and establish connection between the bus and the interface client; the available bus includes the adapter 14 whose corresponding bus presence status is available.

According to the scheme, the available buses in the multi-bus cluster 13 are acquired through the zookeeper, and the buses are connected with the interface client; the client can acquire the live bus through the zookeeper to realize the multi-live of the bus, and even if the use of the system is not influenced by the exception of part of the bus, the new connection can be allocated to other available bus takeover.

Preferably, in any of the above embodiments, the service system 11 is further specifically configured to view the registration information of the adapter 14 of the current bus of the interface client, and if there is an adapter 14 whose corresponding state is available in the current bus, the current bus is an available bus; if the current bus does not have a corresponding adapter 14 or the status is unavailable, the next available bus corresponding to the adapter 14 is looked up as the available bus.

By checking the registration information of the adapter 14 of the current bus of the interface client, if the corresponding state of the current bus is an available adapter 14, the current bus is an available bus, otherwise, the available bus of the next corresponding adapter 14 is searched, so that the bus connected with the current interface client and the adapter 14 are both available, the interface application is not influenced when the bus is abnormal, and the normal information interaction between the interface client and the external application is ensured; avoiding connection of the interface client to an available bus considers the link to be unproblematic and ignores the adapter 14 state, resulting in an unsuccessful interaction with external application information.

Preferably, in any of the above embodiments, further comprising: a shared memory transfer device for storing the registration information of the adapter 14 and the status information of the adapter 14; but also for information interaction of the current bus with other buses.

The registration information and the status information of the adapter 14 are stored in the shared memory by the adapter 14; the current bus and other buses carry out information interaction through the shared memory, so that if the current bus does not correspond to the adapter 14 or the state is unavailable, the adapter 14 on the next available bus is searched, the connection is transferred to the corresponding bus, and the peripheral platform can be automatically recovered without manual operation when the peripheral platform is abnormally recovered.

Preferably, in any of the above embodiments, further comprising: the adapter monitoring device is used for monitoring the state of the adapter 14, and executing at least one operation of starting a new adapter 14 or restarting the adapter 14 with an unavailable state through the process of the adapter 14 according to the configuration table information of the adapter 14 and the state information of the adapter 14 in the shared memory; the adapter configuration table is used to store adapter configuration information when adding the adapter 14.

According to the scheme, the state of the adapter 14 is monitored, when a certain peripheral platform interface is abnormal, other interface applications can normally communicate without being influenced, and all information and states of access applications can be controlled visually.

It is understood that some or all of the alternative embodiments described above may be included in some embodiments.

It should be noted that the above embodiments are product embodiments corresponding to the previous method embodiments, and for the description of each optional implementation in the product embodiments, reference may be made to corresponding descriptions in the above method embodiments, and details are not described here again.

The reader should understand that in the description of this specification, reference to the description of the terms "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above are not necessarily intended to refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, various embodiments or examples and features of different embodiments or examples described in this specification can be combined and combined by one skilled in the art without contradiction.

In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described method embodiments are merely illustrative, and for example, the division of steps into only one logical functional division may be implemented in practice in another way, for example, multiple steps may be combined or integrated into another step, or some features may be omitted, or not implemented.

The above method, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention essentially or partially contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-only memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.

While the invention has been described with reference to specific embodiments, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the invention as defined by the appended claims. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

10页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种USB移动硬盘转接板及USB移动硬盘盒子

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!