TradesLoader component can be
refactored to do its job of loading the Trades from a file. In order to
complete its task, the
will publish the Trades to a data-holding structure like a bucket. In
Messaging terms, this is called a destination or a
channel. The rest of the components should be picking
up the Trades from this channel, which acts as a conduit.
Note that we did not introduce a full-blown enterprise messaging solution here. It would be overkill, because it would introduce a whole stack of infrastructure and open doors to different programming models.
See Figure 1-2, which depicts a sort of parallel process using a standalone messaging model.
The Spring Integration framework is an excellent choice for this type of messaging solution. If you are already familiar with Spring Framework or if your project is already springified, then you are in good hands. Spring Integration is perceived as an extension of the Spring Core, so you will obtain all the benefits of dependency injection, decoupling, testability, etc. You do not need to have an application server to host your messaging solution when you use Spring Integration—which is a big advantage, as you don’t have to invest time and money in adopting the messaging technologies.
We will look at the framework in detail in the next chapter.