When can I use a Reducer? What does it emit? #51
-
Please let me know if there's a resource I missed that might answer this! To start, here's the Reducer documentation. From the documentation, I wasn't able to get a complete understanding of when a Reducer can or can't be used prior to another node. For instance, say I'm trying to split a slideshow into images, then give them all to Claude and ask for a summary of the presentation. The Reducer documentation states this node allows us to "group relevant documents into a single semantical envelope and perform combined operations on them." Broadly, that seems right for this use case. But I'm also doubtful of whether that's possible: it doesn't look like there's a spot to pass a funclet to an // ...
import { concat } from './funclets/ffmpeg';
// ...
const ffmpeg = new FfmpegProcessor.Builder()
.withScope(this)
.withIdentifier('FfmpegProcessor')
.withCacheStorage(cache)
.withVpc(vpc)
.withSource(voiceReducer)
.withIntent(concat)
.build(); Information that might help is what CloudEvent(s) is/are emitted into SNS. (E.g., the following diagram notes "aggregated events"--but in what sense are they aggregated and how are the CloudEvents logically organized?) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey @spagdoon0411! That's a good question. The TLDR; is that the reducer aggregates the CloudEvents passed by upstream middlewares and combines them into a JSON document (a JSON array, in fact) that contains the aggregated cloudevents. It does that aggregation based on the given reducer strategy (TimeWindowStrategy, StaticCounterStrategy, ConditionalStrategy). The output of a reducer is always
Now regarding your question of when a reducer can be used prior to another middleware is it depends on whether that middleware supports
Hope I answered your question. |
Beta Was this translation helpful? Give feedback.
Hey @spagdoon0411!
That's a good question. The TLDR; is that the reducer aggregates the CloudEvents passed by upstream middlewares and combines them into a JSON document (a JSON array, in fact) that contains the aggregated cloudevents. It does that aggregation based on the given reducer strategy (TimeWindowStrategy, StaticCounterStrategy, ConditionalStrategy). The output of a reducer is always
application/cloudevents+json
. So the output of a reducer would like like this :Now regarding your question of when a reducer can be used prior to another m…