Announcement Announcement Module
Collapse
No announcement yet.
Job Share Objects Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Job Share Objects

    How Can I share objects beetwen different jobs ?
    I've one job launched by other jobs with JobLauncher but it only accepts in the run method simple parameters like String,Date, etc..Can I extend JobLauncher ?
    How differents job can comunicate ?
    Can someone help me?

  • #2
    you can use plain Spring beans to share something between jobs (as long as the jobs are running in the same Spring application context.) The Spring beans - some kind of "holders" - would be injected in the artifacts (readers, writer, listeners) of the different jobs. But be careful with that: you're basically coupling the jobs with each other. Don't forget also to clean the holder beans between execution, so that a job doesn't use the data from a previous run.
    Did you also think about storing what you need in the database?

    Comment


    • #3
      Thank you for your answer,
      i'll try to describe my scenario:
      i have a job that loads some data, creates my domain-model object and starts a job. the domain model object has to be shared with the job launched by the first job because the second job requests some resources using a method inside the domain model and start a thread for each resource it obtains. After this (when all the threads ends well) the second job calls a final method inside the domain model object.
      what do you recommend me to do? should i try to use a single job with two steps and one of this steps should be partitionized?

      Comment


      • #4
        Why don't simply make a job with 2 steps?
        having a dedicate child app ctx for each job execution, and have the shared data as one plain spring bean in the job and inject into that 2 step artifacts

        Comment


        • #5
          could you give me an example?

          Comment

          Working...
          X