Broker device, redundant broker coordinating device, publish-subscribe system and communication method

JP7643885B2Active Publication Date: 2025-03-11AZBIL CORP
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
JP2021025130
Authority / Receiving Office
JP · JP
Patent Type
Patents
Current Assignee / Owner
Filing Date
2021-02-19
Publication Date
2025-03-11
Estimated Expiration
2041-02-19

AI Technical Summary

Benefits of technology

【0016】 本発明によれば、ブローカ装置の各々にプライマリ·セカンダリ設定部とメッセージ処理部とを設けることにより、ブローカ装置の機能を冗長化して、ブローカ装置の処理の可用性を高めることができる。本発明では、複数のブローカ装置のうちの1つが停止したとしても、残りのブローカ装置で処理を継続することができる。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 0007643885000001
    Figure 0007643885000001
  • Figure 0007643885000002
    Figure 0007643885000002
  • Figure 0007643885000003
    Figure 0007643885000003
Patent Text Reader

Abstract

To increase availability of processing a broker device.SOLUTION: Broker devices 3-1, 3-2 include: a primary secondary setting unit for determining whether an owned vehicle is a primary broker device or a secondary broker device according to a set rule; and a message processing unit for processing messages that a publish-side client devices 1-1 to 1-3 or subscription-side client devices 2-1 to 2-3 received, and sending messages to client devices 2-1 to 2-3 only when the primary secondary setting unit determined that the owned device is primary.SELECTED DRAWING: Figure 1
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

[0001] The present invention relates to a broker device, a redundant broker coordinating device, a publish-subscribe system, and a communication method that are applied to a publish-subscribe system or the like. [Background technology]

[0002] In the publish-subscribe model, client devices on the publishing and subscribing sides each connect to a broker device, and when the publishing side sends a message and topic information related to that message to the broker device, the message is then sent to client devices that have previously requested the broker device to receive messages for that topic information.

[0003] As a means for applying availability to communication means based on a publish-subscribe model, there are techniques disclosed in Patent Documents 1 and 2. Patent Document 1 discloses a configuration in which a plurality of broker devices are connected between a publishing client device and a subscribing client device, providing a redundant configuration for the connection path.

[0004] Patent Document 2 discloses a configuration in which a plurality of broker devices are linked together to provide redundancy to messages that are the subject of publishing and subscribing, and the messages are held by the plurality of broker devices.

[0005] However, neither of the configurations disclosed in Patent Document 1 and Patent Document 2 has the effect of making the functions of the broker device itself to which the client device is connected redundant and increasing the availability of the broker device's processing. In other words, the configurations disclosed in Patent Document 1 and Patent Document 2 have a problem that, since there is only one broker device connected to the client device, if the broker device stops, the client device connected to the broker device cannot perform processing. [Prior art documents] [Patent documents]

[0006] [Patent Document 1] JP 2007-287148 A [Patent Document 2] JP 2020-017118 A Summary of the Invention [Problem to be solved by the invention]

[0007] The present invention has been made to solve the above-mentioned problems, and aims to provide a broker device, a redundant broker coordinating device, a publish-subscribe system, and a communication method that can increase the availability of the broker device's processing. [Means for solving the problem]

[0008] The present invention relates to a broker device that distributes a message from a first client device to a second client device, the broker device comprising: a primary / secondary setting unit configured to determine whether the broker device itself is a primary broker device or a secondary broker device according to a prescribed rule; and a message processing unit configured to process a message received from the first client device or the second client device, and to transmit a message addressed to the second client device only when the primary / secondary setting unit has determined that the broker device itself is a primary broker device. a history information management unit configured to record processing history information of a message received from the first client device or the second client device in an external database; The present invention is characterized by comprising: In addition, in one configuration example of the broker device of the present invention, the primary / secondary setting unit communicates with other broker devices when the broker device is started up and at specified communication timing, and if communication with other broker devices is not possible, it sets its own device as the primary broker device, and if communication with other broker devices is possible, it sets its own device as the primary broker device or secondary broker device in accordance with specified rules. In addition, in one configuration example of the broker device of the present invention, the specified communication timing is either a communication timing at a fixed period or a time when a message is received from the first client device or the second client device.

[0009] Furthermore, one configuration example of the broker device of the present invention is characterized in that it further includes a history information management unit configured to record processing history information of messages received from the first client device or the second client device. Also In one configuration example of the broker device of the present invention, the message processing unit is characterized in that when the device itself is a secondary broker device, and as a result of checking the processing history information, if there is a message that has been processed by the primary broker device but has not been processed by the device itself, the message processing unit processes the unprocessed message.

[0010] The present invention also relates to a redundant broker coordinating device connected to a plurality of broker devices in a redundant configuration that distributes messages from a first client device to a second client device, the redundant broker coordinating device comprising: a first relay control unit configured to transmit a message from the first client device or the second client device to all of the plurality of broker devices; and a second relay control unit configured to transmit a message received from at least one of the plurality of broker devices to the first client device or the second client device that is the destination of the message, wherein the second relay control unit transmits one of a plurality of identical messages received from the plurality of broker devices to the first client device or the second client device that is the destination of the message, and discards the remaining messages that are the same as the message to be transmitted.

[0011] A publish-subscribe system of the present invention includes a first client device on a publishing side, a second client device on a subscribing side, a plurality of broker devices in a redundant configuration that distributes messages from the first client device to the second client device, a first redundant broker coordinating device provided between the first client device and the plurality of broker devices, and a second redundant broker coordinating device provided between the second client device and the plurality of broker devices, each of the broker devices including a primary / secondary setting unit configured to determine whether the own broker device is a primary broker device or a secondary broker device according to a prescribed rule, and a message processing unit configured to process a message received from the first client device or the second client device, and to transmit a message addressed to the second client device to the second redundant broker coordinating device only when the own broker device is determined to be a primary broker device by the primary / secondary setting unit. The first redundant broker coordinating device comprises a first relay control unit configured to send a message from the first client device to all of the multiple broker devices, and a second relay control unit configured to send a message received from at least one of the multiple broker devices to the first client device that is the destination of the message, and the second redundant broker coordinating device comprises a third relay control unit configured to send a message from the second client device to all of the multiple broker devices, and a fourth relay control unit configured to send a message received from at least one of the multiple broker devices to the second client device that is the destination of the message, and the second and fourth relay control units send one of the multiple identical messages received from the multiple broker devices to the first client device or the second client device that is the destination of the message, and discard the remaining messages that are the same as the message to be sent.

[0012] In addition, in one configuration example of the publish-subscribe system of the present invention, the primary / secondary setting unit of each broker device communicates with other broker devices when the device is started up and at specified communication timing, and if communication with the other broker devices is not possible, sets the device itself as the primary broker device, and if communication with the other broker devices is possible, sets the device itself as the primary broker device or secondary broker device in accordance with specified rules. In addition, in one configuration example of the publish-subscribe system of the present invention, the specified communication timing is either a communication timing at a fixed interval or a communication timing when a message is received from the first client device or the second client device.

[0013] In addition, in one configuration example of the publish-subscribe system of the present invention, each broker device is characterized in that it further includes a history information management unit configured to record processing history information of a message received from the first client device or the second client device. Furthermore, in one configuration example of the publish-subscribe system of the present invention, the history information management unit of each broker device is characterized in that when the device itself is a primary broker device, it transmits the processing history information managed by the device to a secondary broker device. In one configuration example of the publish-subscribe system of the present invention, the history information management unit of each broker device is characterized in that it records the processing history information in an external database. Furthermore, in one configuration example of the publish-subscribe system of the present invention, the message processing unit of each broker device is characterized in that when the device itself is a secondary broker device, and as a result of checking the processing history information, if there is a message that has been processed by the primary broker device but has not been processed by the own device, the message processing unit processes the unprocessed message.

[0014] The communication method of the present invention includes a first step of determining whether a broker device that delivers a message from a first client device to a second client device is a primary broker device or a secondary broker device according to a specified rule, a second step of the broker device processing a message received from the first client device or the second client device, and a third step of the broker device transmitting a message addressed to the second client device only when the broker device determines in the first step that it is the primary broker device. a fourth step in which the broker device records processing history information of the message received from the first client device or the second client device in an external database; The present invention is characterized in that it comprises:

[0015] In addition, the communication method of the present invention includes a first step in which a redundant broker coordinating device connected to a plurality of broker devices in a redundant configuration that distributes messages from a first client device to a second client device transmits a message from the first client device or the second client device to all of the plurality of broker devices, and a second step in which the redundant broker coordinating device transmits a message received from at least one of the plurality of broker devices to the first client device or the second client device that is the destination of the message, wherein the second step is characterized by including a step of transmitting one of a plurality of identical messages received from the plurality of broker devices to the first client device or the second client device that is the destination of the message, and discarding remaining messages that are the same as the message to be transmitted. Effect of the Invention

[0016] According to the present invention, by providing each broker device with a primary / secondary setting unit and a message processing unit, the functions of the broker device are made redundant, and the availability of the processing of the broker device can be increased. In the present invention, even if one of multiple broker devices stops, the remaining broker devices can continue processing.

[0017] In addition, in the present invention, by providing a redundant broker coordinating device between the first and second client devices and multiple broker devices in a redundant configuration, and providing first and second relay control units in the redundant broker coordinating device, the redundant configuration of the broker devices can be concealed from the first and second client devices, and the broker devices can be made redundant without changing the configuration of the first and second client devices. [Brief description of the drawings]

[0018] [Figure 1] FIG. 1 is a block diagram showing the configuration of a publish-subscribe system according to a first embodiment of the present invention. [Diagram 2] FIG. 2 is a block diagram showing a configuration of a publishing client device according to the first embodiment of the present invention. [Diagram 3] FIG. 3 is a block diagram showing a configuration of a subscribing client device according to the first embodiment of the present invention. [Figure 4] FIG. 4 is a block diagram showing a configuration of a broker device according to the first embodiment of the present invention. [Diagram 5] FIG. 5 is a block diagram showing the configuration of a publishing-side redundant broker coordinator according to the first embodiment of the present invention. [Figure 6] FIG. 6 is a block diagram showing a configuration of a redundant broker coordinating device on the subscribing side according to the first embodiment of the present invention. [Figure 7] FIG. 7 is a flowchart illustrating the operation at the time of starting up the broker device according to the first embodiment of the present invention. [Figure 8] FIG. 8 is a flowchart illustrating the operation of the publishing-side redundant broker coordinator according to the first embodiment of the present invention. [Figure 9] FIG. 9 is a flowchart illustrating the operation of the broker device according to the first embodiment of the present invention. [Figure 10] FIG. 10 is a flowchart illustrating the operation of the broker device according to the first embodiment of the present invention. [Figure 11]FIG. 11 is a diagram showing an example of processing history information stored in the history information management unit of the broker device according to the first embodiment of the present invention. [Figure 12] FIG. 12 is a flowchart illustrating the operation of the subscribing side redundant broker coordinator according to the first embodiment of the present invention. [Figure 13] FIG. 13 is a block diagram showing the configuration of a publish-subscribe system according to the second embodiment of the present invention. [Figure 14] FIG. 14 is a block diagram showing a configuration of a broker device according to the second embodiment of the present invention. [Figure 15] FIG. 15 is a flowchart illustrating the operation of the broker device according to the second embodiment of the present invention. [Figure 16] FIG. 16 is a flowchart illustrating the operation of the broker device according to the second embodiment of the present invention. [Figure 17] FIG. 17 is a block diagram showing an example of the configuration of a computer that realizes the publish-subscribe system according to the first to third embodiments of the present invention. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0019] [Principle of the invention] In the present invention, a group of multiple broker devices forming a redundant pair or cluster configuration is prepared, and a redundant broker coordinating device is provided between the client device and the group of broker devices to conceal the redundant configuration of the broker devices from the client device, and the broker device with which the client device actually sends and receives data is configured redundantly.

[0020] [First Example] Hereinafter, embodiments of the present invention will be described with reference to the drawings. Fig. 1 is a block diagram showing the configuration of a publish-subscribe system according to a first embodiment of the present invention. The publish-subscribe system is composed of client devices 1-1 to 1-3 on the publishing side, client devices 2-1 to 2-3 on the subscribing side, broker devices 3-1 and 3-2 which are relay devices that distribute messages from the client devices 1-1 to 1-3 to the client devices 2-1 to 2-3, a redundant broker coordinating device 4 provided between the client devices 1-1 to 1-3 and the broker devices 3-1 and 3-2, and a redundant broker coordinating device 5 provided between the client devices 2-1 to 2-3 and the broker devices 3-1 and 3-2.

[0021] In this embodiment, a plurality of client devices 1-1 to 1-3 (three in this embodiment) are connected to the redundant broker coordinating device 4, but the number of client devices on the publishing side may be one. Similarly, in this embodiment, a plurality of client devices 2-1 to 2-3 (three in this embodiment) are connected to the redundant broker coordinating device 5, but the number of client devices on the subscribing side may be one.

[0022] 2 is a block diagram showing the configuration of client device 1-1 on the publishing side. Client device 1-1 has a communication unit 10 that communicates with redundant broker coordinating device 4, and a message providing unit 11 that instructs communication unit 10 to send a message to broker devices 3-1 and 3-2, to which topic information specifying the registration topic is added. Client devices 1-2 and 1-3 have the same configuration as client device 1-1.

[0023] 3 is a block diagram showing the configuration of a subscribing client device 2-1. The client device 2-1 includes a communication unit 20 that communicates with the redundant broker coordinating device 5, a registration request unit 21 that instructs the communication unit 20 to make a registration request for a topic to be distributed to the broker devices 3-1 and 3-2, and a message receiving unit 22 that receives distributed messages via the communication unit 20. The configurations of the client devices 2-2 and 2-3 are the same as that of the client device 1-1.

[0024] 4 is a block diagram showing the configuration of the broker device 3-1. The broker device 3-1 includes a communication unit 30 that communicates with the redundant broker coordinating device 4 on the publishing side, a communication unit 31 that communicates with the redundant broker coordinating device 5 on the subscribing side, a message storage unit 32 that stores messages to which topic information is added, received from the client devices 1-1 to 1-3 on the publishing side, for each topic, a registration information storage unit 33 that stores, for each client device, registration information that specifies the topic that the client devices 2-1 to 2-3 on the subscribing side wish to distribute, and a message relay unit 34 that instructs the communication unit 31 to transmit a message related to the topic to the client device based on the registration information.

[0025] Broker device 3-1 also includes a communication unit 35 for communicating with other broker devices 3-2, a primary / secondary setting unit 36 ​​for determining whether the device itself is a primary broker device or a secondary broker device according to prescribed rules, and a history information management unit 37 for recording processing history information of messages received from client devices 1-1 to 1-3 or client devices 2-1 to 2-3. The message storage unit 32, the registration information storage unit 33, and the message relay unit 34 constitute a message processing unit 39. The configuration of broker device 3-2 is the same as that of broker device 3-1.

[0026] 5 is a block diagram showing the configuration of the redundant broker coordinating device 4. The redundant broker coordinating device 4 includes a communication unit 40 that communicates with client devices 1-1 to 1-3, a communication unit 41 that communicates with broker devices 3-1 and 3-2, a relay control unit 42 that relays communications from client devices 1-1 to 1-3 to broker devices 3-1 and 3-2, and a relay control unit 43 that relays communications from broker devices 3-1 and 3-2 to client devices 1-1 to 1-3.

[0027] 6 is a block diagram showing the configuration of the redundant broker coordinating device 5. The redundant broker coordinating device 5 includes a communication unit 50 that communicates with client devices 2-1 to 2-3, a communication unit 51 that communicates with broker devices 3-1 and 3-2, a relay control unit 52 that relays communications from the broker devices 3-1 and 3-2 to the client devices 2-1 to 2-3, and a relay control unit 53 that relays communications from the client devices 2-1 to 2-3 to the broker devices 3-1 and 3-2.

[0028] Next, the operation of the publish-subscribe system of this embodiment will be described with reference to the flowchart of FIG. When the broker device 3-1 is started up, the primary / secondary setting unit 36 ​​of the broker device 3-1 attempts to communicate with another broker device 3-2 arranged for redundant configuration via the communication unit 35 (Step S100 in FIG. 7).

[0029] If communication with the other broker apparatus 3-2 is not established (YES in step S101 in FIG. 7), the primary / secondary setting unit 36 ​​of the broker apparatus 3-1 sets the own apparatus as the primary broker apparatus (step S102 in FIG. 7).

[0030] Furthermore, if the primary / secondary setting unit 36 ​​of the broker device 3-1 can communicate with the other broker device 3-2 (NO in step S101), it designates the own device as either a primary broker device or a secondary broker device (step S103 in FIG. 7).

[0031] Similarly, when the broker device 3-2 starts up, the primary / secondary setting unit 36 ​​of the broker device 3-2 attempts to communicate with the other broker device 3-1 via the communication unit 35 (step S100). If communication with the other broker device 3-1 is not possible (YES in step S101), the primary / secondary setting unit 36 ​​of the broker device 3-2 sets its own device as the primary broker device (step S102).

[0032] Furthermore, if the primary / secondary setting unit 36 ​​of the broker device 3-2 can communicate with the other broker device 3-1 (NO in step S101), it sets the own device as either a primary broker device or a secondary broker device (step S103).

[0033] When the primary / secondary setting unit 36 ​​of each broker device 3-1, 3-2 is able to communicate with another broker device, it sets the device as either the primary broker device or the secondary broker device according to some predefined rule. For example, when communication is possible between the broker devices 3-1, 3-2, a rule may be predefined such that the broker device 3-1 is the primary and the broker device 3-2 is the secondary.

[0034] As is clear from the above explanation, in this embodiment, if communication between the broker apparatuses 3-1 and 3-2 is interrupted at the time of startup, both the broker apparatuses 3-1 and 3-2 may become primary apparatuses.

[0035] Next, the normal operation after the broker devices 3-1 and 3-2 are started will be described. Messages sent from the publishing client devices 1-1 to 1-3 include connection request messages to the broker devices 3-1 and 3-2, disconnection request messages to the broker devices 3-1 and 3-2, and publication messages to which topic information specifying the topic to which the message is to be registered is added.

[0036] Messages sent from subscribing client devices 2-1 to 2-3 include connection request messages to broker devices 3-1 and 3-2, disconnection request messages to broker devices 3-1 and 3-2, registration request messages for topics to be delivered, and unregistration request messages for topics to which delivery will cease.

[0037] In this embodiment, as a typical example of message transmission and reception, a case will be described in which publication messages are transmitted from client devices 1-1 to 1-3 on the publishing side and registration request messages are transmitted from client devices 2-1 to 2-3 on the subscribing side.

[0038] The message provider 11 of the publishing client devices 1-1 to 1-3 instructs the communication unit 10 to send a publication message to the broker device, to which topic information specifying the registration topic is added. In response to the instruction from the message provider 11, the communication unit 10 of the client devices 1-1 to 1-3 sends the publication message to which the topic information is added to the redundant broker coordinating device 4.

[0039] 8 is a flowchart explaining the operation of the publishing-side redundant broker coordinating device 4. The communication unit 41 of the redundant broker coordinating device 4 establishes a connection in advance with both of the broker devices 3-1 and 3-2 in the redundant configuration. If the communication unit 41 can connect to only one of the broker devices 3-1 and 3-2, it periodically attempts to connect to the other broker device that it cannot connect to.

[0040] The communication unit 40 of the redundant broker coordinating device 4 receives the published messages from the client devices 1-1 to 1-3 (step S200 in FIG. 8).

[0041] When the relay control unit 42 of the redundant broker coordinating device 4 receives a publication message from the client devices 1-1 to 1-3, it instructs the communication unit 41 to transmit the received publication message to all broker devices 3-1 and 3-2 in the redundant configuration. At this time, the relay control unit 42 adds a message identifier to the message to be transmitted. In response to the instruction from the relay control unit 42, the communication unit 41 transmits the publication message to the broker devices 3-1 and 3-2 (FIG. 8 step S201).

[0042] 9 and 10 are flow charts for explaining the operation of the broker devices 3-1 and 3-2. The communication units 30 of the broker devices 3-1 and 3-2 receive the message transmitted from the redundant broker coordinator device 4 (step S300 in FIG. 9).

[0043] The message storage units 32 of the broker devices 3-1 and 3-2 store the published messages received from the redundant broker coordinator device 4 for each topic specified in the topic information added to the published messages (FIG. 9, step S301).

[0044] The history information management unit 37 of the broker devices 3-1 and 3-2 stores the processing history information of the message received from the client device on the publishing side or the subscribing side (step S302 in FIG. 9). When a published message is received as in step S301, the processing history information of the published message is stored.

[0045] Fig. 11 is a diagram showing an example of processing history information stored in history information management unit 37. The processing history information is composed of, for example, information on the type of message, and parameters such as the contents of the message, the identifier of the client device that sent the message, and the identifier of the broker device that processed the message. Note that the "Overview" in Fig. 11 is provided to explain the type of message and is not essential as processing history information.

[0046] When the broker devices 3-1 and 3-2 are the primary broker devices (step S303 in FIG. 9: YES), the history information management units 37 instruct the communication units 35 to transmit the stored processing history information to the secondary broker device. The communication units 35 of the primary broker device transmit the processing history information to the secondary broker device in response to the instruction from the history information management units 37 (step S304 in FIG. 9).

[0047] On the other hand, the registration request unit 21 of the subscribing client devices 2-1 to 2-3 instructs the communication unit 20 to send a registration request message for a topic desired to be distributed to the broker device, for example, in response to a request from the user of the client devices 2-1 to 2-3. In response to the instruction from the registration request unit 21, the communication unit 20 of the client devices 2-1 to 2-3 sends the registration request message to the redundant broker coordinating device 5.

[0048] 12 is a flowchart explaining the operation of the subscribing-side redundant broker coordinating device 5. The communication unit 51 of the redundant broker coordinating device 5 establishes a connection with both the broker devices 3-1 and 3-2 in advance. If the communication unit 51 can connect to only one of the broker devices 3-1 and 3-2, it periodically attempts to connect to the other broker device that it cannot connect to.

[0049] The communication unit 50 of the redundant broker coordinating device 5 receives the registration request messages from the client devices 2-1 to 2-3 (Step S400 in FIG. 12).

[0050] When the relay control unit 53 of the redundant broker coordinating device 5 receives a registration request message from the client devices 2-1 to 2-3, it instructs the communication unit 51 to transmit the received registration request message to all broker devices 3-1 and 3-2 in the redundant configuration. At this time, the relay control unit 53 adds a message identifier to the message to be transmitted. In response to the instruction from the relay control unit 53, the communication unit 51 transmits the registration request message to the broker devices 3-1 and 3-2 (FIG. 12, step S401).

[0051] The communication units 31 of the broker devices 3-1 and 3-2 receive the message sent from the redundant broker coordinator device 5 (Step S305 in FIG. 9).

[0052] When the message received from the redundant broker coordinating device 5 is a registration request message, the registration information storage unit 33 of the broker devices 3-1 and 3-2 stores the registration information indicating the topic specified in the registration request message together with the client identifier of the sender of the registration request message (Figure 9, step S306).

[0053] The processing in steps S307 to S309 in Fig. 9 is the same as the processing in steps S302 to S304. Here, processing history information of the registration request message is stored.

[0054] If registration information specifying a topic is stored in the registration information storage unit 33 (YES in step S310 in FIG. 9) and the broker device 3-1, 3-2 is the primary broker device (YES in step S311 in FIG. 9), the message relay unit 34 of the broker device 3-1, 3-2 retrieves a message related to the topic specified in the registration information from the message storage unit 32 and instructs the communication unit 31 to transmit the message to the client device having the client identifier included in the registration information. The communication unit 31 transmits the message received from the message relay unit 34 to the redundant broker coordinating device 5 (step S312 in FIG. 9).

[0055] The communication unit 51 of the redundant broker coordinator device 5 receives a message transmitted from at least one of the broker devices 3-1 and 3-2 (Step S402 in FIG. 12).

[0056] The relay control unit 52 of the redundant broker coordinating device 5 instructs the communication unit 50 to transmit the message received from at least one of the broker devices 3-1 and 3-2 to the client devices 2-1 to 2-3 that are the destinations of the message. The communication unit 50 transmits the message to the client device instructed by the relay control unit 52 among the client devices 2-1 to 2-3 (FIG. 12, step S403).

[0057] When the primary / secondary setting units 36 of both the broker devices 3-1 and 3-2 determine that the respective devices are primary, messages intended for a subscriber may be received from a plurality of the broker devices 3-1 and 3-2.

[0058] When the relay control unit 52 of the redundant broker coordinating device 5 receives the same message from multiple broker devices 3-1, 3-2, it instructs the communication unit 50 to transmit one of the identical messages (for example, the first message received) to the client devices 2-1 to 2-3 that are the destinations of this message, and discards the remaining messages that are the same as the message to be transmitted. The identity of the messages is determined based on the message identifier added to the message.

[0059] When the communication unit 20 of the client devices 2-1 to 2-3 receives a message transmitted from the redundant broker coordinating device 5, the communication unit 20 passes the received message to the message receiving unit 22.

[0060] Next, the communication unit 35 of the secondary broker device receives the processing history information transmitted from the primary broker device (steps S313 and S314 in FIG. 10).

[0061] The history information management unit 37 of the secondary broker device integrates the processing history information it stores with the processing history information received from the primary broker device to synchronize the processing history information (FIG. 10, step S315). Specifically, when identical processing history information exists between the processing history information it stores and the processing history information it receives, the history information management unit 37 of the secondary broker device determines that both its own device and the primary broker device have already processed the information, and deletes the processing history information that it has determined to have already processed from the processing history information it stores. Here, identical processing history information refers to processing history information that differs only in the broker identifier and is otherwise identical.

[0062] If the processing history information managed by the history information management unit 37 of the secondary broker device contains a published message that has been processed by the primary broker device but has not been processed by the secondary broker device, and that the secondary broker device can currently process (YES in step S316 in Figure 10), the message storage unit 32 of the secondary broker device stores the unprocessed published message for each topic specified in the topic information, as in step S301 (step S317 in Figure 10).

[0063] Similarly, if the registration information storage unit 33 of the secondary broker device finds a registration request message that has been processed by the primary broker device but has not been processed by the secondary broker device and that the secondary broker device can currently process (YES in step S316 in Figure 10), the registration information storage unit 33 stores registration information indicating the topic specified in the unprocessed registration request message together with the client identifier of the sender of the registration request message, as in step S306 (step S317 in Figure 10).

[0064] The history information management unit 37 of the secondary broker device stores the processing history information of the message processed by the message storage unit 32 or the registration information storage unit 33 (step S318 in FIG. 10). Then, the history information management unit 37 of the secondary broker device performs the process of step S315 again.

[0065] Furthermore, if there is any processing history information that has been determined to have been processed and deleted, the history information management unit 37 of the secondary broker device instructs the communication unit 35 to send an ACK message including the deleted processing history information to the primary broker device. In response to the instruction from the history information management unit 37, the communication unit 35 of the secondary broker device sends the ACK message to the primary broker device (Step S319 in FIG. 10).

[0066] The communication unit 35 of the primary broker device receives the ACK message transmitted from the secondary broker device (Step S320 in FIG. 10).

[0067] The history information management unit 37 of the primary broker device compares the processing history information stored therein with the ACK message received from the secondary broker device, and synchronizes the processing history information (FIG. 10, step S321). Specifically, when the processing history information stored therein and the processing history information included in the ACK message contain identical processing history information, the history information management unit 37 of the primary broker device determines that both its own device and the secondary broker device have completed processing, and deletes the processing history information determined to have completed processing from the processing history information stored therein.

[0068] In this manner, the processing history information can be synchronized between the primary and secondary broker devices.

[0069] As described above, the primary / secondary determination of the broker devices 3-1 and 3-2 is performed at startup, but is also performed appropriately during normal operation after startup. Specifically, the primary / secondary setting unit 36 ​​of the broker devices 3-1 and 3-2 attempts to communicate with other broker devices via the communication unit 35 (step S323 in FIG. 10) at a predetermined communication timing (step S322 in FIG. 10). The processes in steps S324 to S326 in FIG. 10 are the same as those in steps S101 to S103.

[0070] The communication timing of step S322 includes a communication timing at a fixed interval, and when a publish or subscribe message is received from the redundant broker coordinating device 4, 5 as in steps S300 and S305 above. The communication message between the broker devices 3-1 and 3-2 includes information on whether the device is primary or secondary.

[0071] As in the case of startup described above, if communication between the broker devices 3-1 and 3-2 is interrupted, both the broker devices 3-1 and 3-2 can become primary. When communication is restored, one of the broker devices 3-1 and 3-2 becomes secondary according to some predefined rule.

[0072] In this way, in this embodiment, the functions of the broker devices are made redundant, and the availability of the processing of the broker devices can be increased. In this embodiment, even if one of the multiple broker devices stops, the remaining broker devices can continue processing.

[0073] In this embodiment, as an example of the process of sending a message from the broker side to the client side, the process of sending a message related to a topic from the broker devices 3-1, 3-2 to the client devices 2-1 to 2-3 is described as an example. However, it goes without saying that the process of sending a response message, which is the processing result for the message from the client devices 2-1 to 2-3, from the broker devices 3-1, 3-2 to the client devices 2-1 to 2-3 can also be realized in a similar manner to the process of sending a message related to a topic.

[0074] For example, when the registration information storage unit 33 of the broker devices 3-1 and 3-2 processes a registration request message, if the broker device itself is the primary broker device, it instructs the communication unit 31 to send a response message to the client devices 2-1 to 2-3 that sent the registration request message.

[0075] Furthermore, when the registration information storage units 33 of the broker devices 3-1 and 3-2 receive a deregistration request message from the client devices 2-1 to 2-3, they delete the registration information indicating the topic specified in the deregistration request message, as in step S306. The history information management units 37 of the broker devices 3-1 and 3-2 store processing history information of the message processed by the registration information storage unit 33, as in step S307. Then, the registration information storage unit 33 instructs the communication unit 31 to send a response message to the client devices 2-1 to 2-3 that sent the deregistration request message.

[0076] In addition, when the message storage unit 32 of the broker devices 3-1 and 3-2 processes the published message, if the device itself is the primary broker device, it instructs the communication unit 30 to send a response message to the client devices 1-1 to 1-3 that are the senders of the published message.

[0077] The communication unit 41 of the redundant broker coordinator device 4 receives the response message transmitted from at least one of the broker devices 3-1 and 3-2 (Step S202 in FIG. 8).

[0078] The relay control unit 43 of the redundant broker coordinating device 4 instructs the communication unit 40 to transmit the response message received from at least one of the broker devices 3-1 and 3-2 to the client devices 1-1 to 1-3 that are the destinations of the message. The communication unit 40 transmits the message to the client device instructed by the relay control unit 43 among the client devices 1-1 to 1-3 (FIG. 8 step S203).

[0079] When both the broker devices 3-1 and 3-2 determine themselves as the primary device, it is possible that a message for publishing may be received from a plurality of the broker devices 3-1 and 3-2.

[0080] When the relay control unit 43 of the redundant broker coordinating device 4 receives the same message from multiple broker devices 3-1, 3-2, it instructs the communication unit 40 to send one of the identical messages (for example, the first message received) to the client devices 1-1 to 1-3 that are the destinations of this message, and discards the remaining messages that are the same as the message to be sent. As above, the identity of the messages is determined based on the message identifier added to the message.

[0081] [Second Example] In the first embodiment, each of the broker devices 3-1 and 3-2 manages the processing history information individually, but the processing history information in a common external database may be managed by both the broker devices 3-1 and 3-2. Figure 13 is a block diagram showing the configuration of a publish-subscribe system according to this embodiment, and Figure 14 is a block diagram showing the configuration of a broker device according to this embodiment, where the same components as those in Figures 1 and 4 are given the same reference numerals.

[0082] The configurations of the client devices 1-1 to 1-3, 2-1 to 2-3 and the redundant broker coordinating devices 4 and 5 are as explained in the first embodiment.

[0083] Broker device 3a-1 of this embodiment includes communication units 30 and 31, a message storage unit 32, a registration information storage unit 33, a message relay unit 34, a communication unit 35, a primary / secondary setting unit 36, a history information management unit 37a, and a communication unit 38 for communicating with a database (DB) 6 on the cloud. The configuration of broker device 3a-2 is similar to that of broker device 3a-1.

[0084] 15 and 16 are flow charts for explaining the operation of the broker devices 3a-1 and 3a-2 of this embodiment. In this embodiment, when the history information management unit 37a of the broker devices 3a-1 and 3a-2 records the processing history information of a message received from a client device on the publishing side or subscribing side, the history information management unit 37a records the information in DB6 via the communication unit 38 instead of recording the information within the broker device itself (steps S302a and S307a in FIG. 15). The contents of the processing history information are the same as those in the first embodiment. Since the processing history information is recorded in DB6, the processes in steps S303, S304, S308, and S309 in the first embodiment are not necessary.

[0085] If the same processing history information exists in DB6 for its own device and all other broker devices, the history information management unit 37a of the secondary broker device determines that both its own device and all other broker devices have been processed, and deletes the processing history information determined to have been processed from DB6 via the communication unit 38 (steps S327, S328, S329, and S330 in FIG. 15). As above, the same processing history information is processing history information that differs only in the broker identifier and is otherwise identical.

[0086] In addition, if the history information management unit 37a of the secondary broker device checks the processing history information in DB6 and finds that the processing history information contains a published message that has been processed by the primary broker device but has not been processed by the secondary broker device, and that is currently processable by the secondary broker device (YES in steps S331 and S332 in Figure 16), the message storage unit 32 of the secondary broker device stores the unprocessed published message for each topic specified in the topic information, as in step S301 (step S333 in Figure 16).

[0087] Similarly, if the registration information storage unit 33 of the secondary broker device finds, as a result of the history information management unit 37a of its own device checking the processing history information in DB6, that the processing history information contains a registration request message that has been processed by the primary broker device but has not been processed by its own device, and that is currently processable by its own device (YES in steps S331 and S332 in Figure 16), the registration information storage unit 33 stores the registration information indicating the topic specified in the unprocessed registration request message together with the client identifier of the sender of the registration request message, as in step S306 (step S333 in Figure 16).

[0088] The history information management unit 37a of the secondary broker device records the processing history information of the message processed by the message accumulation unit 32 or the registration information storage unit 33 in DB6 via the communication unit 38 (step S334 in FIG. 16). Then, when the same processing history information exists in DB6 for its own device and all other broker devices, the history information management unit 37a of the secondary broker device determines that both its own device and all other broker devices have been processed, and deletes the processing history information determined to have been processed from DB6 via the communication unit 38 (step S335 in FIG. 16). The processes in steps S322 to S326 are as described in the first embodiment.

[0089] Thus, in this embodiment, the same effects as in the first embodiment can be obtained by using DB6 on the cloud. This embodiment is effective when the broker devices 3a-1 and 3a-2 operate on a cloud and the managed DB 6 exists within the cloud.

[0090] [Third Example] Next, a third embodiment of the present invention will be described. In the first and second embodiments, one of the broker devices 3-1, 3-2 (3a-1, 3a-2) in the redundant configuration is set as a primary device and the other is set as a secondary device, but all of the broker devices may be set as primary devices.

[0091] If all broker devices are primary, the processes of steps S303, S304, S308, and S309 in Figures 7 and 9, steps S313 to S326 in Figure 10, steps S327 to S330 in Figure 15, and steps S322 to S326 and S331 to S335 in Figure 16 will be unnecessary, resulting in less overall processing but a higher communication load.

[0092] In the first to third embodiments, two broker devices 3-1, 3-2 (3a-1, 3a-2) are arranged, but it goes without saying that the present invention can also be applied to a system in which three or more broker devices are arranged between the redundant broker coordinating device 4 and the redundant broker coordinating device 5. In the first and second embodiments, the three or more broker devices communicate with each other and make a primary / secondary decision.

[0093] Furthermore, in the first to third embodiments, a topic-based method has been described as an example of a method for filtering messages, but the present invention is not limited to this, and may be applied to systems using other filtering methods.

[0094] Each of the client devices 1-1 to 1-3, 2-1 to 2-3, broker devices 3-1, 3-2, 3a-1, 3a-2, redundant broker coordinating devices 4, 5, and DB 6 in this embodiment can be realized by a computer equipped with a CPU (Central Processing Unit), a storage device, and an interface with the outside, and a program that controls these hardware resources. An example of the configuration of this computer is shown in Figure 17. The computer is equipped with a CPU 300, a storage device 301, and an interface device (I / F) 302.

[0095] The hardware of communication units 10, 20, 30, 31, 35, 38, 40, 41, 50, and 51 are connected to the I / F 302. A program for implementing the communication method of the present invention is stored in the storage device 301. The CPU 300 of each device executes the processing described in this embodiment according to the program stored in the storage device 301. [Industrial Applicability]

[0096] The present invention can be applied to publish-subscribe systems. [Explanation of symbols]

[0097] 1-1 to 1-3, 2-1 to 2-3...client devices, 3-1, 3-2, 3a-1, 3a-2...broker devices, 4, 5...redundant broker coordinating device, 6...database, 10, 20, 30, 31, 35, 38, 40, 41, 50, 51...communication units, 11...message providing units, 21...registration request units, 22...message receiving units, 32...message storage units, 33...registration information storage units, 34...message relay units, 36...primary / secondary setting units, 37, 37a...history information management units, 39...message processing units, 42, 43, 52, 53...relay control units.

Claims

1. A broker device for delivering a message from a first client device to a second client device, a primary / secondary setting unit configured to determine whether the device is a primary broker device or a secondary broker device according to a prescribed rule; a message processing unit configured to process a message received from the first client device or the second client device, and to transmit a message addressed to the second client device only when the primary / secondary setting unit determines that the client device is the primary; a history information management unit configured to record processing history information of a message received from the first client device or the second client device in an external database.

2. 2. The broker device according to claim 1, The primary / secondary setting unit communicates with other broker devices when the broker device is started and at specified communication timing, and when communication with other broker devices is not possible, the device itself becomes the primary broker device, and when communication with other broker devices is possible, the device itself becomes the primary broker device or secondary broker device in accordance with specified rules.

3. 3. The broker device according to claim 2, The broker device is characterized in that the predetermined communication timing is either a communication timing at a fixed cycle or a time when a message is received from the first client device or the second client device.

4. 2. The broker device according to claim 1, The message processing unit is characterized in that, when the device itself is a secondary broker device, if, as a result of checking the processing history information, there is a message that has been processed by the primary broker device but has not been processed by the device itself, the message processing unit processes the unprocessed message.

5. A redundant broker coordinating device connected to a plurality of broker devices in a redundant configuration for distributing messages from a first client device to a second client device, a first relay control unit configured to transmit a message from the first client device or the second client device to all of the plurality of broker devices; a second relay control unit configured to transmit a message received from at least one of the plurality of broker devices to the first client device or the second client device that is the destination of the message; The second relay control unit transmits one of the multiple identical messages received from the multiple broker devices to the first client device or the second client device to which the message is addressed, and discards the remaining messages that are the same as the message to be transmitted.

6. a first client device on the publishing side; a subscribing second client device; a plurality of broker devices in a redundant configuration for distributing messages from the first client device to the second client device; a first redundant broker coordinating device disposed between the first client device and the plurality of broker devices; a second redundant broker coordinating device provided between the second client device and the plurality of broker devices; Each broker device: a primary / secondary setting unit configured to determine whether the device is a primary broker device or a secondary broker device according to a prescribed rule; a message processing unit configured to process a message received from the first client device or the second client device, and to transmit a message addressed to the second client device to the second redundant broker coordinating device only when the primary / secondary setting unit determines that the client device is the primary; The first redundant broker coordinating device, a first relay control unit configured to transmit a message from the first client device to all of the plurality of broker devices; a second relay control unit configured to transmit a message received from at least one of the plurality of broker devices to the first client device that is the destination of the message; The second redundant broker coordinating device: a third relay control unit configured to transmit a message from the second client device to all of the plurality of broker devices; a fourth relay control unit configured to transmit a message received from at least one of the plurality of broker devices to the second client device that is the destination of the message; A publish-subscribe system characterized in that the second and fourth relay control units send one of multiple identical messages received from the multiple broker devices to the first client device or the second client device to which the message is addressed, and discard the remaining messages that are the same as the message to be sent.

7. 7. The publish-subscribe system according to claim 6, A publish-subscribe system characterized in that the primary / secondary setting unit of each broker device communicates with other broker devices when the device is started and at specified communication timing, and when communication with other broker devices is not possible, the device itself becomes the primary broker device, and when communication with other broker devices is possible, the device itself becomes the primary broker device or secondary broker device in accordance with specified rules.

8. 8. The publish-subscribe system according to claim 7, A publish-subscribe system characterized in that the specified communication timing is either a communication timing at a fixed period or a time when a message is received from the first client device or the second client device.

9. A publish-subscribe system according to any one of claims 6 to 8, A publish-subscribe system, characterized in that each broker device further comprises a history information management unit configured to record processing history information of messages received from the first client device or the second client device.

10. 10. The publish-subscribe system of claim 9, A publish-subscribe system characterized in that the history information management unit of each broker device transmits the processing history information managed by the device to a secondary broker device when the device is a primary broker device.

11. 10. The publish-subscribe system of claim 9, A publish-subscribe system, wherein the history information management unit of each broker device records the processing history information in an external database.

12. A publish-subscribe system according to claim 10 or 11, A publish-subscribe system characterized in that, when the message processing unit of each broker device is a secondary broker device, if, as a result of checking the processing history information, there is a message that has been processed by the primary broker device but has not been processed by the own device, the message processing unit processes the unprocessed message.

13. A first step of determining whether a broker device that delivers a message from a first client device to a second client device is a primary broker device or a secondary broker device according to a specified rule; a second step of the broker device processing messages received from the first client device or the second client device; a third step of transmitting a message addressed to the second client device only when the broker device determines in the first step that the broker device is a primary device; and a fourth step in which the broker device records processing history information of the message received from the first client device or the second client device in an external database.

14. A first step in which a redundant broker coordinating device connected to a plurality of broker devices in a redundant configuration that distributes a message from a first client device to a second client device transmits a message from the first client device or the second client device to all of the plurality of broker devices; a second step of the redundant broker coordinating device transmitting a message received from at least one of the plurality of broker devices to the first client device or the second client device to which the message is addressed; The communication method, wherein the second step includes a step of sending one of the multiple identical messages received from the multiple broker devices to the first client device or the second client device to which the message is addressed, and discarding remaining messages that are the same as the message to be sent.

Citation Information

Patent Citations

  • Server multiplying system and server multiplying method

    JP2007257023A

  • Dynamic access control in content-based publish / subscribe system with delivery guarantee

    JP2007287148A

  • Broker device, client device, communication system, communication method, and program

    JP2020017118A

  • Sensor data segmentation and virtualization

    US20170163734A1

  • Fault-tolerant messaging system and methods

    US8191078B1