Categories
Java Software development Technology

Spring batch, Spring Scheduler, PCF

Reading Time: < 1 minute

Was experimenting running scheduled job on PCF. One natural choice is PCF scheduler, which comes with the Pivotal Web Services (PAAS). Googled around and found this example on DZone. The spring batch code is here. There was a small typo in the manifest.yaml,

path: build/libs/payment-processing-spring-batch-0.0.1-SNAPSHOT.jar
Note the snapshot.jar file name does not match what’s specified in the build.gradle file.

The correct file name is

spring-batch-job-0.0.1-SNAPSHOT.jar

The rest of the manifest.yml looks good, in fact I used the following options for my spring scheduler app manifest.

no-hostname: true
no-route: true
health-check-type: none

But PCF scheduler is not available in our environment. The Spring Scheduler is used instead. I followed this Get Started Guide from Spring. In my case I need to use Cron Expression, here is the code sample and here is the guide to cron expression.

Last but not least, in my case I need to send out email notification for the cron job conditionally. I used the java email code sample here.

======

Some PCF references

pivotal web serivce

cf login -a https://api.run.pivotal.io/

https://console.run.pivotal.io/tools

https://docs.pivotal.io/pcf-dev/index.html

cf login -a api.local.pcfdev.io --skip-ssl-validation

https://tanzu.vmware.com/tutorials/getting-started/local/deploy-the-sample-app

Categories
401k and Personal Finance

GCP Cloud Storage and PCF

Reading Time: < 1 minute

Tried two two tutorials on my personal GCP.

hello world


cloud storage (upload a file, then return a public url for download; another download link)

I may delete those bucket and files later on, as hosting costs money (app engine, cloud storage). Update: I disabled the app (here is one article talking about disable / delete app engine app). In simple term: I go to project, app engine, go to settings, click disable. Btw, I noticed all 73 cents charges for about 20 hours is from app engine.

From GCP Console Dashboard, I saw Resource

App Engine
2 versions
Storage
4 buckets

GCP Service Broker

For PCF, the approach above did not work (got an error on line 61 on the example above). I followed the steps for GCP service broker and pushed it to our pcf.

Virus Scan

Automating malware scanning for documents uploaded to Cloud Storage

PCF Sample App

It looks like with the VMWare Pivotal acquisition / integration, their hello world sample app website also moved. Here is the new link.