@startuml "messagebus"
' convert it with additional command line argument -DRELATIVE_INCLUDE="." to use locally
!if %variable_exists("RELATIVE_INCLUDE")
  !include ./../C4_Container.puml
!else
  !include https://ghproxy.com/https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml
!endif

skinparam wrapWidth 200
skinparam maxMessageSize 200

LAYOUT_TOP_DOWN()
'LAYOUT_AS_SKETCH()
LAYOUT_WITH_LEGEND()


Person(customer, Customer, "A customer")

System_Boundary(c1, "Customer Information") {

    Container(app, "Customer Application", "Javascript, Angular", "Allows customers to manage their profile")

    Container(customer_service, "Customer Service", "Java, Spring Boot", "The point of access for customer information")

    Container(message_bus, "Message Bus", "RabbitMQ", "Transport for business events")

    Container(reporting_service, "Reporting Service", "Ruby", "Creates normalised data for reporting purposes")

    Container(audit_service, "Audit Service", "C#/.NET", "Provides organisation-wide auditing facilities")

    ContainerDb(customer_db, "Customer Database", "Oracle 12c", "Stores customer information")

    ContainerDb(reporting_db, "Reporting Database", "MySQL", "Stores a normalized version of all business data for ad hoc reporting purposes")

    Container(audit_store, "Audit Store", "Event Store", "Stores information about events that have happened")
}

Rel(customer, app, "Uses", "HTTPS")

Rel_R(app, customer_service, "Updates customer information using", "async, JSON/HTTPS")

Rel_L(customer_service, app, "Sends events to", "WebSocket")
Rel_R(customer_service, message_bus, "Sends customer update events to")
Rel(customer_service, customer_db, "Stores data in", "JDBC")

Rel(message_bus, reporting_service, "Sends customer update events to")
Rel(message_bus, audit_service, "Sends customer update events to")

Rel(reporting_service, reporting_db, "Stores data in")
Rel(audit_service, audit_store, "Stores events in")

Lay_R(reporting_service, audit_service)

@enduml
