{"record":{"id":"197b30c87070e775","repo":"flowable/flowable-engine","slug":"sending-the-event-was-interrupted","errorCode":null,"errorMessage":"Sending the event was interrupted","messagePattern":"Sending the event was interrupted","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":73,"sourceCode":"            Object rawEvent = event.getBody();\n            Map<String, Object> headerMap = event.getHeaders();\n            List<Header> headers = new ArrayList<>();\n            for (String headerKey : headerMap.keySet()) {\n                Object headerValue = headerMap.get(headerKey);\n                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":55,"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#L55-L88","documentation":"In KafkaOperationsOutboundEventChannelAdapter.sendEvent, the Kafka producer send is awaited synchronously with .get(). If the waiting thread is interrupted, the adapter restores the interrupt flag and throws FlowableException(\"Sending the event was interrupted\"). It indicates the publishing thread was interrupted while the Kafka send was in flight.","triggerScenarios":"The thread executing sendEvent (e.g. a process engine job executor thread) receives Thread.interrupt() while blocked on kafkaOperations.send(producerRecord).get().","commonSituations":"Application shutdown/timeout cancelling an async job mid-send; executor shutdownNow() while a Kafka publish is pending; long broker latency causing a send to outlive a job timeout.","solutions":["Investigate who interrupted the thread (shutdown hooks, job timeout, thread pool shutdown) via the wrapped InterruptedException cause.","Ensure Kafka broker responsiveness so sends complete before timeouts/interrupts.","Retry the event send in a fresh transaction/job after shutdown completes.","Check delivery.timeout.ms / request.timeout.ms so slow sends fail deterministically instead of blocking until interrupted."],"exampleFix":"null","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    outboundEventBus.send(event);\n} catch (FlowableException e) {\n    if (\"Sending the event was interrupted\".equals(e.getMessage())) {\n        Thread.currentThread().interrupt(); // restore flag if needed and reschedule\n        rescheduleSend(event);\n    } else { throw e; }\n}","preventionTips":["Avoid interrupting job-executor threads during normal operation; use graceful shutdown","Tune Kafka producer timeouts so sends do not hang until interrupted","Retry event publication after shutdown completes"],"tags":["kafka","interruption","threading","send"],"backgroundTag":"request-timeout","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"}