I am working on programming a java software that will be like a middleware for gathering data from different sources then process the data and send it to different destinations.
The data sources and destinations includes: files, database, TCP, HTTP.
The user will be able to create a channels, each channel will have one data source (file reader, database reader, tcp listener) and one or many data destinations (file writer, database writer, tcp sender).
The application will work as following:
- Read Channels from database.
- For each channel create the data source and its destinations.
- Start the data sources to read data.
What comes in my mind is:
- Sources and destinations are represented as following:
- The channel is a container which will be injected by a source and a list of destinations. So the channel is like a facade pattern
- The data processor in the channel will be connected to the destinations using observer pattern
- At run time, when the application will load the channel list from the database, i will use the factory pattern to create the sources and destinations.
So, is this the best way to represents the channels, sources and destinations? I think sources and destinations have a similarities, for example, FileReader and FileWriter classes will be the same except that one will be for reading and the other for writing, is it good to represent each of them as a separate class?
Aucun commentaire:
Enregistrer un commentaire