{"record":{"id":"7cf4fe863d8bc744","repo":"nathanmarz/storm","slug":"trident-does-not-support-direct-streams","errorCode":null,"errorMessage":"Trident does not support direct streams","messagePattern":"Trident does not support direct streams","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"storm-core/src/jvm/storm/trident/spout/RichSpoutBatchExecutor.java","lineNumber":193,"sourceCode":"            ids = new ArrayList<Object>();\n        }\n        \n        @Override\n        public void reportError(Throwable t) {\n            _collector.reportError(t);\n        }\n\n        @Override\n        public List<Integer> emit(String stream, List<Object> values, Object id) {\n            if(id!=null) ids.add(id);\n            numEmitted++;            \n            _collector.emit(values);\n            return null;\n        }\n\n        @Override\n        public void emitDirect(int task, String stream, List<Object> values, Object id) {\n            throw new UnsupportedOperationException(\"Trident does not support direct streams\");\n        }\n        \n    }\n    \n}\n","sourceCodeStart":175,"sourceCodeEnd":199,"githubUrl":"https://github.com/nathanmarz/storm/blob/cdb116e942666973bc4eaa0df098d5bab82739e7/storm-core/src/jvm/storm/trident/spout/RichSpoutBatchExecutor.java#L175-L199","documentation":"RichSpoutBatchExecutor wraps a regular IRichSpout for Trident batch spouts and replaces its output collector with one whose emitDirect throws UnsupportedOperationException. Trident topology semantics (grouping, batching) do not support direct stream connections, so any attempt to emit directly from a wrapped spout fails immediately.","triggerScenarios":"Using a spout that calls collector.emitDirect(...) (e.g. a partial-key-grouping or direct-grouping spout) inside a Trident topology via TridentTopology.newStream, then the spout attempts a direct emit at runtime.","commonSituations":"Migrating an existing raw Storm spout into Trident without removing direct emits; third-party spouts that rely on direct grouping; copying spout code that uses emitDirect for backpressure or targeted delivery.","solutions":["Replace all emitDirect calls in the spout with normal collector.emit(values).","If direct grouping is required, keep the spout in a plain (non-Trident) Storm topology instead.","Wrap the emit logic: use emit with partialKeyGrouping/shuffle groupings that Trident supports.","Audit third-party spout libraries for direct emit usage before embedding them in Trident."],"exampleFix":"// before\nif (taskIndex == target) collector.emitDirect(target, stream, values, msgId);\nelse collector.emit(stream, values, msgId);\n// after: Trident supports only indirect emits\ncollector.emit(stream, values, msgId);","handlingStrategy":"validation","validationCode":"// Java: audit spout code for direct emits before embedding in Trident\n// grep your spout source for:\n// collector.emitDirect(  -> must be absent in spouts used with Trident","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never use emitDirect in spouts intended for Trident topologies","Check third-party spout libraries for direct-grouping reliance","Add a smoke test that runs the spout under Trident in local mode"],"tags":["trident","spout","direct-streams","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"}