@axiom-lattice/出道
基于快取的HTTP API网关将 REST 端点曝光,用于代理执行,线程管理和配置.
存储消费
网关读取所有商店 StoreLatticeManager 启动时——不需要手动接线.
通过 configureStores 在此之前 电话 startAsHttpEndpoint()数字 :
import { configureStores } from "@axiom-lattice/core";
import { createPgStoreConfig } from "@axiom-lattice/pg-stores";
import { LatticeGateway } from "@axiom-lattice/gateway";
const stores = createPgStoreConfig(process.env.DATABASE_URL);
await configureStores({ ...stores });
// Gateway picks up stores from StoreLatticeManager automatically
LatticeGateway.startAsHttpEndpoint({ port: 4001 });
如何运作
网关内部呼叫 getStoreLattice("default", type) 对于它需要的每个商店:
channelBinding用于MessageRouter对发送方至代理方具有约束力的决议channelInstallation用于频道实例搜索database—— 说SqlDatabaseManager在第一个查询中读取空格metrics—— 说MetricsServerManager第一个访问时装入配置- 其他用品 控制器通过
getStoreLattice("default", type)
没有 setConfigStore() 或者说 loadConfigsFromStore() 需要的电话——每个管理者直接从 StoreLatticeManager。 。 。 .
快速启动
import { LatticeGateway } from "@axiom-lattice/gateway";
LatticeGateway.startAsHttpEndpoint({
port: 4001,
});
锁定配置
import { LatticeGateway } from "@axiom-lattice/gateway";
import { LoggerType } from "@axiom-lattice/protocols";
LatticeGateway.startAsHttpEndpoint({
port: 4001,
loggerConfig: {
name: "default",
type: LoggerType.PINO,
serviceName: "my-service",
},
});
API 终点
POST /api/v1/run- 执行机构POST /api/v1/run/stream- 流出代理人执行GET /api/v1/run/:thread_id- 获取运行状态GET /api/v1/run/:thread_id/messages——获取消息历史