Trigger a Java REST endpoint upon S3 File Upload Event

Viewed 1851

I have a Spring Batch application which does followings,

  1. A different application puts a csv file in a S3 bucket INBOUND
  2. Spring Batch application reads a csv file
  3. using data of each row, it calls an API endpoint and get a quote
  4. Put those quotes in a newly created csv and put in a S3 bucket OUTBOUND

Spring Batch Application Tech Stack

  • Created using Spring Boot

  • Spring Batch Job Launcher is called upon a REST endpoint

  • Deployed in OpenShift

What I want to do,

When the other application puts a new file into the S3 INBOUND bucket it needs to trigger the Spring Batch Operation (call the REST endpoint which launches the job)

Can I do this using a K8s Cron Job which triggered by S3 events? If so can someone please explain how? Or do I have any other options?

2 Answers

My solution was to create a lambda function which is triggered when a .txt file is uploaded into the S3 bucket's INBOUND folder.

Wrote a python handler to curl command to hit the job launcher REST end point.

Related