apache/beam · error · IOException

SolaceIO.Write: Could not create producer, producer object…

Error message

SolaceIO.Write: Could not create producer, producer object is null

What it means

JcsmpSessionService.createXMLMessageProducer retries the JCSMP session's getMessageProducer call (retrying on JCSMPException), but if the retry manager still returns null the service throws this IOException. A null producer means the session never produced a usable message producer, so writes cannot proceed.

Solutions

  1. Check broker connectivity: verify host, port (55455/55443), message VPN, and client credentials in JcsmpConnectionFactory/SolaceIO config.
  2. Inspect logs for the underlying JCSMPException retries before the null was returned.
  3. Increase the retry attempts/backoff in the retryCallableManager to tolerate broker reconnect windows.
  4. Ensure the session is explicitly connected (jcsmpSession.connect()) before producer creation in custom setups.

Example fix

// before
JCSMPProperties props = JCSMPProperties.fromProperties(basicProps); // missing VPN
// after
props.setProperty(JCSMPProperties.VPN_NAME, "my_vpn");
props.setProperty(JCSMPProperties.HOST, "tcp://broker:55455");
Defensive patterns

Strategy: retry

Validate before calling

// Pre-flight session connectivity check
// JCSMPSession s = JCSMPFactory.onlyInstance().createSession(props); s.connect(); s.close();

Try / catch

try { pipeline.run(); }
catch (IOException e) {
  if (e.getMessage().contains("Could not create producer")) reconnectAndRetry();
  else throw e;
}

Prevention

When it happens

Trigger: Creating a SolaceIO.Write producer when the JCSMP session is not connected / reconnecting, the retryCallable exhausted its retries on repeated JCSMPException, or the callable swallowed the exception and returned null.

Common situations: Wrong broker host/message VPN/credentials causing connection failure; session disconnected between connect and producer creation; network partition to port 55455; retry budget too small for slow broker recovery.

Understand the failure class

Background: ECONNREFUSED and "connection refused" / "could not connect to server" errors: what they mean and how to fix them — this error's family across 44 libraries.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/d920a616fd3810b5. Report an issue: GitHub.

Appendix: source

Thrown at sdks/java/io/solace/src/main/java/org/apache/beam/sdk/io/solace/broker/JcsmpSessionService.java:136

  }

  private MessageProducer createXMLMessageProducer(SubmissionMode submissionMode)
      throws JCSMPException, IOException {

    if (jcsmpSession == null) {
      connectWriteSession(submissionMode);
    }

    @SuppressWarnings("nullness")
    Callable<XMLMessageProducer> initProducer =
        () ->
            Objects.requireNonNull(jcsmpSession)
                .getMessageProducer(new PublishResultHandler(publishedResultsQueue));

    XMLMessageProducer producer =
        retryCallableManager.retryCallable(initProducer, ImmutableSet.of(JCSMPException.class));
    if (producer == null) {
      throw new IOException("SolaceIO.Write: Could not create producer, producer object is null");
    }
    return new SolaceMessageProducer(producer);
  }

  private MessageReceiver createFlowReceiver() throws JCSMPException, IOException {
    Queue queue = checkStateNotNull(queue(), "SolaceIO.Read: Queue is not set.");

    ConsumerFlowProperties flowProperties = new ConsumerFlowProperties();
    flowProperties.setEndpoint(queue);
    flowProperties.setAckMode(JCSMPProperties.SUPPORTED_MESSAGE_ACK_CLIENT);

    EndpointProperties endpointProperties = new EndpointProperties();
    endpointProperties.setAccessType(EndpointProperties.ACCESSTYPE_NONEXCLUSIVE);
    if (jcsmpSession != null) {
      return new SolaceMessageReceiver(
          createFlowReceiver(jcsmpSession, flowProperties, endpointProperties));
    }
    throw new IOException(

View on GitHub (pinned to 12126d8942)