Add scheduled tasks (#13470)

### What problem does this PR solve?

1. RAGFlow server will send heartbeat periodically.
2. This PR will including:
- Scheduled task
- API server message sending
- Admin server API to receive the message.

### Type of change

- [x] New Feature (non-breaking change which adds functionality)

---------

Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
Jin Hai
2026-03-09 17:48:29 +08:00
committed by GitHub
parent c732a1c8e0
commit 52bcd98d29
14 changed files with 871 additions and 36 deletions

View File

@ -0,0 +1,33 @@
package common
import (
"time"
)
type MessageType string
const (
MessageHeartbeat MessageType = "heartbeat"
MessageMetric MessageType = "metric"
MessageEvent MessageType = "event"
)
type ServerType string
const (
ServerTypeAPI ServerType = "api_server" // API server
ServerTypeWorker ServerType = "ingestor" // Ingestion server
ServerTypeScheduler ServerType = "data_collector" // Data collection server
)
type BaseMessage struct {
MessageID int64 `json:"report_id"`
MessageType MessageType `json:"report_type"`
ServerName string `json:"server_id"`
ServerType ServerType `json:"server_type"`
Host string `json:"host"`
Port int `json:"port"`
Version string `json:"version"`
Timestamp time.Time `json:"timestamp"`
Ext map[string]interface{} `json:"ext,omitempty"`
}