@startuml
 box  "Client" #LightGrey
    participant Browser
 end box

box "Interface Service" #white
       participant SSE_IS
end box

box "Kafka" #white
       participant Kafka
end box

box "Mosquitto" #white
       participant Mosquitto
end box

box "ACL" #white
       participant ACL
end box

box "SSE_Microservice" #LightGrey
       participant SSE
end box

box "Messages in Kafka Topic" #white
       participant Kafka_Topics
end box

box "Services" #white
       participant Services
end box

box "MQTT Broker" #white
       participant MQTT
end box

box "Video" #LightGrey
       participant Real_Video_Nodes
end box

 alt Scenario: Get All Events
        Browser -> SSE_IS: Get all events
        Activate Browser
        SSE_IS -> Kafka: ACL Request(ms.request.acl)
        Activate SSE_IS
        Activate Kafka
        Kafka -> ACL: Authentication
        Activate ACL
        ACL -> Kafka: ACL Response(api.reply.interface)
        Deactivate ACL
        Kafka -> SSE_IS: ACL Response
        SSE_IS -> Kafka: Publish request to SSEFilterTopic(ms.request.sse)
        Activate SSE
        Kafka -> SSE: SSE Persists to Cassandra
        SSE -> Kafka: Response from SSE(api.reply.interface)
        Kafka -> SSE_IS: Subscribe/heartbeat/disconnect successfully
        Deactivate Kafka
        SSE_IS -> Mosquitto: Client subscribes to events
        Activate Mosquitto


        Real_Video_Nodes -> MQTT :Send device events
        MQTT -> Services: Send the events to different microservices
        hnote over Services: Alert_Service
        Services -> Kafka_Topics: Send Alert events to alert topic
        hnote over Services: Bridge_Service
        Services -> Kafka_Topics: Send Login and Sensor events to login and sensor topic
        hnote over Services: Device_Service
        Services -> Kafka_Topics: Send Connection_status events connection_status topic
        Kafka_Topics -> SSE: Video node events
        SSE -> Mosquitto: Filtered Events
        Mosquitto -> SSE_IS: On New Message
        SSE_IS -> Browser: Write the response
 end



@enduml