Announcement Announcement Module
Collapse
No announcement yet.
Spring Batch Admin "Job Description" mystery Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Batch Admin "Job Description" mystery

    Any Spring Batch Admin users here know where the "Description" column in Spring Batch Admin's "Jobs Page" gets its value from?

    I've tried configuring a "batch:description" to jobs configuration like below but the Spring Batch Admin page still displays "No Description". Would be very helpful if I can get this column to display the description ...

    <batch:job id="testJob" job-repository="springbatch.jobRepository" >
    <batch:description>Test Job Description</batch:description>
    ...

  • #2
    Has anyone gotten this to display the proper values. Would really appreciate any feedback. Thanks

    Comment


    • #3
      Made some progress... Upon digging into the Spring Batch Admin source code, I see the jobs.ftl that seems to be the view for this page. In that, I see this line

      <td><@spring.messageText code="${job.name}.description" text="No description"/></td>


      which is the description. I see the JobController and method "jobs" that is mapped to that URL (which I'm assuming means this is the one processing this page). This is what I see the "jobs()" method putting into the model.

      List<JobInfo> jobs = new ArrayList<JobInfo>();
      ...
      model.addAttribute("jobs", jobs);

      Which I'm assuming means the line in the jobs.ftl "${job.name}.description" is getting mapped to the JobInfo's name.description attribute. I see the JobInfo class has a " private final String name;" but it is a String and I'm not sure how a ".description" on this would work or I don't see a description attribute on JobInfo class either.

      I'm not familiar with Spring MVC and I could be interpreting some of these wrong... Any Spring MVC experts or Spring Batch Admin experts who could shed some light on this one? Thanks!

      Comment


      • #4
        It looks like the ${job.name}.description really comes a ResourceBundle and it appears that its not related to the "batch:description" tag in the Spring Batch job configuration like I initially thought. I'm not sure where the ResourceBundle is stored in Spring Batch Admin or where I can store it in my application for Spring Batch Admin to pick this up.

        Don't find anything about this in the User Guide either... Any ideas anyone?

        Comment


        • #5
          Alright... I think I lied when I said that there wasn't anything about this in User Guide. There is actually a section with the heading "Extending the UI" and under the "Text Content" sub-heading, there is mention of how to configure a "MessageSource".

          Basically, creating a file under "META-INF/spring/batch/servlet/override/*.xml" and configuring a bean similar to:

          <bean id="messageSource" class="org.springframework.context.support.Resourc eBundleMessageSource">
          <property name="basename" value="messages"/>
          </bean>

          will load the values in "messages.properties". Created a "job-description.properties" and used that in the "messageSource" bean with the "job name=description" mapping in the "job-description.properties" file. Works like a charm. Adding this to close the post and in case someone runs into this.

          Comment


          • #6
            sathya_sn,

            If I understood correctly, it still doesn't populate the value from <batch:description> xml tag, isn't it?

            Comment


            • #7
              Originally posted by chanokim View Post
              sathya_sn,

              If I understood correctly, it still doesn't populate the value from <batch:description> xml tag, isn't it?
              Funny you've found this issue. I was just investigating a system built a few years ago and noticed there is an extra map of strings in the applicationContext.xml that just holds a map of job_name=>descriptions and these are merged against job details returned. Seems very likely that this failure of the <batch:description> tag has been out there for several years.

              On looking at the DDL for the batch tables, there are no entries for the job description (i.e. in BATCH_JOB_INSTANCE). As such, you'll never get this description back unless you track it in some additional source like the aforementioned map. Worth note, the Quartz tables do hold a description value (QRTZ_JOB_DETAILS).

              Batch DDL - http://static.springsource.org/sprin...tchJobInstance

              So, funny that Spring Batch Admin has a column for a field in their DSL that they forgot to add to their actual batch tables. Oops.

              Comment

              Working...
              X