Patent Description:
Recently, the OPC Foundation has added a pub-sub capability to the specifications as an alternative to the client-server model and its request-response approach. In concept, publishers (data sources) in the pub-sub model send messages to a broker (message broker) that relays the messages to data-consumer nodes that have previously requested to be sent messages on a particular subject. Compared with the client-server model, the pub-sub model decouples data sources with data consumers and transforms a system from a centralized model to a distributed model.

A key advantage of such a frame structure is that it simplifies software running on programmable logic controllers (PLCs), human-machine interfaces (HMIs), enterprise resource planning (ERP) systems crossing systems of different suppliers, and other IT systems. The result is that a factory can be set up quicker, gathering and analyzing more information. This additional analysis can improve operational efficiency and, by spying problems early, reduce downtime.

In the prior art, Eclipse 4diac™ provides an open source architecture for a distributed industrial process measurement and control system based on the IEC <NUM> standard. It can use publishers and subscribers for application communication. However, in this method, engineers need to manually configure a pub/sub function block for each data point.

Reference document <NUM>: <CIT>, Performing an operation on a message received from a publish/subscribe service, https://patents. com/patent/<CIT>/en.

Reference document <NUM>: <CIT> (same as <CIT>), Pub/sub message invoking
a subscribers client application program, https://patents. com/patent/<CIT>/en. <CIT> relates to service layer interworking using the MQTT protocol within the oneM2M framework.

According to an object of the present invention, there is provided a method as claimed in claim <NUM> for implementing communication conversion between a server-client system and a pub-sub system.

Further objects of the invention are a corresponding gateway as in claim <NUM>, a corresponding system according to claim <NUM>, a corresponding machine-readable storage medium as in claim <NUM>, computer program as in claim <NUM>, and a computer program product as in claim <NUM>. Preferred embodiments are covered by the appended dependent claims.

The foregoing and other objectives, features, and advantages of the present invention can be more easily understood with reference to the following descriptions of embodiments of the present invention in conjunction with the accompanying drawings. Components in the accompanying drawings are merely for illustrating the principle of the present invention. In the accompanying drawings, same or similar technical features or components are represented by using same or similar reference signs.

The subject matter described herein are now discussed with reference to exemplary implementations. It should be understood that the discussion of these implementations is merely intended to help a person skilled in the art to better understand and implement the subject matter described herein, but not to limit the protection scope as set forth in the claims. The functions and arrangement of the discussed elements can be changed without departing from the protection scope of the present disclosure. Various processes or components may be omitted, replaced, or added in various examples as required.

As used herein, the term "include" and variants thereof represent an open term, which means "including but not limited to". The term "based on" represents "at least partially based on". The terms "an embodiment" and "the embodiment" represent "at least one embodiment". The term "another embodiment" denotes "at least one another embodiment". The terms "first", "second", and the like may refer to different or the same objects. Other definitions, whether explicit or implicit, can be included below. Unless expressly specified in the context, the definition of a term is consistent throughout the specification.

In a client-server system, a server provides functions or services to one or more clients for which the client initiates a request. The client exchanges messages with the server in a request-response model. The client sends a request with a server address, and the server replies with a response with a client address.

In a pub-sub system, a publisher publishes a message on an intermediate message broker or an event bus, and a subscriber registers the subscription with the broker and let the broker to perform filtering. This model decouples service providers with consumers, and consumers only need to pre-configure an address of the broker.

In the present disclosure, a method that can simply and conveniently implement communication conversion between a conventional client-server-based system and a pub-sub mode-based system is proposed.

The following describes a method for implementing communication conversion between a server-client system and a pub-sub system, a gateway device, and a network system according to the embodiments of the present disclosure with reference to accompanying drawings.

<FIG> is a flowchart of an exemplary process of a method <NUM> for implementing communication conversion between a server-client system and a pub-sub system according to an embodiment of the present invention.

First, in step S102, a message is received from the pub-sub system, where a topic of the message includes information related to a target service in the server-client system to which the message is to be sent, and a payload of the message includes identification information of a consumer in the pub-sub system, and the consumer is to receive a response message from the server-client system.

In the solution according to the present disclosure, the message to be sent from the pub-sub system to the server-client system is defined. The topic of the message can represent the information related to the target service in the server-client system to which the message is to be sent, for example, the topic of the message may be defined to include character strings of the names of a host and a service provider that provide the target service and a character string of the name of the target service, such that the server-client system can determine, after receiving the message, a server provider on a host to which the message is to be sent. The payload of the message may include the identification information of the consumer in the pub-sub system that is to receive the response message, so that after the response message from the server-client system is sent to the pub-sub system, the broker therein may know the consumer to which the response message is to be forwarded.

The topic and payload of the message may be defined as a character string in the JSON format, XML format, binary format, or the like. In the present invention, a specific form of the topic and the payload of the message is not limited.

In addition, optionally, the payload of the message may further include the name of a function corresponding to the target service, a parameter of the function, and the like.

In this way, the name of the function and the parameter of the function are placed in the payload instead of the topic of the message, which may reduce the number of topics. In addition, mapping onto specific functions may be performed for calling, so as to trigger the service of the server.

After the message from the pub-sub system is received, in step S104, the message is parsed, and a host and a service provider that provide the target service, and the consumer who is to receive the response message are determined.

In step S106, a request message for the target service is sent to the service provider on the determined host.

In the method according to the present disclosure, a data communication model performed on the server-client system side is a common request-response model. Since the host and service provider that provide the target service are determined in the previous step S104, the request message for the target service may be sent directly to the corresponding service provider.

Next, in step S108, the response message from the service provider may be received.

In step S110, the identification information of the consumer is added to the response message based on the consumer in the pub-sub system that is determined in step S104 and that is to receive the response message, for example, the identification information may be added to a topic of the response message to be sent to the pub-sub system, and then the message is sent to the pub-sub system.

After receiving the message, the broker in the pub-sub system may determine, based on the identification information of the consumer, the consumer to which the response message is to be sent. Those skilled in the art may understand a specific process of how the broker in the pub-sub system is to forward the message, which will not be described in detail herein.

In the above method, the request-response model is used in the server-client system, the pub-sub model is used in the pub-sub system, and the communication conversion between the server-client system and the pub-sub system may be implemented without making any changes to each of the systems. Through the above steps, the consumer in the pub-sub system may request a service in which the consumer is interested from the server in the server-client.

In an example, before the server-client receives the message from the consumer in the pub-sub system, step S101 may be included, that is, a service provided by the service provider in the server-client system is first scanned, and then the service is published in the pub-sub system, such that the consumer in the pub-sub system is capable of establishing a connection with the service provider of the service in which the consumer is interested.

In this way, services may be automatically scanned and broadcast, and pub/sub clients may be created dynamically and automatically through gateways.

In a specific example, service repositories of all server providers may be scanned and then corresponding topics may be subscribed. All services, including corresponding function names and parameters, may be organized as messages in JSON format with a topic thereof defined as "adv", which represents an advertisement.

Preferably, advertisement messages may be broadcast periodically, and each consumer may subscribe to topics of interest, and obtain services of interest by parsing advertisements, for example, may obtain function names and parameters.

<FIG> is a block diagram of an exemplary configuration of a gateway device <NUM> according to another embodiment of the present disclosure. Through the gateway device, communication conversion between a server-client system and a pub-sub system is implemented.

As shown in <FIG>, the gateway device <NUM> includes: a pub-sub system message receiving unit <NUM>, a parsing unit <NUM>, a request message sending unit <NUM>, a response message receiving unit <NUM>, and a server-client system message sending unit <NUM>.

The pub-sub system message receiving unit <NUM> is configured to receive a message from the pub-sub system, a topic of the message including information related to a target service in the server-client system to which the message is to be sent, and a payload of the message including identification information of a consumer in the pub-sub system, and the consumer is to receive a response message from the server-client system.

The parsing unit <NUM> is configured to parse the message, and determine a host and a service provider that provide the target service, and the consumer who is to receive the response message.

The request message sending unit <NUM> is configured to send a request message for the target service to the service provider on the determined host.

The response message receiving unit <NUM> is configured to receive the response message from the service provider.

The server-client system message sending unit <NUM> is configured to add the identification information of the consumer to the response message, and send the response message to the pub-sub system.

The topic of the message may include the names of the host and the service provider that provide the target service and the name of the target service.

The payload of the message may further include a function name and a parameter that correspond to the target service to be subscribed to by the consumer.

In an example, the gateway device may further include: a service scanning unit <NUM> configured to scan a service provided by the service provider in the server-client system, and publish the service in the pub-sub system, such that the consumer in the pub-sub system is capable of establishing a connection with the service provider of the service to which the consumer wants to subscribe.

Details about operations and functions of various parts of the gateway device <NUM> shown in <FIG> may be, for example, the same as or similar to related parts in the embodiments of the method <NUM> for implementing communication conversion between a server-client system and a pub-sub system in the present disclosure described with reference to <FIG>, and are not repeated herein.

Through the above method or gateway device, the communication conversion between the server-client system and the pub-sub system may be implemented.

It should be further noted that the gateway device <NUM> and a structure of constituent units of the gateway device shown in <FIG> are merely examples, and those skilled in the art may modify the structural block diagram of <FIG> according to requirements.

<FIG> is a schematic block diagram of a network system <NUM> performing communication using a gateway device according to the present disclosure.

The network system <NUM> shown in <FIG> includes a server-client system <NUM> and a pub-sub system <NUM>. One gateway device <NUM> as described above is provided in the server-client system <NUM>. The server-client system <NUM> may communicate with the pub-sub system <NUM> through the gateway device <NUM>.

A specific example of performing communication between a server-client system <NUM> and a pub-sub system <NUM> through the gateway device <NUM> is described in detail below with reference to <FIG>. In <FIG>, a detailed process in which a consumer A <NUM> and a consumer B <NUM> in the pub-sub system <NUM> subscribe to a service in the server-client system <NUM> is specifically described.

In <FIG>, <NUM> represents a server Host1 in the client-server system, <NUM> represents the pub-sub system, <NUM> represents a provider (service provider) Provider1 on Host1, <NUM> represents the gateway device as described above, <NUM> represents a client Client1 created by the gateway device, <NUM> represents a broker (message broker), <NUM> represents a consumer A, and <NUM> represents a consumer B.

First, in step S411, the gateway device <NUM> subscribes to a service from the broker <NUM> "Sub Host1/Provider1/Interface1".

Next, the consumer A <NUM> subscribes to the service in S412-<NUM> "Sub ClientA/InterfaceReply1", and then in step S413-<NUM>, publishes "Pub Host1/Provider1/Interface1" to the broker <NUM>, and the topic of the message includes the name Host1 of a host of the service to be subscribed to, the name Provider1 of the service provider, and the name Interface1 of the service to be subscribed to. Similarly, the consumer B <NUM> subscribes to the service in S412-<NUM> "ClientB/InterfaceReply1", and then in S413-<NUM>, publishes "Pub Host1/Provider1/Interface1" to the broker <NUM>, and the topic of the message includes the name Host1 of the host of the service to be subscribed to, the name Provider1 of the service provider, and the name Interface1 of the service to be subscribed to.

In step S414, the broker <NUM> forwards the message "Fwd Host1/Provider1/Interface1".

In step S415, the client Client1 <NUM> is created in the gateway device <NUM>, and Client1 <NUM> sends a request message "Interface1" to Provider1 <NUM>.

In step S416, Client1 <NUM> receives a response message "InterfaceReply1" from Provider1 <NUM>.

In steps S417-<NUM> and S417-<NUM>, Client1 <NUM> publishes "Pub ClientA/InterfaceReply1" and "Pub ClientB/InterfaceReply1" separately.

In steps S418-<NUM> and S418-<NUM>, the broker <NUM> forwards "Fwd ClientA/InterfaceReply1" and "Fwd ClientB/InterfaceReply1" to the consumer A and the consumer B, respectively.

Through the above steps, the entire process in which the consumer A and the consumer B in the pub-sub system subscribe to the service Interface1 from the service provider Provider1 on the host Host1 in the server-client system is completed.

In the above process, the service provider (server) subscribes to the service that may be provided, the consumers publish the message as a request, and the consumers may also subscribe to a subject received as a response to the request.

A specific example of performing communication between a server-client system and a pub-sub system according to another embodiment of the present disclosure is described below with reference to <FIG>.

In <FIG>, <NUM> represents Host1 (a server), <NUM> represents the pub-sub system, and Provider1 (a service provider) <NUM> and a gateway <NUM> are provided on Host1 <NUM>. <NUM> represents a broker and <NUM> represents a consumer A.

An entire communication process may be divided into five steps, including a scanning step S51, a discovery step S52, a connection step S53, a request/response step S54, and a disconnection step S55.

Specifically, the scanning step S51 includes sub-steps S511 and S512. In sub-step S511, the gateway <NUM> scans all services that may be provided by the service provider on Host1 <NUM>, and then in sub-step S512, the gateway <NUM> subscribes to all services from the broker <NUM> of the pub-sub system "Sub all interface".

The discovery step S52 includes sub-steps S521, S522, and S523. In sub-step S521, the consumer A <NUM> in the pub-sub system subscribes to an advertisement in Host1 <NUM> "Sub Host1 adv". In sub-step S522, the gateway <NUM> publishes the advertisement of all the services that Host1 <NUM> can provide to the broker <NUM> "Pub Host1 adv". In sub-step S523, the broker <NUM> forwards the advertisement to the consumer A <NUM> "Forward Host1 adv".

The connection step S53 includes sub-steps S531 to S538. In sub-step S531, the consumer A <NUM> subscribes to an "onConnect" message from the broker <NUM> "Sub"onConnect"message". In sub-step S532, the consumer A <NUM> publishes a "Connect" message to the broker <NUM> "Pub"Connect"message". In sub-step S533, the broker <NUM> forwards the "Connect" message to the gateway <NUM> "Forward"Connect"message". In sub-step S534, the gateway <NUM> creates a client, and in sub-step S535, the client sends a connection request message "Interface1 Connect()" for the service "Interface1" to Provider1 <NUM>. In sub-step S536, Provider1 <NUM> sends a response message "Interface1 Connected()" to the gateway <NUM>. In sub-step S537, the gateway <NUM> publishes the message to the broker <NUM> "Pub "onConnect" message". In sub-step S538, the broker <NUM> forwards the "onConnect" message to the consumer A <NUM> "Forward"onConnect"message".

The request/response step S54 includes sub-steps S541 to S547. In sub-step S541, the consumer A <NUM> subscribes to an "onGet" message from the broker <NUM> "Sub"onGet"message". In sub-step S542, the consumer A <NUM> publishes a "Get" message to the broker <NUM> "Pub"Get"message". In sub-step S543, the broker <NUM> forwards the "Get" message to the gateway <NUM> "Forward"Get"message". In sub-step S544, the client sends an obtaining request message "Interface1 Get()" for the service "Interface1" to Provider1 <NUM>. In sub-step S545, Provider1 <NUM> sends a response message "Interface1 onGet()" to the gateway <NUM>. In sub-step S546, the gateway <NUM> publishes the message to the broker <NUM> "Pub"onGet"message". In sub-step S547, the broker <NUM> forwards the "onGet" message to the consumer A "Forward"onGet"message".

Finally, the disconnection step S55 includes sub-steps S551 to S554. In sub-step S551, the consumer A <NUM> publishes a "Disconnect" message to the broker <NUM> "Pub"disconnect"message". In sub-step S552, the broker <NUM> forwards the "Disconnect" message to the gateway <NUM> "Forward"Disconnect"message". In sub-step S553, the gateway <NUM> deletes the created client, and in sub-step S554, sends the "Interface1 Disconnect()" message to Provider1 <NUM>.

In the above process, since the topic of the message received by the gateway from the pub-sub system includes the name of the host in the server-client system that provides the service, the name of the service provider, and the name of the service, the gateway may send the request message for the target service to the corresponding service provider, and for the response message returned from the server, the gateway may identify the target consumer of the response message in the response message based on the information of the consumer sending the message that is included in the payload of the received message.

The specific example of performing communication between the server-client system and the pub-sub system is described in detail above with reference to <FIG>. Those skilled in the art may understand that the method according to the present disclosure is not limited to the steps shown in the example.

For example, those skilled in the art may understand that after a connection is established, the connection may be maintained, such that multiple communications may be performed between the consumer and the server, or the connection may be established before each communication and then disconnected after the communication.

As described above, the method for implementing communication conversion between a server-client system and a pub-sub system, the gateway device, and the network system according to the embodiments of the present disclosure are described with reference to <FIG>. The gateway device as described above may be implemented by hardware, or may be implemented by software or a combination of hardware and software.

<FIG> is a block diagram of a gateway device <NUM> of a method for implementing communication conversion between a server-client system and a pub-sub system according to an embodiment of the present disclosure. According to an embodiment, the gateway device <NUM> may include at least one processor <NUM>, and the processor <NUM> executes at least one computer-readable instruction (i.e., the above element implemented in the form of software) stored or encoded in a computer-readable storage medium (i.e., a memory <NUM>).

In an embodiment, computer executable instructions are stored in the memory <NUM>, and when executed, cause at least one processor <NUM> to implement the method for implementing communication conversion between a server-client system and a pub-sub system described above with reference to <FIG>.

It should be understood that the computer executable instructions stored in the memory <NUM>, when executed, cause the at least one processor <NUM> to perform various operations and functions described above in conjunction with <FIG> in the embodiments of the present disclosure.

According to an embodiment, a non-transitory machine-readable medium is provided. The non-transitory machine-readable medium may include machine executable instructions (i.e., the above elements implemented in the form of software) that, when executed by a machine, cause the machine to perform various operations and functions described above in conjunction with <FIG> in the embodiments of the present disclosure. According to an embodiment, a computer program is provided, which includes computer executable instructions that, when executed, cause at least one processor to perform various operations and functions described above in conjunction with <FIG> in the embodiments of the present disclosure.

According to an embodiment, a computer program product is provided, which includes computer executable instructions that, when executed, cause at least one processor to perform various operations and functions described above in conjunction with <FIG> in the embodiments of the present disclosure.

In the method and gateway device according to the present disclosure, roles in the network system and the topic and payload of the sent message are redefined, so that the communication between the server-client system and the pub-sub system may be supported.

In the method and gateway device according to the present disclosure, services that the server can provide may be automatically scanned and broadcast without manual configuration for each data point.

In the method and gateway device according to the present disclosure, pub/sub clients may be created dynamically and automatically.

According to the method for implementing communication between a server-client system and a pub-sub system of the present disclosure, a fusion method for IT and OT systems is provided, and the method according to the present disclosure is a low-code method, which reduces a development burden of technical personnel, and improves industrial communication efficiency.

Using the method according to the present disclosure may expand an application scenario of products, and improve competitiveness of the products.

Exemplary embodiments are described above in combination with the specific embodiments described in the accompanying drawings, but do not represent all the embodiments that can be implemented or fall within the protection scope of the invention as defined by the appended claims. The term "exemplary" used throughout the present specification means "used as an example, an instance or an illustration", but does not mean "preferred" or "advantageous" over the other embodiments. For the purpose of providing an understanding of the described technologies, the specific embodiments include specific details. However, the technologies can be implemented without the specific details. In some embodiments, in order to avoid obscuring the described concepts in the embodiments, commonly known structures and apparatuses are shown in the form of a block diagram.

Claim 1:
A method (<NUM>) for implementing communication conversion between a server-client system (<NUM>) and a publish-subscribe (pub-sub) system through a gateway device (<NUM>, <NUM>), comprising:
receiving, by a pub-sub system message receiving unit of the gateway device (<NUM>, <NUM>), a message from the pub-sub system (<NUM>, <NUM>), a topic of the message comprising information related to a target service in the server-client system (<NUM>) to which the message is to be sent wherein the topic of the message comprises names of a host and a service provider (<NUM>) on the host that provide the target service and a name of the target service, and a payload of the message comprising identification information of a consumer in the pub-sub system (<NUM>, <NUM>), wherein the consumer is to receive a response message from the server-client system (<NUM>);
parsing, by a parsing unit (<NUM>) of the gateway device (<NUM>, <NUM>), the message, and determining the host and the service provider (<NUM>) on the host that provide the target service, and the consumer who is to receive the response message;
sending, by a request message sending unit (<NUM>) of the gateway device (<NUM>, <NUM>), a request message for the target service to the service provider (<NUM>) on the determined host;
receiving, by a response message receiving unit (<NUM>) of the gateway device (<NUM>, <NUM>), the response message from the service provider (<NUM>); and
adding, by a server-client system message sending unit of the gateway device (<NUM>, <NUM>), the identification information of the consumer to the response message, and sending the response message to the pub-sub system (<NUM>, <NUM>).