Announcement Announcement Module
Collapse
No announcement yet.
Batch procedures using Spring ? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Batch procedures using Spring ?

    Hi,

    I am new to Spring, but I am very much charmed by its design. What I would like to do is test a migration of an existing (but not too good performing) j2ee application on JBoss to something more lightweight.
    The application works like this :
    - a session bean ('decoder') calls two entity beans to read data, decode it and store it in another table
    - the 'startprocess' method on the 'decode' bean is called by a message-driven bean which listens to a queue
    - the message to this queue is sent by our Flux scheduler

    For several reasons, I would like to implement something like this using Spring.
    First of all, do you think this is something suitable for Spring or should I simply make a java class using jdbc and called directly by Flux ?
    Second, would it be worthwhile to skip the jdbc and use Spring for the database part, but still in a simple java class ?
    Third, is it possbile to use Spring for the logic, put it in a web container and call it I don't know how, from the outside ?
    Fourth, can I integrate JMS messaging somewhere ?

    Sorry for all these questions, but the main thing is that I would like to know how Spring would perform in non-web applications.

    thanks,

    Henk

  • #2
    Henk,

    Spring can be used to build pretty much any application you want, so you can certainly move this application to a Spring-based environment.

    I'll try to answer your questions as best I can:

    1. Yes this is certainly suitable for Spring. There is nothing stopping you creating a simple JDBC-based class and calling that directly - if that is what you want to do. Without being fully aware of your requirements I can't really comment on the best approach, you shoud ask yourself whether that architecture meets your requirements or whether it is a step back from where you are now.

    2. I would certainly recommend using Spring support for building your database layer. Spring provides an excellent abstraction layer around JDBC that takes the pain out of the process. Plus there is support for a wide range of different ORM tools like Hibernate, iBATIS, JDO and OJB.

    3. Spring itself won't really implement your logic, but you can certainly have Spring help with the logic. You should start by defining an interface for your business logic and then create an implementation of this interface. Using Spring you can inject the implementation class into any of your application components, all of which are written in terms of the interface. This means you can swap out implementations of your logic easily and without impacting your application. To make the logic available to external applications you should take a look at Spring remoting features allowing you to expose services in a variety of ways. You don't need to have a web container to do this either. Coming in Spring 1.2 you will be able to take advantage of automatic JMX support to allow for easy application management. I have used similar features in a queue-based application to monitor queue activity and to start/stop/purge the queue.

    4. Certainly! Spring provides a lot of helper classes for working with JMS, but does not provide a JMS implementation. I recommend that you look at ActiveMQ (www.codehaus.org) with is quite a decent open source JMS implementation that integrates nicely into Spring applications.

    Hope this helps!

    Rob

    Comment

    Working...
    X