View kafka_test.partitioner02
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.apache.kafka.clients.producer.Producer; | |
import org.apache.kafka.clients.producer.ProducerRecord; | |
import org.apache.kafka.clients.producer.KafkaProducer; | |
import org.apache.kafka.clients.producer.RecordMetadata; | |
import java.util.Properties; | |
import java.util.concurrent.Future; | |
public class TestProducer { | |
private Producer<String, String> producer; | |
View kafka_test.partitioner01
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.List; | |
import java.util.Map; | |
import org.apache.kafka.clients.producer.Partitioner; | |
import org.apache.kafka.common.Cluster; | |
import org.apache.kafka.common.PartitionInfo; | |
public class TestPartitioner implements Partitioner{ | |
@Override | |
public void configure(Map<String, ?> arg0) { |
View spring_batch_test.partition_context02
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<bean id="ParameterSetter" class="test.reader.TestPartitionParameterSetter" scope="step"> | |
<property name="startParam" value="#{stepExecutionContext['StartDay']}"/> | |
<property name="endParam" value="#{stepExecutionContext['EndDay']}"/> | |
</bean> | |
<bean id="TestReader" | |
class="org.springframework.batch.item.database.JdbcCursorItemReader" | |
scope="step"> | |
<property name="dataSource" ref="testDataSource"/> | |
<property name="sql" |
View spring_batch_test.test_partitioner
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.HashMap; | |
import java.util.Map; | |
import org.springframework.batch.core.partition.support.Partitioner; | |
import org.springframework.batch.item.ExecutionContext; | |
public class DayOfWeekPartitioner implements Partitioner { | |
@Override | |
public Map<String, ExecutionContext> partition(int gridSize) { |
View spring_batch_test.partition_context01
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<batch:job id="TestPartitionJob" job-repository="jobRepository"> | |
<batch:step id="TestPartitionStep"> | |
<batch:partition step="SingleStep" partitioner="DayOfWeekPartitioner"> | |
<batch:handler grid-size="7" task-executor="TaskExecutor" /> | |
</batch:partition> | |
</batch:step> | |
</batch:job> | |
<bean id="DayOfWeekPartitioner" | |
class="test.reader.DayOfWeekPartitioner" |
View spring_batch_test.composite_writer2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<batch:job id="TestCompositeJob" job-repository="jobRepository"> | |
<batch:step id="SimpleStep"> | |
<batch:tasklet transaction-manager="testTransactionManager" allow-start-if-complete="true"> | |
<batch:chunk | |
reader="TestReader" | |
processor="TestProcessor" | |
writer="TestCompositeWriter" | |
commit-interval="1" | |
reader-transactional-queue="false" | |
/> |
View spring_batch_test.composite_writer1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<bean id="TestCompositeWriter" | |
class="org.springframework.batch.item.support.CompositeItemWriter" | |
scope="step"> | |
<property name="delegates"> | |
<list> | |
<ref bean="TestWriter1"/> | |
<ref bean="TestWriter2"/> | |
</list> | |
</property> | |
</bean> |
View spring_batch_test.target_vo01
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TargetVO { | |
public String new_col1; | |
public String new_col2; | |
public String new_col3; | |
public String getNewCol1() { | |
return this.new_col1; | |
} | |
public String getNewCol2() { |
View spring_batch_test.job_parameter01
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.springframework.context.ApplicationContext; | |
import org.springframework.context.support.ClassPathXmlApplicationContext; | |
import org.springframework.batch.core.Job; | |
import org.springframework.batch.core.launch.JobLauncher; | |
import org.springframework.batch.core.JobParameters; | |
import org.springframework.batch.core.JobParametersBuilder; | |
public class TestRun2_2 { | |
public static void main(String[] args) throws Exception{ |
View spring_batch_test.parameter_reader02
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<bean id="SourceMapper" | |
class="test.rowmapper.TbSourceMapper"/> | |
<bean id="ParameterSetter" class="test.reader.TestParameterSetter" scope="step"> | |
<property name="param" value="#{jobParameters['param1']}"/> | |
</bean> | |
<bean id="TestReader" | |
class="org.springframework.batch.item.database.JdbcCursorItemReader" | |
scope="step"> |
NewerOlder