dotnetcore/CAP · error · PublisherSentFailedException

pulsar message persisted failed!

Error message

pulsar message persisted failed!

What it means

A sentinel error thrown by the Pulsar transport's SendAsync when producer.SendAsync returns a null message id, i.e. the broker did not acknowledge the persisted message. The faulty input is the Pulsar message (topic/name, key, headers) being produced; common causes are an unreachable or misconfigured Pulsar broker, missing topic permissions, or producer creation against an invalid topic.

Solutions

  1. Verify the Pulsar broker URL and connectivity (TLS/auth settings in PulsarOptions) from the application host.
  2. Ensure the topic being published to exists and the producer's role has produce permissions on it.
  3. Inspect broker-side logs/exceptions for the real send failure; a null message id is only a symptom of an unacknowledged produce.
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at src/DotNetCore.CAP.Pulsar/ITransport.Pulsar.cs:45 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of dotnetcore/CAP@e52b8508e5 (2026-09-14). Data as JSON: /api/errors/889c91e7f547fe62. Report an issue: GitHub.

Appendix: source

Thrown at src/DotNetCore.CAP.Pulsar/ITransport.Pulsar.cs:45

    public async Task<OperateResult> SendAsync(TransportMessage message)
    {
        var producer = await _connectionFactory.CreateProducerAsync(message.GetName());

        try
        {
            var headerDic = new Dictionary<string, string?>(message.Headers);
            headerDic.TryGetValue(PulsarHeaders.PulsarKey, out var key);
            var pulsarMessage = producer.NewMessage(message.Body.ToArray()!, key, headerDic);
            var messageId = await producer.SendAsync(pulsarMessage);
            
            if (messageId != null)
            {
                _logger.LogDebug($"pulsar topic message [{message.GetName()}] has been published.");

                return OperateResult.Success;
            }

            throw new PublisherSentFailedException("pulsar message persisted failed!");
        }
        catch (Exception ex)
        {
            var wrapperEx = new PublisherSentFailedException(ex.Message, ex);

            return OperateResult.Failed(wrapperEx);
        }
    }
}

View on GitHub (pinned to e52b8508e5)