{"record":{"id":"b923df032804fbb1","repo":"flowable/flowable-engine","slug":"failed-to-send-event","errorCode":null,"errorMessage":"failed to send event","messagePattern":"failed to send event","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-event-registry-spring/src/main/java/org/flowable/eventregistry/spring/kafka/KafkaOperationsOutboundEventChannelAdapter.java","lineNumber":78,"sourceCode":"                if (headerValue != null) {\n                    headers.add(new RecordHeader(headerKey, headerValue.toString().getBytes(StandardCharsets.UTF_8)));\n                }\n            }\n\n            Integer partition = partitionProvider == null ? null : partitionProvider.determinePartition(event);\n            Object key = messageKeyProvider == null ? null : messageKeyProvider.determineMessageKey(event);\n\n            ProducerRecord<Object, Object> producerRecord = new ProducerRecord<>(topic, partition, key, rawEvent, headers);\n            kafkaOperations.send(producerRecord).get();\n            \n        } catch (InterruptedException e) {\n            Thread.currentThread().interrupt();\n            throw new FlowableException(\"Sending the event was interrupted\", e);\n        } catch (ExecutionException e) {\n            if (e.getCause() instanceof RuntimeException) {\n                throw (RuntimeException) e.getCause();\n            } else {\n                throw new FlowableException(\"failed to send event\", e.getCause());\n            }\n        }\n    }\n\n    @Override\n    public void sendEvent(Object rawEvent, Map<String, Object> headerMap) {\n        throw new UnsupportedOperationException(\"Outbound processor should never call this\");\n    }\n}\n","sourceCodeStart":60,"sourceCodeEnd":88,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-event-registry-spring/src/main/java/org/flowable/eventregistry/spring/kafka/KafkaOperationsOutboundEventChannelAdapter.java#L60-L88","documentation":"When the Kafka producer future completes exceptionally with an ExecutionException whose cause is not a RuntimeException, the adapter wraps that cause in FlowableException(\"failed to send event\"). This is the generic path for broker-side or serialization failures during a synchronous outbound event send.","triggerScenarios":"kafkaOperations.send(...).get() throws ExecutionException caused by a checked/non-Runtime Throwable, e.g. TimeoutException, authentication/authorization errors (SaslAuthenticationException, TopicAuthorizationException), or serialization errors surfaced as non-Runtime exceptions.","commonSituations":"Kafka broker down or unreachable (timeout), wrong SASL credentials, topic missing with auto-create disabled, oversized message exceeding max.request.size.","solutions":["Inspect e.getCause() (attached to this FlowableException) for the real Kafka failure.","Verify broker connectivity, bootstrap servers and topic existence.","Check Kafka client security config (SASL/SSL) and max.request.size.","Wrap or retry sends with a dead-letter policy for persistent failures."],"exampleFix":"null","handlingStrategy":"retry","validationCode":"// pre-check broker connectivity\ntry (AdminClient admin = AdminClient.create(Map.of(\"bootstrap.servers\", servers))) {\n    admin.describeCluster().nodes().get(5, TimeUnit.SECONDS);\n}","typeGuard":null,"tryCatchPattern":"try {\n    outboundEventBus.send(event);\n} catch (FlowableException e) {\n    if (\"failed to send event\".equals(e.getMessage()) && isTransient(e.getCause())) {\n        retryWithBackoff(event);\n    } else { deadLetter(event, e.getCause()); }\n}","preventionTips":["Always log/inspect getCause() — the real Kafka failure is wrapped","Set sane delivery.timeout.ms/retries in producer config","Monitor broker availability and implement dead-letter handling for sends"],"tags":["kafka","producer","send-failure"],"backgroundTag":"api-request-failed","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}