Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package io.a2a.server.apps.quarkus;

import java.util.ArrayList;
import java.util.Collections;

import jakarta.enterprise.context.ApplicationScoped;
import jakarta.enterprise.inject.Default;
import jakarta.ws.rs.Produces;

import io.a2a.server.PublicAgentCard;
import io.a2a.server.agentexecution.AgentExecutor;
import io.a2a.server.agentexecution.RequestContext;
import io.a2a.server.events.EventQueue;
import io.a2a.spec.AgentCapabilities;
import io.a2a.spec.AgentCard;
import io.a2a.spec.JSONRPCError;
import io.quarkus.arc.DefaultBean;

/**
* Contains beans annotated with the Quarkus @DefaultBean annotation, in order to avoid
* injection failures when building the Quarkus application as discussed in
* <a href="https://github.com/a2aproject/a2a-java/issues/213">Issue 213</a>.
*
* If an application provides actual implementations of these beans,
* those will be used instead.
*/
@ApplicationScoped
public class DefaultProducers {
@Produces
@PublicAgentCard
@DefaultBean
public AgentCard createDefaultAgentCard() {
throw new IllegalStateException(wrap("Please provide your own AgentCard implementation"));
}

@Produces
@Default
@DefaultBean
public AgentExecutor createDefaultAgentExecutor() {
throw new IllegalStateException(wrap("Please provide your own AgentExecutor implementation"));
}

private String wrap(String s) {
return s +
" as a CDI bean. Your bean will automatically take precedence over this @DefaultBean " +
"annotated implementation.";
}
}