Announcement Announcement Module
Collapse
No announcement yet.
newbie: options for background monitoring service Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • newbie: options for background monitoring service

    As a Spring newbie I'm hoping somebody can advise me on Spring best practice for the following architectural questions...

    a). background process
    If I have a requirement for a background business tier service to run at a fixed interval what are the options for building this? I've seen mention of the Quartz scheduler, but I'm wondering if there any facilities inherent to Spring that would allow a service to either run at a set interval or to start automatically within the hosting container?

    b). pool/cache of threaded services
    If I have a queue (either a real JMS queue or a db table holding entries that represent queue entries) how would I set up a pool of threaded services that could be used to pull entries off the queue and handle them?

  • #2
    Quartz is your friend, and there is a whole section on it in the Spring Reference Guide. Quartz integration in Spring is so good you will find it extremely easy. Spring doesn't re-invent the wheel - it doesn't provide the scheduling service itself, just wraps the ones that are available. Quartz is pretty much the standard - did you have some reason for not using it? You can always use the JDK native Timers if you want (see the same section in Reference Guide).

    Your pooled service requirement might have a number of different implementations. The simplest, if you can use Spring 2.0 is to use the TaskExecutor abstraction for the pooling. If you don't mind being tied to JMS you can also use Message Driven POJOs for the event handling. Again, see the Reference Guide.

    Small cautionary note: all this stuff is really easy to use, but if you are in a project with a single web application it can add significantly to the start up time. This can have a negative impact on devleoper productivity. The solution is to move the scheduling and exection stuff out into a separate component.

    Comment

    Working...
    X