Tuesday, August 14, 2018

PCF tile - Overview


What is a PCF tile: 
A tile is a software package that can be deployed in PCF ops manager for the app developers to consume, A tile can be anything - can be a PCF hosted tile such as MySQL service, Autoscaler service or it can be a custom tile (for a service that you created). 

What does a tile package contain. 
  • Zip file (with .pivotal extension) containing bosh manifest and executables

When to create a tile:
  • Create and provision services for your system. 
  • Integrate a third party functionality - database, message broker etc., 

Tile generator: tool to create a tile. 
  • Input: 
    • Service, service broker, build pack, docker image etc., 
  • Output:
    • .pivotal file
  • Contains
    • Deployment scripts
    • Bosh release
    • Tile
    • Concourse CI
  • How to 
    • Tile init: 
      • Creates a shell. 
    • Tile build
      • Creates bosh release. 
  • Tile.yml
    • Create forms for customization. 

# Importing a tile into PCF ops manager
  • Import a pivotal file into the ops manager. 
  • Add the tile
  • Specify settings:
    • Availability zones, 
    • Form values that are specified in the tile.yml

And now you can use the tile. 


Wednesday, August 1, 2018

Spring scheduler - refresh


Schedulers are ways by which schedule a job to run at a predefined interval. 

Steps to implement scheduler
  1. Include @EnableScheduling in the Main configuration file. 
@SpringBootApplication
@EnableScheduling
public class BasicsApplication 

  1. Annotate with @Scheduled, specifying the criteria fixedRate. 

@Scheduled(fixedRate=5000)
public void displayScheduledTime() {
    System.out.println("The time is: " + dateFormat.format(new Date()));
    log.info("The time now is {} ", dateFormat.format(new Date()));
}


What else can you do using Spring schedulers. 

@Scheduled(fixedRate = 5000) 
  • Runs the job every 5 seconds by comparing with the start. 

@Scheduled(fixedDelay = 5000)
  • Runs the job by verifying with the delay instead of the start time. 

@Scheduled(initialDelay=10000, fixedRate = 500)
  • Waits for 10 seconds and then executes the method every 500 ms. 

@Scheduled(cron="*/5 * * * * MON-FRI")
  • Runs a scheduled cron job. 



@Async is a annotation which is used to indicate a method that it should be executed asynchronously.