mirror of
https://github.com/slhaf/Partner.git
synced 2026-05-12 16:53:04 +08:00
refactor(agent): introduce AgentBootstrap for startup wiring and simplify app launch
This commit is contained in:
@@ -1,15 +1,10 @@
|
||||
package work.slhaf.partner;
|
||||
|
||||
import work.slhaf.partner.common.vector.VectorClientRegistry;
|
||||
import work.slhaf.partner.framework.agent.Agent;
|
||||
import work.slhaf.partner.runtime.gateway.WebSocketGatewayRegistration;
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
boolean launched = Agent.newAgent(Main.class)
|
||||
.addGatewayRegistration(WebSocketGatewayRegistration.INSTANCE)
|
||||
.addConfigurable(new VectorClientRegistry())
|
||||
.launch();
|
||||
boolean launched = Agent.newAgent(Main.class).launch();
|
||||
if (!launched) {
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package work.slhaf.partner.runtime;
|
||||
|
||||
import work.slhaf.partner.common.vector.VectorClientRegistry;
|
||||
import work.slhaf.partner.framework.agent.Agent;
|
||||
import work.slhaf.partner.runtime.gateway.WebSocketGatewayRegistration;
|
||||
|
||||
public final class PartnerAgentBootstrap extends Agent.AgentBootstrap {
|
||||
|
||||
public PartnerAgentBootstrap(Agent.AgentApp agentApp) {
|
||||
super(agentApp);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void bootstrap() {
|
||||
addGatewayRegistration(WebSocketGatewayRegistration.INSTANCE);
|
||||
addConfigurable(new VectorClientRegistry());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user