• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Spring ... and JMS support

 
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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?

Thanks,
Henry
 
Rancher
Posts: 2759
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do what the spring docs tell you

http://docs.spring.io/spring/docs/3.1.x/spring-framework-reference/html/jms.html

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.
 
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

http://projects.spring.io/spring-integration/
http://docs.spring.io/spring-integration/docs/4.0.0.BUILD-SNAPSHOT/reference/html/jms.html

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.
https://spring.io/guides/gs/messaging-jms/

or the whole list

https://spring.io/guides

If you use STS (http://spring.io/tools) instead of vanilla eclipse you get good Spring support out of the box including the ability to create a Spring starter project from the file --> new menu.

You can get the same advantage to by just visiting the initializer website (http://start.spring.io/). Make sure you check the integration checkbox for spring integration.

Lastly you can find out more about Spring Boot here:
http://projects.spring.io/spring-boot/
 
Bill Gorder
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here are some more samples. If I haven't answered your question let me know and I'll elaborate.
https://github.com/spring-projects/spring-integration-samples/tree/master/basic/jms
 
Bill Gorder
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

HTH
 
Henry Wong
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Thanks everyone. I guess the main reason that I asked is because I am coming in only from the messaging side -- strong experience with messaging and little with the Spring framework.

So, thanks for all the links, and it's nice to know that the JMS integration is the recommended way to go. I also think that I need to get ramped up with Spring, and with all the links provided.

Thanks again,
Henry
 
Jayesh A Lalwani
Rancher
Posts: 2759
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Henry Wong
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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...

Henry
 
Bill Gorder
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Henry Wong
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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...

Henry
 
Bill Gorder
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Np.

This wont be here until July but looks nice
https://spring.io/blog/2014/04/30/spring-4-1-s-upcoming-jms-improvements
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic