Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Works as designed
    • Affects Version/s: 4.0_b85
    • Fix Version/s: None
    • Component/s: batch
    • Labels:
      None
    • Environment:

      Win 7, JDK 7

      Description

      Trying to use a batch property in a reader:

      @Named("entryReader")
      public class EntryReader extends AbstractItemReader {

      @Inject
      @BatchProperty(name = "file.url")
      String fileName;
      //...
      }

      Either defining it as

      <reader ref="entryReader" >
      <properties>
      <property name="file.url" value="#

      {jobParameters['file.url']}

      " />
      </properties>
      </reader>

      with

      JobOperator jo = BatchRuntime.getJobOperator();
      Properties jobParams = new Properties();
      jobParams.put("file.url", "testdata.txt");
      long jobId = jo.start("extract-cities", jobParams);

      nor directly defining it in the job.xml works.
      It always resolves to null.

      Try the example here:
      https://www.dropbox.com/s/zujizha4jhkhtzd/jbatchexample.zip

      The EntryReader is where the injection should take place.

        Activity

        Hide
        Mahesh Kannan added a comment -

        Closing this issue as the submitter has confirmed that this is indeed working

        Show
        Mahesh Kannan added a comment - Closing this issue as the submitter has confirmed that this is indeed working
        Hide
        myfear added a comment -

        That actually worked. Close please.

        Show
        myfear added a comment - That actually worked. Close please.
        Hide
        arunkumar_s added a comment -

        If you can use the inject variable(filename) for verifying values in the open() method of the Reader, rather than the constructor, then it returns the values from passed JobParameters.

        Show
        arunkumar_s added a comment - If you can use the inject variable(filename) for verifying values in the open() method of the Reader, rather than the constructor, then it returns the values from passed JobParameters.

          People

          • Assignee:
            Mahesh Kannan
            Reporter:
            myfear
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: