Setup callback hook for base classes
Stream
s and Sink
s often need to do some setup before the EL process. For example, a Sink
may need to update table schemas in the target database, a Stream
may need to open a connection, etc.
Users can put this stuff in constructors but I see a few problems with this:
- the constructors have some complex arguments, and we probably want to discourage users from overriding the base constructor so that we can change the arguments in the future
- it makes testing a bit complicated, as you can't have an instance of the class without it doing setup
My proposal is a simple method (prepare
? setup
? something to that effect) with a default pass
implementation that is called before any messages come in/out. Perhaps also a corresponding teardown method for resources that need to be cleaned up like database connections.