Closed djsuperchief closed 6 months ago
Having looked at the two options, option 2 being part of the declaration makes more sense. Adding an additional post processing component / hook to a To route seems to make more sense than adding multiple post processing components.
What is the likelihood of wanting to do multiple processing through multiple components AFTER a to route VS doing a single post to process? We, currently, have a single use case in terms of say S3 -> Process location and add to sqs message for sending. This flow cannot work as there is no current way to pull the returned S3 location and then pipe that into the message body for the SQS message (probably also need to pull that detail through).
Option 2.
To("comp://stuff") To("comp://stuff", Component) To("comp://stuff", IComponent) To("comp://stuff", Func<Routable, Task>)
After a to component runs, you may want to do some additional processing on the message before the next to component processes.
Use cases might be a file written somewhere and then an SQS / amqp message is then sent with the location of the file. Currently no post processing can be done on the message after to has executed.
There are two possibilities as I see it:
1 - A 'Then' part of the route. This works exactly as the processing component but is just a separate component executed immediately after the previous To. It follows the existing design pattern and allows for multiple "Thens".
2 - Part of the To Declaration A single component that runs as part of the To route. So
To("URI", Component)
orTo("URI", Func<Routable, Task>)
. Major advantage of this is it is very clear what is running and when and the implementation can be rolled into the base component as a "post" handler. The downside is it only allows for a single process / component to run and could limit host functionality.This is required functionality because even though the To is intended to be the end point of the process, the fact that we allow multiple To's means there has to be room for additional processing POST the to process.