Facing issues in @stream directive #7744
-
Hi @michaelstaib @PascalSenn @glen-84 I am facing issue in stream directive usage. Exception: Cannot access a disposed object. I want to return stream of data using query so i enabled stream like this Registered Mediatr like this and returning IAsyncEnumerable from query type this is my mediatr query handler code public GetDevicesStatusHandler(IDeviceRepository deviceRepository, IMapper mapper)
} this is how i am sending query from nitro UI |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I successfully resolved the issue. The problem was that I hadn't specified the initialCount parameter in the Additionally, I noticed that my code works even without specifying the [StreamResult] directive. This suggests that the decorator might be redundant in this context. |
Beta Was this translation helpful? Give feedback.
I successfully resolved the issue.
The problem was that I hadn't specified the initialCount parameter in the
@stream
directive, which caused the response to return empty. After adding@stream(initialCount: 1)
, the functionality started working as expected, and I now receive responses incrementally.Additionally, I noticed that my code works even without specifying the [StreamResult] directive. This suggests that the decorator might be redundant in this context.