I need to do some Spring messaging integration... and is trying to figure out the best way to do it. BTW, I am coming in from the messaging side, meaning know the messaging side very well, but don't have a clue on the Spring framework side. So, please bear with me on the Spring stuff...
Anyway, a quick Google shows that the Spring framework already supports JMS. This means that, as an option, I can load up the JMS wrapper to the messaging system, and then integrated it to Spring.
However, how good is that integration? What versions of Spring supports it? And what are the pluses and minuses? I guess the question is, is it as simple as just connecting JMS to the Spring Framework, and the Spring components will automatically use the messaging environment? Or are there better options -- such as coding the components to use the messaging environment directly? What is the best practice here?
I haven't used JMS myself, but probably it would be just directly calling the JMS API. Spring won't give you more than DI and AOP driven transaction management. You should be able to inject the JMS template into whichever service class you waft to use it... And you would be able to annotate the service class with transactional annotations and the JMS template would participate in the transaction.
I have used it extensively and its very good. I tend to use the Spring Integration project as typically once you start introducing JMS you are also probably interested in leveraging the EIP Design Patterns. Note that Spring Integration simply builds on the basic JMS support that exists in core Spring, it does not replace it.
It is actually incredibly easy to use and the reference documentation for Spring Integration that I linked above is very good. JMS support was included in core Spring all the way back in version 1. However unless you have a strong reason not to I strongly suggest using the latest GA release (currently 4.0.3.RELEASE).
Spring Boot is the new hotness and basically allows for creating spring projects with minimal configuration. Their guides all now use this (and gradle although maven works just fine as well). Have a look at some of those too.
I guess the last question you asked that I did not address. The reason for using Spring is much the same when we talk about JMS as it is for using Spring for other things. It is a framework. A framework that is well tested (you don't need to test the framework just your code) and it is used in every fortune 500 company I have been exposed to. It is also extensible but typically does pretty close to what you need just using the sensible defaults. It also adheres to best practices and makes use of all the relevant design patterns. In other words it helps you do the right thing. It also allows you to focus on solving the business problem and not worrying about the plumbing so to speak. And best of all its Open Source If you want to know what its doing ctrl click the file and bring up the class So yes if Spring can do it for you then I would not roll your own solution. The chances of you doing it better are slim and you will have to test and maintain all that code that you write. When things need customizing Spring has very rarely let me down with its multitude of extension points.
If you wanna get ramped up on Spring, I highly recommend Spring In Action. You can pretty easily plug Spring in to any application by following the samples. However, if you do that a lot of things seem like magic. When I first started with Spring, it was hard form to wrap my mind around how Dependency Injection works. I knew it worked, but didn;t know how it worked. So, when it didn;t work, I had no idea how to fix it.
Jayesh A Lalwani wrote:If you wanna get ramped up on Spring, I highly recommend Spring In Action. You can pretty easily plug Spring in to any application by following the samples. However, if you do that a lot of things seem like magic. When I first started with Spring, it was hard form to wrap my mind around how Dependency Injection works. I knew it worked, but didn;t know how it worked. So, when it didn;t work, I had no idea how to fix it.
Thanks. Just ordered it. There seems to be a new version coming out -- but can't wait for a few months for that.
As for the magically stuff, I guess I will have to figure it out when it happens...
Bill Gorder wrote:He's pretty much done from what I hear. If you get the MEAP you will get the print one as soon as it hits the printers, but still enjoy an up to date Ecopy in the meantime
Thanks, but I already bought it ... and reading it. Plus, this is for a side project, one of many, so I just need to get up to speed quickly, finish it, and move on. And I still prefer physical books over e-books...