{"record":{"id":"9927bf74d6726753","repo":"nathanmarz/storm","slug":"trident-does-not-support-direct-emits-from-spouts","errorCode":null,"errorMessage":"Trident does not support direct emits from spouts","messagePattern":"Trident does not support direct emits from spouts","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"storm-core/src/jvm/storm/trident/spout/RichSpoutBatchTriggerer.java","lineNumber":168,"sourceCode":"            finish.msgId = msgId;\n            List<Integer> tasks = _collector.emit(_stream, new ConsList(batchId, values));\n            Set<Integer> outTasksSet = new HashSet<Integer>(tasks);\n            for(Integer t: _outputTasks) {\n                int count = 0;\n                if(outTasksSet.contains(t)) {\n                    count = 1;\n                }\n                long r = _rand.nextLong();\n                _collector.emitDirect(t, _coordStream, new Values(batchId, count), r);\n                finish.vals.add(r);\n            }\n            _finishConditions.put(batchIdVal, finish);\n            return tasks;\n        }\n\n        @Override\n        public void emitDirect(int task, String ignore, List<Object> values, Object msgId) {\n            throw new RuntimeException(\"Trident does not support direct emits from spouts\");\n        }\n\n        @Override\n        public void reportError(Throwable t) {\n            _collector.reportError(t);\n        }\n        \n    }\n}\n","sourceCodeStart":150,"sourceCodeEnd":178,"githubUrl":"https://github.com/nathanmarz/storm/blob/cdb116e942666973bc4eaa0df098d5bab82739e7/storm-core/src/jvm/storm/trident/spout/RichSpoutBatchTriggerer.java#L150-L178","documentation":"RichSpoutBatchTriggerer wraps an IBatchSpout or rich spout for Trident and overrides emitDirect to throw a RuntimeException, because Trident does not support direct emissions from spouts. A spout attempting a direct emit inside a Trident batch will hit this immediately at runtime.","triggerScenarios":"A batch spout or wrapped spout implementation calls its collector's emitDirect(task, stream, values, msgId) while running under Trident; the wrapper's collector rejects the call.","commonSituations":"Porting raw Storm spouts using direct grouping into Trident; spout frameworks that emit conditionally direct vs regular; library spouts with emitDirect paths not documented as Trident-incompatible.","solutions":["Rewrite the spout to use collector.emit only; remove all emitDirect paths.","If direct emission is essential, run the spout in a plain Storm topology rather than Trident.","Substitute Trident-supported groupings (shuffle, fields, partialKey) for direct targeting.","Add an integration test running the spout under Trident to catch direct-emit paths before deployment."],"exampleFix":"// before\ncollector.emitDirect(taskId, stream, tuple, msgId);\n// after\ncollector.emit(stream, tuple, msgId);","handlingStrategy":"validation","validationCode":"// Java: before deploying, verify batch spout implementation has no emitDirect path\n// static audit: ensure no call sites of _collector.emitDirect( in spout classes","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Implement batch spouts using emit() only","Document that your spout is Trident-incompatible if it needs direct grouping","Run spouts in local Trident clusters during CI to surface direct-emit paths early"],"tags":["trident","spout","direct-emits","unsupported-operation"],"backgroundTag":"unsupported-operation","analyzedSha":"cdb116e942666973bc4eaa0df098d5bab82739e7","analyzedAt":"2026-09-12T14:30:00.714Z","contentChangedAt":"2026-09-12T14:30:00.714Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}