public boolean publishJobModel(JobModel prevJM, JobModel currJM, String prevJMV, String currJMV, String leaseId) {
    try {
      if (leaseId == null) {
        return false;
      }
      JobModelBundle bundle = new JobModelBundle(prevJM, currJM, prevJMV, currJMV);
      byte[] data = SamzaObjectMapper.getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsBytes(bundle);
      byte[] pageData = Arrays.copyOf(data, (int) JOB_MODEL_BLOCK_SIZE);
      InputStream is = new ByteArrayInputStream(pageData);
      blob.uploadPages(is, 0, JOB_MODEL_BLOCK_SIZE, AccessCondition.generateLeaseCondition(leaseId), null, null);
      LOG.info("Uploaded {} jobModel to blob", bundle.getCurrJobModel());
      return true;
    } catch (StorageException | IOException e) {
      LOG.error("JobModel publish failed for version = " + currJMV, e);
      return false;
    }
  }
Writes the job model to the blob.
Write is successful only if the lease ID passed is valid and the processor holds the lease.
Called by the leader.
@param prevJM Previous job model version that the processor was operating on.
@param currJM Current job model version that the processor is operating on.
@param prevJMV Previous job model version that the processor was operating on.
@param currJMV Current job model version that the processor is operating on.
@param leaseId LeaseID of the lease that the processor holds on the blob. Null if there is no lease.
@return true if write to the blob is successful, false if leaseID is null or an Azure storage service error or IO exception occurred.
samza-azure/src/main/java/org/apache/samza/util/BlobUtils.java