@Override
 @Transactional
 public void writeItems(List<Object> items) throws Exception {
   try (PrintWriter archive =
       new PrintWriter(
           new BufferedWriter(
               new FileWriter(
                   new File(
                       jobContext.getProperties().getProperty(ARCHIVE_DIRECTORY)
                           + "/archive_"
                           + jobContext.getJobName()
                           + "_"
                           + jobContext.getInstanceId()
                           + ".csv"),
                   true)))) {
     for (Object item : items) {
       HandlingEventRegistrationAttempt attempt = (HandlingEventRegistrationAttempt) item;
       applicationEvents.receivedHandlingEventRegistrationAttempt(attempt);
       archive.println(
           attempt.getRegistrationTime()
               + ","
               + attempt.getCompletionTime()
               + ","
               + attempt.getTrackingId()
               + ","
               + attempt.getVoyageNumber()
               + ","
               + attempt.getUnLocode()
               + ","
               + attempt.getType());
     }
   }
 }
  @Override
  public void open(Serializable checkpoint) throws Exception {
    File archiveDirectory = new File(jobContext.getProperties().getProperty(ARCHIVE_DIRECTORY));

    if (!archiveDirectory.exists()) {
      archiveDirectory.mkdirs();
    }
  }
  @Override
  public String process() throws Exception {

    Properties properties = JobCtx.getProperties();
    String foo = properties.getProperty("foo");

    JobCtx.setExitStatus(foo);

    return GOOD_EXIT_STATUS;
  }