Skip to content

Instantly share code, notes, and snippets.

View mminella's full-sized avatar

Michael Minella mminella

View GitHub Profile
@mminella
mminella / Foo
Created July 12, 2019 17:38
Bean With Listener
@Bean
public Step step1() {
return this.stepBuilderFactory.get("step1")
.<Integer, Integer>chunk(10)
.reader(new ListItemReader<>(IntStream.rangeClosed(0, this.random.nextInt(10000))
.boxed().collect(Collectors.toList())))
.writer(list -> list.forEach(System.out::println))
.listener(new StepExecutionListener() {
@Override
public void beforeStep(StepExecution stepExecution) {
➜ spring-boot-transaction-manager-spring-batch git:(master) ✗ java -jar target/spring-boot-transaction-manager-spring-batch-1.5.6.RELEASE.jar
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.5.6.RELEASE)
@mminella
mminella / CloudFoundryTaskLauncher.java
Created May 12, 2016 19:58
CloudFoundryTaskLauncher
/*
* Copyright 2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@mminella
mminella / HexExampleApplication.java
Created March 16, 2016 15:02
Example Job for reading supplied .dat file
package com.example;
import java.util.Map;
import java.util.TreeMap;
import org.springframework.batch.core.Job;
import org.springframework.batch.core.Step;
import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
import org.springframework.batch.core.configuration.annotation.JobBuilderFactory;
import org.springframework.batch.core.configuration.annotation.StepBuilderFactory;
@mminella
mminella / log.txt
Created January 26, 2016 15:32
Java Remote Partitioning Log
➜ java-remote-partitioning git:(master) java -jar target/remote-partitioning-0.0.1-SNAPSHOT.jar
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.3.1.RELEASE)
package x98.batch;
import java.util.Properties;
import javax.batch.operations.JobOperator;
import javax.batch.runtime.BatchRuntime;
public class BatchRunner {
public static void main(String[] args) {
import groovy.json.JsonSlurper
def result = true
def slurper = new JsonSlurper()
def jsonPayload = null;
try {
jsonPayload = slurper.parseText(payload)
} catch (Exception e) {
return false;
@mminella
mminella / LastRunPersistenceTest.java
Last active November 10, 2015 12:59
Incremental Imports via Spring Batch
/*
* Copyright 2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@mminella
mminella / pom.xml
Created December 11, 2012 15:46
BATCH-1326
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.batch</groupId>
<artifactId>batch-1326</artifactId>
<version>0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Michael's Batch Junk Project</name>
<description>This project is for me to screw around in when needed</description>