mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-19 21:25:38 +00:00
* feat: Add Microservice Pattern, Log aggregation. Related: #2690 * docs: Add javaDoc for public methods. Related: #2690 --------- Co-authored-by: Ilkka Seppälä <iluwatar@users.noreply.github.com>
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 68 KiB |
@@ -0,0 +1,51 @@
|
||||
@startuml
|
||||
|
||||
package com.iluwatar.logaggregation {
|
||||
|
||||
class App {
|
||||
+ main(args: String[]) {static}
|
||||
}
|
||||
|
||||
class CentralLogStore {
|
||||
- logs: ConcurrentLinkedQueue<LogEntry>
|
||||
+ storeLog(logEntry: LogEntry)
|
||||
+ displayLogs()
|
||||
}
|
||||
|
||||
class LogAggregator {
|
||||
- BUFFER_THRESHOLD: int {static}
|
||||
- centralLogStore: CentralLogStore
|
||||
- buffer: ConcurrentLinkedQueue<LogEntry>
|
||||
- minLogLevel: LogLevel
|
||||
- executorService: ExecutorService
|
||||
- logCount: AtomicInteger
|
||||
+ collectLog(logEntry: LogEntry)
|
||||
+ stop()
|
||||
}
|
||||
|
||||
class LogEntry {
|
||||
- serviceName: String
|
||||
- level: LogLevel
|
||||
- message: String
|
||||
- timestamp: LocalDateTime
|
||||
}
|
||||
|
||||
enum LogLevel {
|
||||
DEBUG
|
||||
INFO
|
||||
ERROR
|
||||
}
|
||||
|
||||
class LogProducer {
|
||||
- serviceName: String
|
||||
- aggregator: LogAggregator
|
||||
+ generateLog(level: LogLevel, message: String)
|
||||
}
|
||||
}
|
||||
|
||||
LogProducer --> "-aggregator" LogAggregator
|
||||
LogAggregator --> "-centralLogStore" CentralLogStore
|
||||
LogAggregator --> "-buffer" LogEntry
|
||||
CentralLogStore --> "-logs" LogEntry
|
||||
|
||||
@enduml
|
||||
Reference in New Issue
Block a user