conductor-oss/conductor · error · IllegalArgumentException
Connection factory is undefined
Error message
Connection factory is undefined
What it means
Constructor guard on AMQPObservableQueue: the ConnectionFactory argument is null. Thrown during construction before any network activity. The Builder always builds a factory via buildConnectionFactory(), so reaching this guard means the public constructor was used directly with a null factory (typical in tests or custom wiring).
Source
Thrown at amqp/src/main/java/com/netflix/conductor/contribs/queue/amqp/AMQPObservableQueue.java:80
private final String QUEUE_TYPE = "x-queue-type";
private final int batchSize;
private final boolean useExchange;
private int pollTimeInMS;
private AMQPConnection amqpConnection;
protected LinkedBlockingQueue<Message> messages = new LinkedBlockingQueue<>();
private volatile boolean running;
public AMQPObservableQueue(
ConnectionFactory factory,
Address[] addresses,
boolean useExchange,
AMQPSettings settings,
AMQPRetryPattern retrySettings,
int batchSize,
int pollTimeInMS) {
if (factory == null) {
throw new IllegalArgumentException("Connection factory is undefined");
}
if (addresses == null || addresses.length == 0) {
throw new IllegalArgumentException("Addresses are undefined");
}
if (settings == null) {
throw new IllegalArgumentException("Settings are undefined");
}
if (batchSize <= 0) {
throw new IllegalArgumentException("Batch size must be greater than 0");
}
if (pollTimeInMS <= 0) {
throw new IllegalArgumentException("Poll time must be greater than 0 ms");
}
this.useExchange = useExchange;
this.settings = settings;
this.batchSize = batchSize;
this.amqpConnection = AMQPConnection.getInstance(factory, addresses, retrySettings);
this.retrySettings = retrySettings;View on GitHub (pinned to cf7c3e4a8a)
Solutions
- Construct via AMQPObservableQueue.Builder, which builds the ConnectionFactory from properties.
- If constructing directly, pass a non-null ConnectionFactory (e.g. new ConnectionFactory()).
- Add a null-check in the calling code before constructing.
Example fix
// before: direct construction with null factory new AMQPObservableQueue(null, addresses, useExchange, settings, retry, batchSize, pollTimeInMS); // after: use the Builder, which builds the factory from properties AMQPObservableQueue q = new AMQPObservableQueue.Builder(properties).build(useExchange, queueURI, queueType);
Defensive patterns
Strategy: validation
Validate before calling
// Validate before constructing directly
if (factory == null) {
throw new IllegalArgumentException("factory required; use AMQPObservableQueue.Builder");
} Prevention
- Construct AMQPObservableQueue via the Builder, which always builds a ConnectionFactory.
- If constructing directly, assert all arguments non-null before the call.
- Cover direct-construction paths in unit tests.
When it happens
Trigger: Calling `new AMQPObservableQueue(null, addresses, ...)` directly instead of through AMQPObservableQueue.Builder, which guarantees a non-null factory.
Common situations: Unit-test wiring that passes null for the factory; a custom queue factory that bypasses the Builder.
Related errors
- Addresses are undefined
- Settings are undefined
- Batch size must be greater than 0
- Poll time must be greater than 0 ms
- Hosts are undefined
AI-assisted analysis of conductor-oss/conductor@cf7c3e4a8a (2026-08-14).
Data as JSON: /api/errors/69c15bdb0bff49d0.
Report an issue: GitHub.