Announcement Announcement Module
No announcement yet.
Integration with Web Application Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Integration with Web Application

    Dear Gurus/Senior Members,

    We have a requirement to trigger the batch jobs from a web application. In Spring batch article I found a reference to HTML Invoker. In this case I suppose the batch code should reside as part of the Web Container. Some of my batch jobs are designed to run in multi thread mode. Creating threads in JEE Container is not a good practice. Hence I'm searching for any other way to implement this requirement.

    Could you gusy please suggest a better way to do it? Thanks.

    Best regards,

  • #2
    A helpful link


    I have been facing the same problem, but haven't had time to solve this yet. I use Quartz for scheduling and after some googling i found this:

    It is about using the quartz scheduler, but I guess it applies to any webapp that starts new 'unmanaged' threads.



    • #3
      Originally posted by Saravan View Post
      Creating threads in JEE Container is not a good practice. Hence I'm searching for any other way to implement this requirement.
      What sort of scale are we talking about here? How about launching the jobs with a WorkManagerTaskExecutor?

      Thinking off the cuff if you really want to isolate batch from your web app there's another alternative. You might route your web originated job invocations over JMS to a dedicated server where the message endpoint launches the jobs. Spring Integration might come in handy here. The end point could be POJO. If those unmanaged threads with their crazy rock and roll crashed the party your web app wouldn't be effected. If your message channel was durable and your jobs restartable you could recover gracefully before anyone noticed.

      Or again with the WorkManagerTaskExecutor you could have dedicated JEE servers just for running Spring Batch jobs with managed threads, again communicating between them and the web app with JMS. You could load balance via the JMS channel or with the batch JEE servers themselves. The possibilities are endless really.


      • #4

        Much thanks for suggestions. I'm more looking for the right way or the best way to do it. Sometime back I remember seeing HTTP Invoker while googling for this solution. Unfortunately I did not book mark it. Now I'm not able to find the link. Would you be able to share in case you have it.

        Last edited by Saravan; Jul 2nd, 2009, 02:28 AM. Reason: To mention other available feature


        • #5
          You mean Spring's HttpInvokerServiceExporter (17.4. Exposing services using HTTP invokers)?

          I'm not sure I could tell you the right or best way to do it, at least not without a lot more detail about your situation. For me the best way is usually the simplest way that could possibly work, which means I'm not usually in a JEE container to begin with. Your requirements and ecosystem may be totally different. If you're triggering jobs from HTTP requests you likely don't want to block on their completion, but you've already got that. If you're in a JEE container WorkManagerTaskExecutor will allow you to fork jobs with managed threads. If you want to externalize your job threads from your JEE server there are numerous remoting options with different advantages and compromises. Spring Batch doesn't have an intrinsic bias to any of those options that I've experienced. Without more specifics that's about all I can offer.


          • #6

            Much thanks for detailed explanation.

            I've more than 30 batch jobs and the list keeps growing. The batch jobs would be deployed on a resonably high configured server. I've to accomplish following:
            1. I need to provide a means through which production support admins can schedule these jobs. There may be ad-hoc requirements to start, stop and restart these jobs. My client is expecting more as a web application.
            2. Invoke these batch jobs from a different web application under same firewall.
            3. Monitor the batch jobs

            For scheduling we are inclaind towards Quartz. We are thinking to develop a small production support web application that can schedule, start, stop and restart. But my concern is, few of the batch jobs spawn threads for improving performance. However creating our own threads in JEE container is not a good solution. Hence I wanted experts opinion on this. And is there any alternatives available.

            Do let me know in case you need more details.

            Best regards,