서버를 다시 켜도 편지가 사라지지 않고, 배달에 실패해도 나중에 도착해요. 게다가 저장하는 곳이 postgres든 redis든 sqlite든 — 코드는 한 줄도 바뀌지 않아요. 곳간 입구가 KvStore와 MessageQueue라는 두 가지 모양으로 정해져 있거든요.
amqp 오두막에는 KvStore가 없어요. RabbitMQ는 전언을 나르는 도구이지 선반이 아니거든요 — 못 하는 일은 맡지 않아요. 이 "없는 건 없다"도 이 구역의 설계 가운데 하나예요.
볼거리
- 입구 정의는 본당 쪽에 있어요: federation/kv.ts와 federation/mq.ts. cas()(compare-and-swap)는 1.8.0부터, list()는 2.0.0부터예요
- MessageQueue의 nativeRetrial 플래그 — 곳간이 자기 재전송을 갖고 있으면, fedify는 자기 재전송을 그만두고 양보해요
- redis 곳간은 JsonCodec을 갈아 끼울 수 있고, CodecError/EncodingError/DecodingError 오류 표 한 벌도 갖췄어요
- sqlite 곳간은 얇은 SqliteDatabase 층을 직접 함께 넣어요. 참고로 hollo도 hackers.pub도 고른 건 postgres 곳간이었어요
경문 한 구절
export interface MessageQueue {
/**
* Whether the message queue backend provides native retry mechanisms.
* When `true`, Fedify will skip its own retry logic and rely on the backend
* to handle retries. When `false` or omitted, Fedify will handle retries
* using its own retry policies.
*
* @default `false`
* @since 1.7.0
*/
readonly nativeRetrial?: boolean; 만져 보기
곳간이 비어 있어요.
도착: 0