1.2. Architecture

The API is designed in a way that the turret functions as a server and a client for different purposes. The server accepts requests for actions which it then tries to execute on the turret, while the client is responsible for sending out notifications about the changes induced either by the user or through the requests sent through the API.

frame Turret {
    [TurretClient] as tclient
    [TurretServer] as tserver
}

[ApplicationClient] as aclient
[ApplicationServer] as aserver

interface TurretRequestService as trs
interface TurretNotificationService as tns

tserver -down- trs
tclient -down-( tns

aserver -up- tns
aclient -up-( trs

1.2.1. Turret as Server

If the Thrift API is enabled for the client in the System Manager, the turret starts a Thrift Server and accepts connections and requests on port 9007. Thrift generates the required class which realizes the TurretApi.TurretRequestService interface to send the requests to the server.

See Logging in/out example

autoactivate on
hide footbox

participant AppClient as aclient

participant TurretServer as tserver
participant Turret as turret

turret -> tserver ** : create

aclient -> tserver : connect
tserver --> aclient

aclient -> tserver : action
opt action valid
    tserver -> turret : action
    turret --> : act
    tserver --> aclient
else action invalid
    tserver --> aclient : error
end

1.2.2. Turret as Client

You can request the turret for notifications of the different events that happen. For this you first have to connect to the turret, and TurretApi.TurretRequestService.requestNotifications supplying it with the address of your server. Your server will need to implement the TurretApi.TurretNotificationService interface.

See Monitoring example

participant AppClient as aclient
participant AppServer as aserver

participant TurretClient as tclient
participant Turret as turret
participant TurretServer as tserver

== Connecting ==

turret -> tserver ** : create

aclient -> tserver : connect
tserver --> aclient

aclient -> tserver : requestNotifications(serverInfo)
tserver --> aclient
tserver -> turret : notifications requested
turret -> tclient ** : create
tclient -> aserver : connect
aserver --> tclient
tclient --> turret
turret --> tserver

== Notification ==

turret <-- : action
turret -> tclient : notifyAction
loop each subscriber
    tclient -> aserver : notifyAction
    aserver --> tclient
    tclient --> turret
    aserver -> aserver : handleAction
end