サーバを再起動しても手紙が消えず、配達に失敗してもあとで届きます。しかも保存先は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