My Initial Experience with Mach-ii, Reactor and ColdSpring15 Dec 2009 | Comments
Due the possibility of a contract work on a project that uses Mach-ii, Reactor and ColdSpring combo next year – I have dedicated some portion of my holiday time to get my hands dirty on these frameworks. It has been around 10 days building a simple application with the frameworks and below is my experience so far.
Getting up and running with Mach-ii (1.6) itself was relatively easy, perhaps this is due to the fact that I have played around with ColdBox and Model-Glue before. However I did have a difficult time to find out how to do some particular things in Mach-ii. To be honest, I did not sit down and go through the docs page by page - given my limited time, I just really want to get an overall picture on how things work and get a sample app up and running quickly. Also given that I have worked with ColdBox quite a lot - I sort of have a bias towards ColdBox way of doing things and documenting.
There were two particular things that I was struggling with, the 1st one was how to do layout in Mach-ii. I spent quite a bit of time going skim through documentation and doing some Googling. It turned out that it is actually there in the documentation first page. Layout was listed down on the bottom of the documentation under Common Architectural Approaches - I missed it the first time when I looked at the page because I was concentrating on Mach-ii Concepts and Introductions section (I assume that Layout must be part of Concepts section).
The other question that I have was how to reload the framework. I came few occasion where my modifications on some CFCs didn’t do anything to the application - so I suspected caching was in play. I was expecting a magic reload URL parameter like ColdBox’s fwreinit - so far I couldn’t find such a thing. Doing some Googling around found out about mach-ii dashboard that will help me in this area. So I downloaded it - dropped it in on my application and now I can reload the framework whenever I made changes to my CFC.
Other than those two issues - everything else seem to work fine. I am a bit worry with mach-ii.xml, I suspect it can get very big and messy quickly if you have a big application.
Next up was to get Reactor to work with Mach-ii. It is a straight forward affair except that somehow I have an old version of Reactor on my computer, I must’ve downloaded it ages ago and never used it. And so I got a weird error message, which unfortunately I forgot to record. After getting the latest version of Reactor - everything works as expected. Again, I have some experience with Reactor before so this part didn’t take too long.
The only part from the framework trinity that I haven’t really work with before is ColdSpring. This is probably the most difficult and time consuming part from the whole experience. Just like my issue with Reactor, I also had an older version of ColdSpring on my computer - so I faced roadblock from early on.
My biggest frustration was to get Mach-ii listener to get dependency injected by ColdSpring (setting the resolveMachIIDependencies to true in mach-ii ColdSpring configuration file) and to get mach-ii autowiring going (setting the autowireAttributeName to true in the config file) - it looks the tightest integration between Mach-ii and ColdSpring happens when those two attributes are set to true.
In order to go ahead with my learning - I decided to put on hold on this issue and resorted to:
- For first issue - manually code the dependency on the Listeners.
- For second issue - use ColdSpring autowire byName. The only problem with this approach is, I have to manually supply getters and setters for the dependencies - not much of a problem for me since this is a small application.
So finally 10 days (around 15 hours) later - I have a simple sample application running using mach-ii for MVC, running Reactor to handle the database and objects side of things and then a very basic use of ColdSpring for managing object dependencies.
On reflection, getting the three frameworks to work together is actually not too hard conceptually - but the hardest part for me was getting the right information on the configuration, especially for ColdSpring - so I will post my ColdSpring and Mach-ii config files on my next blog post.