锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲高清毛片一区二区,久久亚洲精品无码av,久久亚洲AV成人出白浆无码国产http://www.tkk7.com/paulwong/category/52669.htmlzh-cnTue, 23 Mar 2021 03:20:50 GMTTue, 23 Mar 2021 03:20:50 GMT60csv 鏂囦歡鎵撳紑涔辯爜錛屾湁鍝簺鏂規(guī)硶鍙互瑙e喅錛?/title><link>http://www.tkk7.com/paulwong/archive/2021/03/23/435832.html</link><dc:creator>paulwong</dc:creator><author>paulwong</author><pubDate>Tue, 23 Mar 2021 02:30:00 GMT</pubDate><guid>http://www.tkk7.com/paulwong/archive/2021/03/23/435832.html</guid><wfw:comment>http://www.tkk7.com/paulwong/comments/435832.html</wfw:comment><comments>http://www.tkk7.com/paulwong/archive/2021/03/23/435832.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/paulwong/comments/commentRss/435832.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/paulwong/services/trackbacks/435832.html</trackback:ping><description><![CDATA[Excel 鍦ㄨ鍙?csv 鐨勬椂鍊欐槸閫氳繃璇誨彇鏂囦歡澶翠笂鐨?bom 鏉ヨ瘑鍒紪鐮佺殑錛岃繖瀵艱嚧濡傛灉鎴戜滑鐢熸垚 csv 鏂囦歡鐨勫鉤鍙拌緭鍑烘棤 bom 澶寸紪鐮佺殑 csv 鏂囦歡錛堜緥濡?utf-8 錛屽湪鏍囧噯涓粯璁ゆ槸鍙互娌℃湁 bom 澶寸殑錛夛紝Excel 鍙兘鑷姩鎸夌収榛樿緙栫爜璇誨彇錛屼笉涓鑷村氨浼?xì)鍑虹庮C貢鐮侀棶棰樹(shù)簡(jiǎn)銆?br /><br />鎺屾彙浜?jiǎn)杩欑偣鐩镐俊湄曠爜宸簿l忔棤娉曢樆鎸℃垜浠墠榪涚殑姝ヤ紣浜?jiǎn)锛?xì)鍙渶灝嗕笉甯?bom 澶寸紪鐮佺殑 csv 鏂囦歡錛岀敤鏂囨湰緙栬緫鍣紙宸ュ叿闅忔剰錛屾帹鑽?notepad++ 錛夋墦寮騫惰漿鎹負(fù)甯?bom 鐨勭紪鐮佸艦寮忥紙鍏蜂綋緙栫爜鏂瑰紡闅忔剰錛夛紝闂瑙e喅銆?br /><br />褰撶劧錛屽鏋滀綘鏄儚鎴戜竴鏍風(fēng)殑鐮佸啘鍝ュ摜錛屽湪鐢熸垚 csv 鏂囦歡鐨勬椂鍊欏啓鍏?bom 澶存洿鐩存帴鐐癸紝鐢ㄦ埛浼?xì)鎰熻阿浣犵殑銆?br /><br />闄勫綍錛氬浜?utf-8 緙栫爜錛寀nicode 鏍囧噯涓槸娌℃湁 bom 瀹氫箟鐨勶紝寰蔣鍦ㄨ嚜宸辯殑 utf-8 鏍煎紡鐨勬枃鏈枃浠朵箣鍓嶅姞涓婁簡(jiǎn)EF BB BF涓変釜瀛楄妭浣滀負(fù)璇嗗埆姝ょ紪鐮佺殑 bom 澶達(dá)紝榪欎篃瑙i噴浜?jiǎn)湄?fù)鍟ュぇ閮ㄥ垎涔辯爜閮芥槸 utf-8 緙栫爜瀵艱嚧鐨勫師鍥?br /><br />SPRING BATCH涓敓鎴怌SV鏂囦歡鏃剁殑瑙e喅鏂規(guī)錛?br /><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #0000FF; ">new</span> FlatFileItemWriterBuilder<T>()<br />      .name(itemWriterName)<br />      .resource(outputResource)<br />      .lineAggregator(lineAggregator)<br />      .headerCallback(<br />      h -> {<br />               System.out.println(header);<br />               h.write('\uFEFF');<span style="color: #008000; ">//</span><span style="color: #008000; ">鍙渶鍔犺繖涓琛?/span><span style="color: #008000; "><br /></span>               h.write(header);<br />           }<br />      )<br />      .build();</div><br /><a target="_blank">https://stackoverflow.com/questions/48952319/send-csv-file-encoded-in-utf-8-with-bom-in-java</a><br /><img src ="http://www.tkk7.com/paulwong/aggbug/435832.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/paulwong/" target="_blank">paulwong</a> 2021-03-23 10:30 <a href="http://www.tkk7.com/paulwong/archive/2021/03/23/435832.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>SPRING BATCH涓璖TEP濡傛灉娌″姞TRANSACTION MANAGERhttp://www.tkk7.com/paulwong/archive/2020/03/16/435267.htmlpaulwongpaulwongMon, 16 Mar 2020 01:43:00 GMThttp://www.tkk7.com/paulwong/archive/2020/03/16/435267.htmlhttp://www.tkk7.com/paulwong/comments/435267.htmlhttp://www.tkk7.com/paulwong/archive/2020/03/16/435267.html#Feedback0http://www.tkk7.com/paulwong/comments/commentRss/435267.htmlhttp://www.tkk7.com/paulwong/services/trackbacks/435267.html
+------------+--------------+-------------+-----------------+------------------+--------------------+----------------+-----------+-------------------------
 | READ_COUNT | FILTER_COUNT | WRITE_COUNT | READ_SKIP_COUNT | WRITE_SKIP_COUNT | PROCESS_SKIP_COUNT | ROLLBACK_COUNT | EXIT_CODE | EXIT_MESSAGE
-+------------+--------------+-------------+-----------------+------------------+--------------------+----------------+-----------+-------------------------
 |          1 |            0 |           1 |               0 |                0 |                  0 |              0 | COMPLETED |
 |      30006 |            0 |       29947 |               0 |               59 |                  0 |             61 | COMPLETED | Waited for 101 results.

濡備笂闈㈢殑鎬繪暟鏄?0006錛屼絾COMMIT鐨勬繪暟鏄?9947錛屾湁59涓璺寵繃浜?jiǎn)銆?br />
鍥犳闇鍦⊿TEP涓婂姞TRANSACTION MANAGER.

https://stackoverflow.com/questions/42803941/spring-batch-incorrect-write-skip-count-issue



paulwong 2020-03-16 09:43 鍙戣〃璇勮
]]>
浣跨敤 Spring Batch 鏋勫緩浼佷笟綰ф壒澶勭悊搴旂敤-2http://www.tkk7.com/paulwong/archive/2020/03/06/435226.htmlpaulwongpaulwongFri, 06 Mar 2020 05:47:00 GMThttp://www.tkk7.com/paulwong/archive/2020/03/06/435226.htmlhttp://www.tkk7.com/paulwong/comments/435226.htmlhttp://www.tkk7.com/paulwong/archive/2020/03/06/435226.html#Feedback0http://www.tkk7.com/paulwong/comments/commentRss/435226.htmlhttp://www.tkk7.com/paulwong/services/trackbacks/435226.html闃呰鍏ㄦ枃

paulwong 2020-03-06 13:47 鍙戣〃璇勮
]]>
浣跨敤 Spring Batch 鏋勫緩浼佷笟綰ф壒澶勭悊搴旂敤-1http://www.tkk7.com/paulwong/archive/2020/03/06/435225.htmlpaulwongpaulwongFri, 06 Mar 2020 05:45:00 GMThttp://www.tkk7.com/paulwong/archive/2020/03/06/435225.htmlhttp://www.tkk7.com/paulwong/comments/435225.htmlhttp://www.tkk7.com/paulwong/archive/2020/03/06/435225.html#Feedback0http://www.tkk7.com/paulwong/comments/commentRss/435225.htmlhttp://www.tkk7.com/paulwong/services/trackbacks/435225.html闃呰鍏ㄦ枃

paulwong 2020-03-06 13:45 鍙戣〃璇勮
]]>
閰嶇疆SPRING BATCH涓殑JUNIT TESThttp://www.tkk7.com/paulwong/archive/2020/02/03/435063.htmlpaulwongpaulwongMon, 03 Feb 2020 08:47:00 GMThttp://www.tkk7.com/paulwong/archive/2020/02/03/435063.htmlhttp://www.tkk7.com/paulwong/comments/435063.htmlhttp://www.tkk7.com/paulwong/archive/2020/02/03/435063.html#Feedback0http://www.tkk7.com/paulwong/comments/commentRss/435063.htmlhttp://www.tkk7.com/paulwong/services/trackbacks/435063.html
    @Configuration
    public class BatchTestConfiguration {
        
        
        @Bean
        public JobLauncherTestUtils stoppedReportJobLauncherTestUtils(
                JobLauncher stoppedReportJobLauncher
        ) {
            return new JobLauncherTestUtils() {
                
                @Autowired
                public void setJobLauncher(JobLauncher stoppedReportJobLauncher) {
                    super.setJobLauncher(stoppedReportJobLauncher);
                }

                @Autowired
                public void setJob(Job stoppedReportJob) {
                    super.setJob(stoppedReportJob);
                }
                
            };
        }
    }




paulwong 2020-02-03 16:47 鍙戣〃璇勮
]]>
Transform RemoteChunk to remote with json format in Spring Batchhttp://www.tkk7.com/paulwong/archive/2020/01/21/435048.htmlpaulwongpaulwongTue, 21 Jan 2020 08:44:00 GMThttp://www.tkk7.com/paulwong/archive/2020/01/21/435048.htmlhttp://www.tkk7.com/paulwong/comments/435048.htmlhttp://www.tkk7.com/paulwong/archive/2020/01/21/435048.html#Feedback0http://www.tkk7.com/paulwong/comments/commentRss/435048.htmlhttp://www.tkk7.com/paulwong/services/trackbacks/435048.html
娉ㄦ剰姝ゅ浣跨敤鐨勬槸SPRING JACKSON錛岃屼笉鏄疛ACKSON銆備竴鑸槸鍦⊿PRING INTEGRATIONA妗嗘灦涓嬭漿鐨勩?br />
闇瑕佽嚜瀹氫箟Transformer錛?br />
JsonToChunkRequestTransformer.java
package com.frandorado.springbatchawsintegrationslave.transformer;

import java.io.IOException;
import java.util.Collection;
import java.util.Map;
import java.util.stream.IntStream;

import org.springframework.batch.core.ExitStatus;
import org.springframework.batch.core.StepContribution;
import org.springframework.batch.core.StepExecution;
import org.springframework.batch.integration.chunk.ChunkRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.integration.aws.support.AwsHeaders;
import org.springframework.integration.json.JsonToObjectTransformer;
import org.springframework.messaging.Message;
import org.springframework.stereotype.Component;

import com.amazonaws.services.sqs.AmazonSQSAsync;
import com.fasterxml.jackson.databind.ObjectMapper;

@Component
public class JsonToChunkRequestTransformer extends JsonToObjectTransformer {
    
    private static final String MESSAGE_GROUP_ID_HEADER = "message-group-id";
    
    @Autowired
    AmazonSQSAsync amazonSQSAsync;
    
    @Override
    protected Object doTransform(Message<?> message) throws Exception {
        // ACK
        ack(message);
        
        return this.getMessageBuilderFactory().withPayload(buildChunkRequest(message)).setHeader(MESSAGE_GROUP_ID_HEADER, "unique").build();
    }
    
    private ChunkRequest buildChunkRequest(Message<?> message) throws IOException {
        Map map = new ObjectMapper().readValue(message.getPayload().toString(), Map.class);
        Map stepContributionMap = (Map) map.get("stepContribution");
        Map exitStatusMap = (Map) stepContributionMap.get("exitStatus");
        
        StepContribution stepContribution = new StepContribution(new StepExecution("null", null));
        ExitStatus exitStatus = new ExitStatus((String) exitStatusMap.get("exitCode"), (String) exitStatusMap.get("exitDescription"));
        
        IntStream.range(0, (Integer) stepContributionMap.get("readCount")).forEach(e -> stepContribution.incrementReadCount());
        stepContribution.incrementWriteCount((Integer) stepContributionMap.get("writeCount"));
        stepContribution.incrementFilterCount((Integer) stepContributionMap.get("filterCount"));
        stepContribution.incrementReadSkipCount((Integer) stepContributionMap.get("readSkipCount"));
        IntStream.range(0, (Integer) stepContributionMap.get("writeSkipCount")).forEach(e -> stepContribution.incrementWriteSkipCount());
        IntStream.range(0, (Integer) stepContributionMap.get("processSkipCount"))
                .forEach(e -> stepContribution.incrementProcessSkipCount());
        stepContribution.setExitStatus(exitStatus);
        
        return new ChunkRequest((Integer) map.get("sequence"), (Collection) map.get("items"), (Integer) map.get("jobId"), stepContribution);
    }
    
    private void ack(Message<?> message) {
        String receiptHandle = message.getHeaders().get(AwsHeaders.RECEIPT_HANDLE, String.class);
        String queue = message.getHeaders().get(AwsHeaders.QUEUE, String.class);
        String queueUrl = amazonSQSAsync.getQueueUrl(queue).getQueueUrl();
        
        amazonSQSAsync.deleteMessage(queueUrl, receiptHandle);
    }
}


JsonToChunkResponseTransformer.java
package com.frandorado.springbatchawsintegrationmaster.transformer;

import java.io.IOException;
import java.util.Map;

import org.springframework.batch.core.StepContribution;
import org.springframework.batch.core.StepExecution;
import org.springframework.batch.integration.chunk.ChunkResponse;
import org.springframework.integration.json.JsonToObjectTransformer;
import org.springframework.messaging.Message;
import org.springframework.stereotype.Component;

import com.fasterxml.jackson.databind.ObjectMapper;

@Component
public class JsonToChunkResponseTransformer extends JsonToObjectTransformer {
    
    @Override
    protected Object doTransform(Message<?> message) throws Exception {
        return buildChunkResponse(message);
    }
    
    private ChunkResponse buildChunkResponse(Message<?> message) throws IOException {
        Map map = new ObjectMapper().readValue(message.getPayload().toString(), Map.class);
        
        Integer jobId = (Integer) map.get("jobId");
        Integer sequence = (Integer) map.get("sequence");
        String messageContent = (String) map.get("message");
        Boolean status = (Boolean) map.get("successful");
        
        StepContribution stepContribution = new StepContribution(new StepExecution("-", null));
        
        return new ChunkResponse(status, sequence, Long.valueOf(jobId), stepContribution, messageContent);
    }
}


榪樻湁涓縐嶆柟寮忥紝灝辨槸濡傛灉絎笁綾諱笉鏀寔杞琂SON錛屽嵆浠g爜閲屾病鏈塉ACKSON鐨勬敞瑙o紝鍙互閲囩敤MIXIN鐨勬柟寮忥細(xì)

StepExecutionJacksonMixIn.java
package org.springframework.cloud.dataflow.rest.client.support;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

import org.springframework.batch.core.StepExecution;

/**
 * Jackson MixIn for {
@link StepExecution} de-serialization.
 *
 * 
@author Gunnar Hillert
 * 
@since 1.0
 
*/
@JsonIgnoreProperties({ "jobExecution", "jobParameters", "jobExecutionId", "skipCount", "summary" })
public abstract class StepExecutionJacksonMixIn {

    @JsonCreator
    StepExecutionJacksonMixIn(@JsonProperty("stepName") String stepName) {
    }

}

鍦ㄩ厤緗枃浠朵腑娉ㄥ唽鎵嶈兘浣跨敤錛?br />
JacksonConfiguration.java
import java.util.Locale;
import java.util.TimeZone;

import org.springframework.batch.core.ExitStatus;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.JobInstance;
import org.springframework.batch.core.JobParameter;
import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.StepExecution;
import org.springframework.batch.item.ExecutionContext;
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.integration.support.json.Jackson2JsonObjectMapper;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.novacredit.bmb.batchmonitor.springbatch.common.batch.jackson.ISO8601DateFormatWithMilliSeconds;
import com.novacredit.bmb.batchmonitor.springbatch.common.batch.jackson.mixin.ExecutionContextJacksonMixIn;
import com.novacredit.bmb.batchmonitor.springbatch.common.batch.jackson.mixin.ExitStatusJacksonMixIn;
import com.novacredit.bmb.batchmonitor.springbatch.common.batch.jackson.mixin.JobExecutionJacksonMixIn;
import com.novacredit.bmb.batchmonitor.springbatch.common.batch.jackson.mixin.JobInstanceJacksonMixIn;
import com.novacredit.bmb.batchmonitor.springbatch.common.batch.jackson.mixin.JobParameterJacksonMixIn;
import com.novacredit.bmb.batchmonitor.springbatch.common.batch.jackson.mixin.JobParametersJacksonMixIn;
import com.novacredit.bmb.batchmonitor.springbatch.common.batch.jackson.mixin.StepExecutionJacksonMixIn;

@Configuration
public class JacksonConfiguration {

    @Bean
    public Jackson2JsonObjectMapper jackson2JsonObjectMapper(ObjectMapper objectMapper) {
        return new Jackson2JsonObjectMapper(objectMapper);
    }
    
    @Bean
    public Jackson2ObjectMapperBuilderCustomizer dataflowObjectMapperBuilderCustomizer() {
        return (builder) -> {
            builder.dateFormat(new ISO8601DateFormatWithMilliSeconds(TimeZone.getDefault(), Locale.getDefault(), true));
            // apply SCDF Batch Mixins to
            
// ignore the JobExecution in StepExecution to prevent infinite loop.
            
// https://github.com/spring-projects/spring-hateoas/issues/333
            builder.mixIn(StepExecution.class, StepExecutionJacksonMixIn.class);
            builder.mixIn(ExecutionContext.class, ExecutionContextJacksonMixIn.class);
            builder.mixIn(JobExecution.class, JobExecutionJacksonMixIn.class);
            builder.mixIn(JobParameters.class, JobParametersJacksonMixIn.class);
            builder.mixIn(JobParameter.class, JobParameterJacksonMixIn.class);
            builder.mixIn(JobInstance.class, JobInstanceJacksonMixIn.class);
//            builder.mixIn(StepExecutionHistory.class, StepExecutionHistoryJacksonMixIn.class);
            builder.mixIn(ExecutionContext.class, ExecutionContextJacksonMixIn.class);
            builder.mixIn(ExitStatus.class, ExitStatusJacksonMixIn.class);
//            objectMapper.setDateFormat(new ISO8601DateFormatWithMilliSeconds());
            builder.modules(new JavaTimeModule(), new Jdk8Module());
        };
    }
}

    @Bean
    public IntegrationFlow flow4Contribution(
            ConnectionFactory connectionFactory, 
            JobProperties jobProperties,
            Jackson2JsonObjectMapper jackson2JsonObjectMapper
    ) {
        return IntegrationFlows
                    .from(request4ContributionMaster())
                    .enrichHeaders(headerEnricherConfigurer())
                    .transform(Transformers.toJson(jackson2JsonObjectMapper))
                    .handle(jmsOutboundGateway4Contribution(connectionFactory, jobProperties))
                    .transform(Transformers.fromJson(StepExecution.class, jackson2JsonObjectMapper))
                    .channel(replies4ContributionMaster(null))
                    .get();
    }


https://github.com/spring-cloud/spring-cloud-dataflow/tree/master/spring-cloud-dataflow-rest-client/src/main/java/org/springframework/cloud/dataflow/rest/client/support

https://frandorado.github.io/spring/2019/07/29/spring-batch-aws-series-introduction.html

https://github.com/frandorado/spring-projects/tree/master/spring-batch-aws-integration/spring-batch-aws-integration-master/src/main/java/com/frandorado/springbatchawsintegrationmaster/transformer


https://github.com/frandorado/spring-projects/tree/master/spring-batch-aws-integration/spring-batch-aws-integration-slave/src/main/java/com/frandorado/springbatchawsintegrationslave/transformer

paulwong 2020-01-21 16:44 鍙戣〃璇勮
]]>
Spring Batch JUnit test for multiple jobshttp://www.tkk7.com/paulwong/archive/2019/07/31/434326.htmlpaulwongpaulwongWed, 31 Jul 2019 02:48:00 GMThttp://www.tkk7.com/paulwong/archive/2019/07/31/434326.htmlhttp://www.tkk7.com/paulwong/comments/434326.htmlhttp://www.tkk7.com/paulwong/archive/2019/07/31/434326.html#Feedback0http://www.tkk7.com/paulwong/comments/commentRss/434326.htmlhttp://www.tkk7.com/paulwong/services/trackbacks/434326.htmlhttps://stackoverflow.com/questions/34217101/spring-batch-junit-test-for-multiple-jobs

@Configuration
public class TestBatchConfiguration implements MergedBeanDefinitionPostProcessor {

    @Autowired
    @Qualifier("JobA")
    private Job job;

    @Bean(name="jtestl")
    public JobLauncherTestUtils jobLauncherTestUtils() {
        JobLauncherTestUtils jobLauncherTestUtils = new JobLauncherTestUtils();
        jobLauncherTestUtils.setJob(job);
        return jobLauncherTestUtils;
    }

    /**
     * 
https://stackoverflow.com/questions/22416140/autowire-setter-override-with-java-config
     * This is needed to inject the correct job into JobLauncherTestUtils
     
*/
    @Override
    public void postProcessMergedBeanDefinition(RootBeanDefinition beanDefinition, Class<?> beanType, String beanName) {
        if(beanName.equals("jtestl")) {
            beanDefinition.getPropertyValues().add("job", getMyBeanFirstAImpl());
        }
    }

    private Object getMyBeanFirstAImpl() {
        return job;
    }

    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
        return bean;
    }

    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        return bean;
    }
}


paulwong 2019-07-31 10:48 鍙戣〃璇勮
]]>
SPRING BATCH & SPRING INTEGRATION TUTORIALhttp://www.tkk7.com/paulwong/archive/2019/07/18/434230.htmlpaulwongpaulwongThu, 18 Jul 2019 05:21:00 GMThttp://www.tkk7.com/paulwong/archive/2019/07/18/434230.htmlhttp://www.tkk7.com/paulwong/comments/434230.htmlhttp://www.tkk7.com/paulwong/archive/2019/07/18/434230.html#Feedback0http://www.tkk7.com/paulwong/comments/commentRss/434230.htmlhttp://www.tkk7.com/paulwong/services/trackbacks/434230.html

Spring JMS Artemis Example 6 minute read

A detailed step-by-step tutorial on how to connect to Apache ActiveMQ Artemis using Spring JMS and Spring Boot.

Spring JMS Topic Example 5 minute read

A detailed step-by-step tutorial on how to publish/subscribe to a JMS topic using Spring JMS and Spring Boot.

Spring JMS Integration Example12 minute read

A detailed step-by-step tutorial on how to connect to an ActiveMQ JMS broker using Spring Integration and Spring Boot.

Spring JMS Listener Example 7 minute read

A detailed step-by-step tutorial on how a Spring JMS listener works in combination with Spring Boot.

Spring JMS JmsTemplate Example 7 minute read

A detailed step-by-step tutorial on how to use JmsTemplate in combination with Spring JMS and Spring Boot.

Spring JMS Message Converter Example5 minute read

A detailed step-by-step tutorial on how to implement a message converter using Spring JMS and Spring Boot.

Spring Batch Admin Example 11 minute read

A detailed step-by-step tutorial on how to use a Spring Boot admin UI to manage Spring Batch jobs.

Spring Batch Example 11 minute read

A detailed step-by-step tutorial on how to implement a Hello World Spring Batch job using Spring Boot.



paulwong 2019-07-18 13:21 鍙戣〃璇勮
]]>
SPRING BATCH remote chunking妯″紡涓嬪彲鍚屾椂澶勭悊澶氭枃浠?/title><link>http://www.tkk7.com/paulwong/archive/2019/07/16/434210.html</link><dc:creator>paulwong</dc:creator><author>paulwong</author><pubDate>Tue, 16 Jul 2019 06:38:00 GMT</pubDate><guid>http://www.tkk7.com/paulwong/archive/2019/07/16/434210.html</guid><wfw:comment>http://www.tkk7.com/paulwong/comments/434210.html</wfw:comment><comments>http://www.tkk7.com/paulwong/archive/2019/07/16/434210.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/paulwong/comments/commentRss/434210.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/paulwong/services/trackbacks/434210.html</trackback:ping><description><![CDATA[<div>SPRING BATCH remote chunking妯″紡涓嬶紝濡傛灉瑕佸悓涓鏃墮棿澶勭悊澶氫釜鏂囦歡錛屾寜DEMO鐨勯粯璁ら厤緗紝鏄細(xì)鎶ラ敊鐨勶紝榪欐槸鐢變簬澶氫釜鏂囦歡鐨勫鐞嗙殑MASTER鏂癸紝鏄敤鍚屼竴涓猀UEUE鍚嶏紝榪欐牱SLAVE涓鐞嗗涓狫OB INSTANCE鏃訛紝浼?xì)杩斿洖涓嶅悓鐨凧OB-INSTANCE-ID錛屽鑷存姤閿欍?br /> <br /> 榪欐椂闇鏇存敼SPRING BATCH浣跨敤SPRING INTEGRATION鐨勬ā寮忎腑鐨凣ATEWAY緇勪歡銆?br /> <br /> GATEWAY緇勪歡鏄伐浣滃湪REQUEST/RESPONSE妯″紡涓嬶紝鍗沖彂涓涓狹ESSAGE鍒版煇涓QUEUE鏃訛紝瑕佷粠REPLY QUEUE絳夊埌CONSUMER榪斿洖緇撴灉鏃訛紝鎵嶅線(xiàn)涓嬬戶(hù)緇?br /> <br /> OUTBOUND GATEWAY錛氫粠鏌愪竴CHANNEL鑾峰彇MESSAGE錛屽彂寰(xiàn)REQUEST QUEUE錛屼粠REPLY QUEUE絳夊埌CONSUMER榪斿洖緇撴灉錛屽皢姝ESSAGE鍙戝線(xiàn)涓嬩竴CHANNEL銆?br /> <br /> INBOUND GATEWAY錛氫粠鏌愪竴QUEUE鑾峰彇MESSAGE錛屽彂寰(xiàn)鏌愪竴REQUEST CHANNEL錛屼粠REPLY CHANNEL絳夊埌榪斿洖緇撴灉錛屽皢姝ESSAGE鍙戝線(xiàn)涓嬩竴QUEUE銆?br /> <br /> 璇︽儏鍙傝姝ゆ枃錛?a target="_blank">https://blog.csdn.net/alexlau8/article/details/78056064</a>銆?br /> <br /> <div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> -->    <span style="color: #008000; "><!--</span><span style="color: #008000; "> Master jms </span><span style="color: #008000; ">--></span><br />     <span style="color: #0000FF; "><</span><span style="color: #800000; ">int:channel </span><span style="color: #FF0000; ">id</span><span style="color: #0000FF; ">="MasterRequestChannel"</span><span style="color: #0000FF; ">></span><br />         <span style="color: #0000FF; "><</span><span style="color: #800000; ">int:dispatcher </span><span style="color: #FF0000; ">task-executor</span><span style="color: #0000FF; ">="RequestPublishExecutor"</span><span style="color: #0000FF; ">/></span><br />     <span style="color: #0000FF; "></</span><span style="color: #800000; ">int:channel</span><span style="color: #0000FF; ">></span><br />     <span style="color: #0000FF; "><</span><span style="color: #800000; ">task:executor </span><span style="color: #FF0000; ">id</span><span style="color: #0000FF; ">="RequestPublishExecutor"</span><span style="color: #FF0000; "> pool-size</span><span style="color: #0000FF; ">="5-10"</span><span style="color: #FF0000; "> queue-capacity</span><span style="color: #0000FF; ">="0"</span><span style="color: #0000FF; ">/></span><br /> <span style="color: #008000; "><!--</span><span style="color: #008000; ">    <int-jms:outbound-channel-adapter <br />         connection-factory="connectionFactory" <br />         destination-name="RequestQueue" <br />         channel="MasterRequestChannel"/> </span><span style="color: #008000; ">--></span><br /> <br />     <span style="color: #0000FF; "><</span><span style="color: #800000; ">int:channel </span><span style="color: #FF0000; ">id</span><span style="color: #0000FF; ">="MasterReplyChannel"</span><span style="color: #0000FF; ">/></span><br /> <span style="color: #008000; "><!--</span><span style="color: #008000; ">    <int-jms:message-driven-channel-adapter <br />         connection-factory="connectionFactory" <br />         destination-name="ReplyQueue"<br />         channel="MasterReplyChannel"/> </span><span style="color: #008000; ">--></span><br /> <br />     <span style="color: #0000FF; "><</span><span style="color: #800000; ">int-jms:outbound-gateway<br />         </span><span style="color: #FF0000; ">connection-factory</span><span style="color: #0000FF; ">="connectionFactory"</span><span style="color: #FF0000; "><br />         correlation-key</span><span style="color: #0000FF; ">="JMSCorrelationID"</span><span style="color: #FF0000; "><br />         request-channel</span><span style="color: #0000FF; ">="MasterRequestChannel"</span><span style="color: #FF0000; "><br />         request-destination-name</span><span style="color: #0000FF; ">="RequestQueue"</span><span style="color: #FF0000; "><br />         receive-timeout</span><span style="color: #0000FF; ">="30000"</span><span style="color: #FF0000; "><br />         reply-channel</span><span style="color: #0000FF; ">="MasterReplyChannel"</span><span style="color: #FF0000; "><br />         reply-destination-name</span><span style="color: #0000FF; ">="ReplyQueue"</span><span style="color: #FF0000; "><br />         async</span><span style="color: #0000FF; ">="true"</span><span style="color: #0000FF; ">></span><br />         <span style="color: #0000FF; "><</span><span style="color: #800000; ">int-jms:reply-listener </span><span style="color: #0000FF; ">/></span><br />     <span style="color: #0000FF; "></</span><span style="color: #800000; ">int-jms:outbound-gateway</span><span style="color: #0000FF; ">></span><br /> <br />     <span style="color: #008000; "><!--</span><span style="color: #008000; "> Slave jms </span><span style="color: #008000; ">--></span><br />     <span style="color: #0000FF; "><</span><span style="color: #800000; ">int:channel </span><span style="color: #FF0000; ">id</span><span style="color: #0000FF; ">="SlaveRequestChannel"</span><span style="color: #0000FF; ">/></span><br /> <span style="color: #008000; "><!--</span><span style="color: #008000; ">    <int-jms:message-driven-channel-adapter<br />         connection-factory="connectionFactory" <br />         destination-name="RequestQueue"<br />         channel="SlaveRequestChannel"/> </span><span style="color: #008000; ">--></span><br /> <br />     <span style="color: #0000FF; "><</span><span style="color: #800000; ">int:channel </span><span style="color: #FF0000; ">id</span><span style="color: #0000FF; ">="SlaveReplyChannel"</span><span style="color: #0000FF; ">/></span><br /> <span style="color: #008000; "><!--</span><span style="color: #008000; ">    <int-jms:outbound-channel-adapter <br />         connection-factory="connectionFactory" <br />         destination-name="ReplyQueue"<br />         channel="SlaveReplyChannel"/> </span><span style="color: #008000; ">--></span><br /> <br />     <span style="color: #0000FF; "><</span><span style="color: #800000; ">int-jms:inbound-gateway<br />         </span><span style="color: #FF0000; ">connection-factory</span><span style="color: #0000FF; ">="connectionFactory"</span><span style="color: #FF0000; "><br />         correlation-key</span><span style="color: #0000FF; ">="JMSCorrelationID"</span><span style="color: #FF0000; "><br />         request-channel</span><span style="color: #0000FF; ">="SlaveRequestChannel"</span><span style="color: #FF0000; "><br />         request-destination-name</span><span style="color: #0000FF; ">="RequestQueue"</span><span style="color: #FF0000; "><br />         reply-channel</span><span style="color: #0000FF; ">="SlaveReplyChannel"</span><span style="color: #FF0000; "><br />         default-reply-queue-name</span><span style="color: #0000FF; ">="ReplyQueue"</span><span style="color: #0000FF; ">/></span></div> </div><br /> MASTER閰嶇疆<br /> <div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><span style="color: #0000FF; ">package</span> com.paul.testspringbatch.config.master;<br /> <br /> <span style="color: #0000FF; ">import</span> javax.jms.ConnectionFactory;<br /> <br /> <span style="color: #0000FF; ">import</span> org.springframework.beans.factory.config.CustomScopeConfigurer;<br /> <span style="color: #008000; ">//</span><span style="color: #008000; ">import org.springframework.batch.core.configuration.annotation.StepScope;</span><span style="color: #008000; "><br /> </span><span style="color: #0000FF; ">import</span> org.springframework.context.annotation.Bean;<br /> <span style="color: #0000FF; ">import</span> org.springframework.context.annotation.Configuration;<br /> <span style="color: #0000FF; ">import</span> org.springframework.context.annotation.Profile;<br /> <span style="color: #0000FF; ">import</span> org.springframework.context.annotation.Scope;<br /> <span style="color: #0000FF; ">import</span> org.springframework.context.support.SimpleThreadScope;<br /> <span style="color: #0000FF; ">import</span> org.springframework.integration.channel.DirectChannel;<br /> <span style="color: #0000FF; ">import</span> org.springframework.integration.channel.QueueChannel;<br /> <span style="color: #0000FF; ">import</span> org.springframework.integration.config.EnableIntegration;<br /> <span style="color: #0000FF; ">import</span> org.springframework.integration.dsl.IntegrationFlow;<br /> <span style="color: #0000FF; ">import</span> org.springframework.integration.dsl.IntegrationFlows;<br /> <span style="color: #0000FF; ">import</span> org.springframework.integration.jms.JmsOutboundGateway;<br /> <br /> <span style="color: #0000FF; ">import</span> com.paul.testspringbatch.common.constant.IntegrationConstant;<br /> <br /> @Configuration<br /> @EnableIntegration<br /> @Profile("batch-master")<br /> <span style="color: #0000FF; ">public</span> <span style="color: #0000FF; ">class</span> IntegrationMasterConfiguration {<br />     <br /> <span style="color: #008000; ">//</span><span style="color: #008000; ">    @Value("${broker.url}")<br /> </span><span style="color: #008000; ">//</span><span style="color: #008000; ">    private String brokerUrl;<br /> <br /> <br /> </span><span style="color: #008000; ">//</span><span style="color: #008000; ">    @Bean<br /> </span><span style="color: #008000; ">//</span><span style="color: #008000; ">    public ActiveMQConnectionFactory connectionFactory() {<br /> </span><span style="color: #008000; ">//</span><span style="color: #008000; ">        ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory();<br /> </span><span style="color: #008000; ">//</span><span style="color: #008000; ">        connectionFactory.setBrokerURL(this.brokerUrl);<br /> </span><span style="color: #008000; ">//</span><span style="color: #008000; ">        connectionFactory.setTrustAllPackages(true);<br /> </span><span style="color: #008000; ">//</span><span style="color: #008000; ">        return connectionFactory;<br /> </span><span style="color: #008000; ">//</span><span style="color: #008000; ">    }</span><span style="color: #008000; "><br /> </span><br />     <span style="color: #008000; ">/*</span><span style="color: #008000; "><br />      * Configure outbound flow (requests going to workers)<br />      </span><span style="color: #008000; ">*/</span><br />     @Bean<br /> <span style="color: #008000; ">//</span><span style="color: #008000; ">    @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)</span><span style="color: #008000; "><br /> </span>    <span style="color: #0000FF; ">public</span> DirectChannel requests() {<br />         <span style="color: #0000FF; ">return</span> <span style="color: #0000FF; ">new</span> DirectChannel();<br />     }<br /> <br /> <span style="color: #008000; ">//</span><span style="color: #008000; ">    @Bean<br /> </span><span style="color: #008000; ">//</span><span style="color: #008000; ">    public IntegrationFlow outboundFlow(ConnectionFactory connectionFactory) {<br /> </span><span style="color: #008000; ">//</span><span style="color: #008000; ">        return IntegrationFlows<br /> </span><span style="color: #008000; ">//</span><span style="color: #008000; ">                .from(requests())<br /> </span><span style="color: #008000; ">//</span><span style="color: #008000; ">                .handle(Jms.outboundAdapter(connectionFactory).destination(IntegrationConstant.MASTER_REQUEST_DESTINATION))<br /> </span><span style="color: #008000; ">//</span><span style="color: #008000; ">                .get();<br /> </span><span style="color: #008000; ">//</span><span style="color: #008000; ">    }</span><span style="color: #008000; "><br /> </span>    <br />      @Bean<br />      <span style="color: #0000FF; ">public</span> CustomScopeConfigurer customScopeConfigurer() {<br />          CustomScopeConfigurer customScopeConfigurer = <span style="color: #0000FF; ">new</span> CustomScopeConfigurer();<br />          customScopeConfigurer.addScope("thread", <span style="color: #0000FF; ">new</span> SimpleThreadScope());<br />          <span style="color: #0000FF; ">return</span> customScopeConfigurer;<br />      }<br />      <br /> <span style="color: #008000; ">//</span><span style="color: #008000; ">     @Bean<br /> </span><span style="color: #008000; ">//</span><span style="color: #008000; ">     public static BeanFactoryPostProcessor beanFactoryPostProcessor() {<br /> </span><span style="color: #008000; ">//</span><span style="color: #008000; ">         return new BeanFactoryPostProcessor() {<br /> </span><span style="color: #008000; ">//</span><span style="color: #008000; ">                <br /> </span><span style="color: #008000; ">//</span><span style="color: #008000; ">             @Override<br /> </span><span style="color: #008000; ">//</span><span style="color: #008000; ">             public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {<br /> </span><span style="color: #008000; ">//</span><span style="color: #008000; ">                    beanFactory.registerScope("thread", new SimpleThreadScope());<br /> </span><span style="color: #008000; ">//</span><span style="color: #008000; ">                }<br /> </span><span style="color: #008000; ">//</span><span style="color: #008000; ">              };<br /> </span><span style="color: #008000; ">//</span><span style="color: #008000; ">     }</span><span style="color: #008000; "><br /> </span>    <br />     <span style="color: #008000; ">/*</span><span style="color: #008000; "><br />      * Configure inbound flow (replies coming from workers)<br />      </span><span style="color: #008000; ">*/</span><br />     @Bean<br />     @Scope(value = "thread"<span style="color: #008000; ">/*</span><span style="color: #008000; "> , proxyMode = ScopedProxyMode.NO </span><span style="color: #008000; ">*/</span>)<br /> <span style="color: #008000; ">//</span><span style="color: #008000; ">    @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)</span><span style="color: #008000; "><br /> </span>    <span style="color: #0000FF; ">public</span> QueueChannel replies() {<br />         <span style="color: #0000FF; ">return</span> <span style="color: #0000FF; ">new</span> QueueChannel();<br />     }<br /> <br /> <span style="color: #008000; ">//</span><span style="color: #008000; ">    @Bean<br /> </span><span style="color: #008000; ">//</span><span style="color: #008000; ">    public IntegrationFlow inboundFlow(ConnectionFactory connectionFactory) {<br /> </span><span style="color: #008000; ">//</span><span style="color: #008000; ">        return IntegrationFlows<br /> </span><span style="color: #008000; ">//</span><span style="color: #008000; ">                .from(Jms.messageDrivenChannelAdapter(connectionFactory).destination(IntegrationConstant.MASTER_REPLY_DESTINATION))<br /> </span><span style="color: #008000; ">//</span><span style="color: #008000; ">                .channel(replies())<br /> </span><span style="color: #008000; ">//</span><span style="color: #008000; ">                .get();<br /> </span><span style="color: #008000; ">//</span><span style="color: #008000; ">    }</span><span style="color: #008000; "><br /> </span><br />     @Bean<br />     <span style="color: #0000FF; ">public</span> JmsOutboundGateway jmsOutboundGateway(ConnectionFactory connectionFactory) {<br />         JmsOutboundGateway jmsOutboundGateway = <span style="color: #0000FF; ">new</span> JmsOutboundGateway();<br />         jmsOutboundGateway.setConnectionFactory(connectionFactory);<br />         jmsOutboundGateway.setRequestDestinationName(IntegrationConstant.MASTER_REQUEST_DESTINATION);<span style="color: #008000; ">//</span><span style="color: #008000; ">2. send the message to this destination</span><span style="color: #008000; "><br /> </span>        jmsOutboundGateway.setRequiresReply(<span style="color: #0000FF; ">true</span>);<br />         jmsOutboundGateway.setCorrelationKey(IntegrationConstant.JMS_CORRELATION_KEY);<span style="color: #008000; ">//</span><span style="color: #008000; ">3. let the broker filter the message</span><span style="color: #008000; "><br /> </span>        jmsOutboundGateway.setAsync(<span style="color: #0000FF; ">true</span>);<span style="color: #008000; ">//</span><span style="color: #008000; ">must be async, so that JMS_CORRELATION_KEY work</span><span style="color: #008000; "><br /> </span>        jmsOutboundGateway.setUseReplyContainer(<span style="color: #0000FF; ">true</span>);<br />         jmsOutboundGateway.setReplyDestinationName(IntegrationConstant.MASTER_REPLY_DESTINATION);<span style="color: #008000; ">//</span><span style="color: #008000; ">4. waiting the response from this destination</span><span style="color: #008000; "><br /> </span>        jmsOutboundGateway.setReceiveTimeout(30_000);<br />         <span style="color: #0000FF; ">return</span> jmsOutboundGateway;<br />     }<br /> <br />     @Bean<br />     <span style="color: #0000FF; ">public</span> IntegrationFlow jmsOutboundGatewayFlow(ConnectionFactory connectionFactory) {<br />         <span style="color: #0000FF; ">return</span> IntegrationFlows<br />                         .from(requests())<span style="color: #008000; ">//</span><span style="color: #008000; ">1. receive message from this channel</span><span style="color: #008000; "><br /> </span>                        .handle(jmsOutboundGateway(connectionFactory))<br />                         .channel(replies())<span style="color: #008000; ">//</span><span style="color: #008000; ">5. send back the response to this channel</span><span style="color: #008000; "><br /> </span>                        .get();<br />     }<br /> <br /> }</div><br /><br />SLAVE閰嶇疆錛?br /><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #0000FF; ">package</span> com.paul.testspringbatch.config.slave;<br /><br /><span style="color: #0000FF; ">import</span> javax.jms.ConnectionFactory;<br /><br /><span style="color: #0000FF; ">import</span> org.springframework.context.annotation.Bean;<br /><span style="color: #0000FF; ">import</span> org.springframework.context.annotation.Configuration;<br /><span style="color: #0000FF; ">import</span> org.springframework.context.annotation.Profile;<br /><span style="color: #0000FF; ">import</span> org.springframework.integration.channel.DirectChannel;<br /><span style="color: #0000FF; ">import</span> org.springframework.integration.config.EnableIntegration;<br /><span style="color: #0000FF; ">import</span> org.springframework.integration.dsl.IntegrationFlow;<br /><span style="color: #0000FF; ">import</span> org.springframework.integration.dsl.IntegrationFlows;<br /><span style="color: #0000FF; ">import</span> org.springframework.integration.jms.dsl.Jms;<br /><br /><span style="color: #0000FF; ">import</span> com.paul.testspringbatch.common.constant.IntegrationConstant;<br /><br />@Configuration<br />@EnableIntegration<br />@Profile("batch-slave")<br /><span style="color: #0000FF; ">public</span> <span style="color: #0000FF; ">class</span> IntegrationSlaveConfiguration {<br />    <br /><br />    <span style="color: #008000; ">/*</span><span style="color: #008000; "><br />     * Configure inbound flow (requests coming from the master)<br />     </span><span style="color: #008000; ">*/</span><br />    @Bean<br />    <span style="color: #0000FF; ">public</span> DirectChannel requests() {<br />        <span style="color: #0000FF; ">return</span> <span style="color: #0000FF; ">new</span> DirectChannel();<br />    }<br /><br /><span style="color: #008000; ">//</span><span style="color: #008000; ">    @Bean<br /></span><span style="color: #008000; ">//</span><span style="color: #008000; ">    public IntegrationFlow inboundFlow(ConnectionFactory connectionFactory) {<br /></span><span style="color: #008000; ">//</span><span style="color: #008000; ">        return IntegrationFlows<br /></span><span style="color: #008000; ">//</span><span style="color: #008000; ">                .from(Jms.messageDrivenChannelAdapter(connectionFactory).destination("requests"))<br /></span><span style="color: #008000; ">//</span><span style="color: #008000; ">                .channel(requests())<br /></span><span style="color: #008000; ">//</span><span style="color: #008000; ">                .get();<br /></span><span style="color: #008000; ">//</span><span style="color: #008000; ">    }</span><span style="color: #008000; "><br /></span><br />    <span style="color: #008000; ">/*</span><span style="color: #008000; "><br />     * Configure outbound flow (replies going to the master)<br />     </span><span style="color: #008000; ">*/</span><br />    @Bean<br />    <span style="color: #0000FF; ">public</span> DirectChannel replies() {<br />        <span style="color: #0000FF; ">return</span> <span style="color: #0000FF; ">new</span> DirectChannel();<br />    }<br /><br /><span style="color: #008000; ">//</span><span style="color: #008000; ">    @Bean<br /></span><span style="color: #008000; ">//</span><span style="color: #008000; ">    public IntegrationFlow outboundFlow(ConnectionFactory connectionFactory) {<br /></span><span style="color: #008000; ">//</span><span style="color: #008000; ">        return IntegrationFlows<br /></span><span style="color: #008000; ">//</span><span style="color: #008000; ">                .from(replies())<br /></span><span style="color: #008000; ">//</span><span style="color: #008000; ">                .handle(Jms.outboundAdapter(connectionFactory).destination("replies"))<br /></span><span style="color: #008000; ">//</span><span style="color: #008000; ">                .get();<br /></span><span style="color: #008000; ">//</span><span style="color: #008000; ">    }</span><span style="color: #008000; "><br /></span><br />    @Bean<br />    <span style="color: #0000FF; ">public</span> IntegrationFlow inboundGatewayFlow(ConnectionFactory connectionFactory) {<br />        <span style="color: #0000FF; ">return</span> IntegrationFlows<br />                    .from(Jms<br />                            .inboundGateway(connectionFactory)<br />                            .destination(IntegrationConstant.SLAVE_HANDLE_MASTER_REQUEST_DESTINATION)<span style="color: #008000; ">//</span><span style="color: #008000; ">1. receive message from this channel.</span><span style="color: #008000; "><br /></span>                            .correlationKey(IntegrationConstant.JMS_CORRELATION_KEY)<span style="color: #008000; ">//</span><span style="color: #008000; ">2. let the broker filter the message</span><span style="color: #008000; "><br /></span>                            .requestChannel(requests())<span style="color: #008000; ">//</span><span style="color: #008000; ">3. send the message to this channel</span><span style="color: #008000; "><br /></span>                            .replyChannel(replies())<span style="color: #008000; ">//</span><span style="color: #008000; ">4. waitting the result from this channel</span><span style="color: #008000; "><br /></span>                            .defaultReplyQueueName(IntegrationConstant.SLAVE_RETURN_RESULT_DESTINATION)<span style="color: #008000; ">//</span><span style="color: #008000; ">5.send back the result to this destination to the master.</span><span style="color: #008000; "><br /></span>                            )<br />                    .get();<br />    }<br /><br />}</div><img src ="http://www.tkk7.com/paulwong/aggbug/434210.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/paulwong/" target="_blank">paulwong</a> 2019-07-16 14:38 <a href="http://www.tkk7.com/paulwong/archive/2019/07/16/434210.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>STEP鑼冨洿鍐呯殑ROUTERhttp://www.tkk7.com/paulwong/archive/2019/07/11/434137.htmlpaulwongpaulwongThu, 11 Jul 2019 03:45:00 GMThttp://www.tkk7.com/paulwong/archive/2019/07/11/434137.htmlhttp://www.tkk7.com/paulwong/comments/434137.htmlhttp://www.tkk7.com/paulwong/archive/2019/07/11/434137.html#Feedback0http://www.tkk7.com/paulwong/comments/commentRss/434137.htmlhttp://www.tkk7.com/paulwong/services/trackbacks/434137.html

https://gist.github.com/benas/bfe2be7386b99ce496425fac9ff35fb8

paulwong 2019-07-11 11:45 鍙戣〃璇勮
]]>
鍔ㄦ佹敼鍙楽PRING BATCH 鐨?CHUNKSIZEhttp://www.tkk7.com/paulwong/archive/2019/07/02/434011.htmlpaulwongpaulwongTue, 02 Jul 2019 03:13:00 GMThttp://www.tkk7.com/paulwong/archive/2019/07/02/434011.htmlhttp://www.tkk7.com/paulwong/comments/434011.htmlhttp://www.tkk7.com/paulwong/archive/2019/07/02/434011.html#Feedback0http://www.tkk7.com/paulwong/comments/commentRss/434011.htmlhttp://www.tkk7.com/paulwong/services/trackbacks/434011.htmlSPRING BATCH 璇繪枃浠舵椂錛屾槸鎸変竴琛屼竴琛屾潵璇誨彇鏁版嵁錛屽啀鎸塁HUNKSIZE鎻愪氦鍒癛EMOTE鎿嶄綔錛屾湁鏃惰鏁村悎褰撳墠琛屽拰涓嬪嚑琛岋紝鍐嶅喅瀹欳HUNKSIZE錛屼互渚跨浉鍏崇殑鏁版嵁鑳藉湪榪滅▼鍚屼竴涓狿ROCESSOR涓寜欏哄簭榪涜澶勭悊錛屽洜涓虹浉鍏崇殑鏁版嵁琚媶鎴愬嚑涓狢HUNK鏉ュ鐞嗙殑璇濓紝灝辨湁鍙兘涓嶆寜欏哄簭鏉ュ鐞嗐傝繖鏍峰氨闇瑕佸姩鎬佽皟鏁碈HUNKSIZE銆?br />
鍙傜収濡備笅錛?br /> https://stackoverflow.com/questions/37390602/spring-batch-custom-completion-policy-for-dynamic-chunk-size

騫剁粨鍚圫ingleItemPeekableItemReader錛堣楗拌咃紝鍏佽鏌ョ湅涓嬩竴鏉℃暟鎹紝鐪熸鐨勬搷浣滃鎵樼粰浠g悊錛夈?img src ="http://www.tkk7.com/paulwong/aggbug/434011.html" width = "1" height = "1" />

paulwong 2019-07-02 11:13 鍙戣〃璇勮
]]>
Spring batch 鐨勯珮綰х壒鎬?-鐩戝惉錛屽紓甯稿鐞嗭紝浜嬪姟http://www.tkk7.com/paulwong/archive/2019/06/12/433855.htmlpaulwongpaulwongWed, 12 Jun 2019 09:03:00 GMThttp://www.tkk7.com/paulwong/archive/2019/06/12/433855.htmlhttp://www.tkk7.com/paulwong/comments/433855.htmlhttp://www.tkk7.com/paulwong/archive/2019/06/12/433855.html#Feedback0http://www.tkk7.com/paulwong/comments/commentRss/433855.htmlhttp://www.tkk7.com/paulwong/services/trackbacks/433855.htmlhttps://my.oschina.net/u/2600078/blog/909346

paulwong 2019-06-12 17:03 鍙戣〃璇勮
]]>
SPRING BOOT BATCH璧勬簮http://www.tkk7.com/paulwong/archive/2019/05/07/433753.htmlpaulwongpaulwongTue, 07 May 2019 09:07:00 GMThttp://www.tkk7.com/paulwong/archive/2019/05/07/433753.htmlhttp://www.tkk7.com/paulwong/comments/433753.htmlhttp://www.tkk7.com/paulwong/archive/2019/05/07/433753.html#Feedback0http://www.tkk7.com/paulwong/comments/commentRss/433753.htmlhttp://www.tkk7.com/paulwong/services/trackbacks/433753.html Spring Boot涓婼pring Batch鍏ラ棬瀹炰緥 https://www.jianshu.com/p/305192ea4cb1
 

SPRING BATCH + QUARTZ
https://examples.javacodegeeks.com/enterprise-java/spring/batch/quartz-spring-batch-example/
https://blog.kingbbode.com/posts/spring-batch-quartz

Spring Batch Tutorial: Batch Processing Made Easy with Spring
https://www.toptal.com/spring/spring-batch-tutorial

paulwong 2019-05-07 17:07 鍙戣〃璇勮
]]>
濡備綍鎻愰珮緙栫爜璐ㄩ噺http://www.tkk7.com/paulwong/archive/2012/12/14/392982.htmlpaulwongpaulwongFri, 14 Dec 2012 03:57:00 GMThttp://www.tkk7.com/paulwong/archive/2012/12/14/392982.htmlhttp://www.tkk7.com/paulwong/comments/392982.htmlhttp://www.tkk7.com/paulwong/archive/2012/12/14/392982.html#Feedback0http://www.tkk7.com/paulwong/comments/commentRss/392982.htmlhttp://www.tkk7.com/paulwong/services/trackbacks/392982.html涓鑸▼搴忓憳閮戒細(xì)鍙戠幇榪欐牱鐨勯棶棰橈紝闇姹傛嬁浜?jiǎn)锛尵~栫爜鍐欏畬浜?jiǎn)锛尵~栬瘧涔熼氳繃浜?jiǎn)锛寴q愯涔熸病鎶ラ敊錛屽氨浠ヤ負(fù)紼嬪簭OK浜?jiǎn)锛屼絾鍒皨箣璇曚汉鍛橀偅閲屽Q屼竴榪愯嫻嬭瘯鐢ㄤ緥錛屽氨鍙戠幇婕忎簡(jiǎn)榪欎釜閭d釜鐨勶紝浜х敓浜?jiǎn)鎵璋撶殑璐ㄩ噺闂銆?/div>

鍘熷洜
榪欓氬父鏄敱浜庣▼搴忓憳?shù)竴鎷垮埌闇姹傦紝灝遍┈涓婃兂瑕佸嚑涓狢LASS錛岀劧鍚庡氨寮濮嬬紪鐮佷簡(jiǎn)銆?/div>

瑙e喅鏂規(guī)
  1. 鎷垮埌闇姹傚悗錛屽厛鎯沖ぇ姒備細(xì)鐢ㄥ埌鍝簺OBJECT錛屽嵆SERVICE錛孌AO涔嬬被鐨?/li>
  2. 璁捐鍑轟細(xì)閬囧埌鍝簺鍦烘櫙
  3. 璁捐鍑哄垎鍒湪榪欎簺鍦烘櫙涓紝閭d簺OBJECT鍚堜綔鐨勬祦紼嬪浘
  4. 緙栫爜
涓句緥
闇姹傦細(xì)鏈変竴緋葷粺浼?xì)鍦ㄦ瘡澶╃殑鏌愪釜鏃堕棿鐐瑰Q屽湪鏌愪釜鏂囦歡澶瑰唴錛屽鍑轟竴涓竴瀹氭牸寮忓悕縐扮殑鏂囦歡錛岀幇鍦ㄨ姹傜▼搴忓疄鐜板湪鏂囦歡鐢熸垚鍚庯紝璇誨彇榪欎釜鏂囦歡錛屾娊鍙栨煇浜涘唴瀹瑰悗錛屽啀鐢熸垚鍙︿竴鏂囦歡錛岄氳繃SFTP鍙戣蛋銆?/div>

鏂規(guī)錛?/div>
  1. 浼?xì)鐢ㄥ埌鎺捊E嬪櫒錛屾帶鍒跺櫒錛孲PRING BATCH JOB
  2. 鏈夎繖鍑犵鍦烘櫙錛氭病鏈夊彂鐜版枃浠舵椂錛屽彂鐜頒簡(jiǎn)鏂囦歡鍚庢甯稿鐞嗭紝鎺у埗鍣ㄥ拰SPRING BATCH JOB鍑虹幇閿欒鏃剁瓑
  3. 澶勭悊嫻佺▼錛氭帶鍒跺櫒娌℃湁鍙戠幇鏂囦歡鍚庯紝閫氱煡鎺掔▼鍣ㄧ戶(hù)緇笅涓嬈″驚鐜紱鎺у埗鍣ㄥ彂鐜版枃浠跺悗錛岄氱煡SPRING BATCH JOB澶勭悊錛岀劧鍚庨氱煡鎺у埗鍣ㄩ鍑猴紱鎺у埗鍣ㄥ嚭鐜伴敊璇垨SPRING BATCH JOB鍑虹幇閿欒鍚庯紝鎺у埗鍣ㄩ氱煡鎺掔▼鍣ㄩ鍑恒?/li>
  4. 鏍規(guī)嵁榪欏嚑縐嶅満鏅璁$▼搴忕粨鏋勶紝緙栫爜
  5. 緙栧啓鍗曞厓嫻嬭瘯鐢ㄤ緥




paulwong 2012-12-14 11:57 鍙戣〃璇勮
]]>SPRING BATCH 閿欒閫氱煡鏈哄埗http://www.tkk7.com/paulwong/archive/2012/11/17/391508.htmlpaulwongpaulwongSat, 17 Nov 2012 13:42:00 GMThttp://www.tkk7.com/paulwong/archive/2012/11/17/391508.htmlhttp://www.tkk7.com/paulwong/comments/391508.htmlhttp://www.tkk7.com/paulwong/archive/2012/11/17/391508.html#Feedback1http://www.tkk7.com/paulwong/comments/commentRss/391508.htmlhttp://www.tkk7.com/paulwong/services/trackbacks/391508.html闃呰鍏ㄦ枃

paulwong 2012-11-17 21:42 鍙戣〃璇勮
]]>
SPRING BATCH 嫻嬭瘯http://www.tkk7.com/paulwong/archive/2012/11/10/391143.htmlpaulwongpaulwongSat, 10 Nov 2012 09:25:00 GMThttp://www.tkk7.com/paulwong/archive/2012/11/10/391143.htmlhttp://www.tkk7.com/paulwong/comments/391143.htmlhttp://www.tkk7.com/paulwong/archive/2012/11/10/391143.html#Feedback0http://www.tkk7.com/paulwong/comments/commentRss/391143.htmlhttp://www.tkk7.com/paulwong/services/trackbacks/391143.htmlJOB, STEP灞炰簬鍔熻兘嫻嬭瘯錛堥粦鐩掞級(jí)鐨勮寖鐣達(dá)紝INTEMPROCESSOR, ITEMREADER, ITEMWRITER灞炰簬鍗曞厓嫻嬭瘯錛堢櫧鐩掞級(jí)鐨勮寖鐣淬?/div>

/*
 * Copyright 2006-2007 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
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 
*/
package example;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

import java.util.Date;
import java.util.concurrent.Callable;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.batch.core.BatchStatus;
import org.springframework.batch.core.Job;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.JobParametersBuilder;
import org.springframework.batch.core.StepExecution;
import org.springframework.batch.core.launch.JobLauncher;
import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.ItemStream;
import org.springframework.batch.item.NonTransientResourceException;
import org.springframework.batch.item.ParseException;
import org.springframework.batch.item.UnexpectedInputException;
import org.springframework.batch.test.JobLauncherTestUtils;
import org.springframework.batch.test.MetaDataInstanceFactory;
import org.springframework.batch.test.StepScopeTestExecutionListener;
import org.springframework.batch.test.StepScopeTestUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestExecutionListeners;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.support.DependencyInjectionTestExecutionListener;

@ContextConfiguration(locations = { "/test-context.xml",
        "classpath:/META-INF/spring/batch/hello-tasklet-context.xml",
        "classpath:/META-INF/spring/batch/jdbc-job-context.xml",
        "classpath:/META-INF/spring/integration/hello-integration-context.xml"})
@RunWith(SpringJUnit4ClassRunner.class)
//嫻嬭瘯ITEMREADER/ITEMPROCESSOR/ITEMWRITER鏃剁敤鍒?/span>
@TestExecutionListeners( { DependencyInjectionTestExecutionListener.class
    StepScopeTestExecutionListener.class })
public class HelloTaskletTests {
    
    @Autowired
    private JobLauncher jobLauncher;
    
    @Autowired
    private Job helloWorldJob;

    @Autowired
    private JobLauncherTestUtils jobLauncherTestUtils;//嫻嬭瘯JOB/STEP鐨勫叆鍙?/span>
    
    @Autowired
    private ItemReader xmlReader;
    
    public void testLaunchJobWithJobLauncher() throws Exception {
        JobExecution jobExecution = jobLauncher.run(helloWorldJob, new JobParameters());
        assertEquals(BatchStatus.COMPLETED, jobExecution.getStatus());
    }

    /**
     * Create a unique job instance and check it's execution completes
     * successfully - uses the convenience methods provided by the testing
     * superclass.
     
*/
    @Test
    public void testLaunchJob() throws Exception {

        JobExecution jobExecution = jobLauncherTestUtils.launchJob(jobLauncherTestUtils.getUniqueJobParameters());
        assertEquals(BatchStatus.COMPLETED, jobExecution.getStatus());
    }
    
    public void testIntegration()
    {
        while(true)
        {
            
        }
    }
    
    /**
     * 嫻嬭瘯鏌愪釜STEP
     
*/
    @Test
    public void testSomeStep()
    {
        JobExecution jobExecution = jobLauncherTestUtils.
                launchStep("xmlFileReadAndWriterStep",getJobParameters());
        assertEquals(BatchStatus.COMPLETED, jobExecution.getStatus());
    }
    
    /**
     * 嫻嬭瘯READER鐨勬柟寮?鏃訛紝鎵闇鐨勬柟娉?br />     * 
@return
     
*/
    public StepExecution getStepExecution() {
        StepExecution execution = MetaDataInstanceFactory
                .createStepExecution(getJobParameters());
        return execution;
    }
    
    /**
     * 嫻嬭瘯READER鐨勬柟寮?
     * 
@throws Exception
     
*/
    @Test
    @DirtiesContext
    public void testReader() throws Exception {
        int count = StepScopeTestUtils.doInStepScope(getStepExecution(),
                new Callable<Integer>() {
                    @Override
                    public Integer call() throws Exception {
                        int count = 0;
                        try {
                            ((ItemStream) xmlReader)
                                    .open(new ExecutionContext());
                            while (xmlReader.read() != null) {
                                count++;
                            }
                            return count;
                        } finally {
                            ((ItemStream) xmlReader).close();
                        }
                    }
                });
        assertEquals(3, count);
    }
      
    /**
     * 嫻嬭瘯READER鐨勬柟寮?
     * 
@throws UnexpectedInputException
     * 
@throws ParseException
     * 
@throws NonTransientResourceException
     * 
@throws Exception
     
*/
    @Test
    @DirtiesContext
    public void testReader2() throws UnexpectedInputException, ParseException, NonTransientResourceException, Exception
    {
        assertNotNull(xmlReader.read());
    }
    
    /**
     * 嫻嬭瘯READER鐨勬柟寮?鏃訛紝蹇呴』鍔犵殑鏂規(guī)硶
     
*/
    @Before
    public void setUp() {
        ((ItemStream) xmlReader).open(new ExecutionContext());
    }
      
    /**
     * 
     * 
@return
     
*/
    private JobParameters getJobParameters() {
        
        String inputFile = "/Users/paul/Documents/PAUL/DOWNLOAD/SOFTWARE/DEVELOP/"
                + "SPRING BATCH/spring-batch-2.1.9.RELEASE/samples/"
                + "spring-batch-simple-cli/file/trades1.xml";
        
        String outputFile = "/Users/paul/Documents/PAUL/DOWNLOAD/SOFTWARE/DEVELOP/"
                + "SPRING BATCH/spring-batch-2.1.9.RELEASE/samples/"
                + "spring-batch-simple-cli/file/output/out.xml";
        
        JobParameters jobParameters = new JobParametersBuilder()
                .addString("input.file.path", inputFile)
                .addString("output.file.path", outputFile)
                .addDate("date", new Date()).toJobParameters();
        
        return jobParameters;
    }


}


鍙傝冧緥瀛愶細(xì) 

paulwong 2012-11-10 17:25 鍙戣〃璇勮
]]>
SRING INTEGRATION + BATCHhttp://www.tkk7.com/paulwong/archive/2012/10/21/389968.htmlpaulwongpaulwongSun, 21 Oct 2012 09:23:00 GMThttp://www.tkk7.com/paulwong/archive/2012/10/21/389968.htmlhttp://www.tkk7.com/paulwong/comments/389968.htmlhttp://www.tkk7.com/paulwong/archive/2012/10/21/389968.html#Feedback0http://www.tkk7.com/paulwong/comments/commentRss/389968.htmlhttp://www.tkk7.com/paulwong/services/trackbacks/389968.html闃呰鍏ㄦ枃

paulwong 2012-10-21 17:23 鍙戣〃璇勮
]]>
SPRING BATCH 榪愯鏈哄埗http://www.tkk7.com/paulwong/archive/2012/10/20/389910.htmlpaulwongpaulwongSat, 20 Oct 2012 03:57:00 GMThttp://www.tkk7.com/paulwong/archive/2012/10/20/389910.htmlhttp://www.tkk7.com/paulwong/comments/389910.htmlhttp://www.tkk7.com/paulwong/archive/2012/10/20/389910.html#Feedback0http://www.tkk7.com/paulwong/comments/commentRss/389910.htmlhttp://www.tkk7.com/paulwong/services/trackbacks/389910.html
  1. 鍒ゆ柇姝OB浠ュ墠鏄惁鏈夎繍琛岃繃錛屽垽鏂緷鎹細(xì)鏍規(guī)嵁JOB NAME鍜孞OB PARAMETERS淇℃伅鍘昏繖涓ゅ紶琛ㄦ煡鎵撅紝濡傛壘鍒拌褰曪紝鍒欐槸鏈夎繍琛岃繃錛屽紜畾鏈夊垯寮曟搸閫鍑哄茍鎻愮ず銆?br />

  2. 鍒ゆ柇鏄惁鏈夐噸澶嶈繍琛岀殑JOB錛屽鏋滄病錛屾煡鎵炬JOB涓婃榪愯鐨勬儏鍐碉紝濡傛灉鏈塅AIL鐨勬儏鍐碉紝鍒欓噸鏂頒粠涓婃澶辮觸鐨勫湴鏂硅繍琛岀戶(hù)緇繍琛岋紝鍒ゆ柇鏍規(guī)嵁錛氭牴鎹甁OB INSTANCE鍏寵仈鐨凧OB EXECUTION鏌ユ壘鏄惁鏈夌姸鎬佷負(fù)FAIL鐨勮褰曪紝濡傛湁鍒欐槸錛屽氨鏂板緩涓涓狫OB EXECUTION琛ㄧず榪涜絎簩嬈″皾璇曪紝鍚屾椂鍙堢敓鎴愬叧浜庢柊JOB鐨凧OB EXECUTION銆備笂嬈$殑JOB榪愯瀹屽悗錛屽啀榪愯姝ゆ鏂癑OB銆傚垽鏂笂嬈″け璐ョ殑STEP鐨勪緷鎹細(xì)鏌ユ壘瀵瑰簲鐨凧OB EXECUTON鐨凷TEP EXECUTON鐘舵佷負(fù)FAIL鐨凷TEP鍗沖彲錛屼細(xì)浠庢姝ラ寮濮嬭繍琛岋紝鑰屼笉鏄粠絎竴姝ュ紑濮嬭繍琛屻?br />
鍙傝冩枃妗o細(xì)


paulwong 2012-10-20 11:57 鍙戣〃璇勮
]]>SPRING INTEGRATION + SPRING BATCHhttp://www.tkk7.com/paulwong/archive/2012/10/16/389625.htmlpaulwongpaulwongMon, 15 Oct 2012 16:11:00 GMThttp://www.tkk7.com/paulwong/archive/2012/10/16/389625.htmlhttp://www.tkk7.com/paulwong/comments/389625.htmlhttp://www.tkk7.com/paulwong/archive/2012/10/16/389625.html#Feedback7http://www.tkk7.com/paulwong/comments/commentRss/389625.htmlhttp://www.tkk7.com/paulwong/services/trackbacks/389625.html闃呰鍏ㄦ枃

paulwong 2012-10-16 00:11 鍙戣〃璇勮
]]>
Quartz 涓殑浠誨姟寮濮嬨佹殏鍋滃拰緇х畫(huà)http://www.tkk7.com/paulwong/archive/2012/10/13/389514.htmlpaulwongpaulwongSat, 13 Oct 2012 08:18:00 GMThttp://www.tkk7.com/paulwong/archive/2012/10/13/389514.htmlhttp://www.tkk7.com/paulwong/comments/389514.htmlhttp://www.tkk7.com/paulwong/archive/2012/10/13/389514.html#Feedback1http://www.tkk7.com/paulwong/comments/commentRss/389514.htmlhttp://www.tkk7.com/paulwong/services/trackbacks/389514.htmlpackage com.paul.springbatchtest.tasklet;import org.quartz.SchedulerException;public class Tas...  闃呰鍏ㄦ枃

paulwong 2012-10-13 16:18 鍙戣〃璇勮
]]>
Spring 3.0鐨勪換鍔¤皟搴?/title><link>http://www.tkk7.com/paulwong/archive/2012/10/12/389451.html</link><dc:creator>paulwong</dc:creator><author>paulwong</author><pubDate>Fri, 12 Oct 2012 02:51:00 GMT</pubDate><guid>http://www.tkk7.com/paulwong/archive/2012/10/12/389451.html</guid><wfw:comment>http://www.tkk7.com/paulwong/comments/389451.html</wfw:comment><comments>http://www.tkk7.com/paulwong/archive/2012/10/12/389451.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/paulwong/comments/commentRss/389451.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/paulwong/services/trackbacks/389451.html</trackback:ping><description><![CDATA[Spring3.0浠ュ悗錛岃嚜宸卞凡緇忓畬鍏ㄦ敮鎸佹洿鍔犵簿紜殑鏃墮棿錛岃屼笉闇瑕丵uartz錛圦uartz鏄竴涓紑鏀炬簮鐮侀」鐩紝涓撴敞浜庝換鍔¤皟搴﹀櫒錛屾彁渚涗簡(jiǎn)鏋佷負(fù)騫挎硾鐨勭壒鎬у鎸佷箙鍖栦換鍔★紝闆嗙兢鍜屽垎甯冨紡浠誨姟絳夈係pring瀵筈uartz鐨勯泦鎴愪笌鍏跺JDK Timer鐨勯泦鎴愬湪浠誨姟銆佽Е鍙戝櫒鍜岃皟搴﹁鍒掔殑澹版槑寮忛厤緗柟闈㈢瓑閮介潪甯哥浉浼箋?錛夌殑鏀寔錛氬綋鐒跺悗闈㈡垜浠篃浼?xì)鐢≦uartz瀹炵幇浠誨姟鐨勮皟搴︺?br /><br />Spring3.0鍚屾牱涔熶嬌鐢╟ron琛ㄨ揪寮忋備笌Quartz涓嶅悓鐨勬槸錛孲pring3.0涓嶆敮鎸佸勾錛岃孮uartz鏀寔騫淬備絾榪欑偣濂借薄騫朵笉鏄潪甯擱噸瑕併?<br /><br />cron琛ㄨ揪寮忥細(xì)錛嶆槸鐢ㄧ┖鏍煎垎寮鐨勬椂闂村瓧孌碉紝涓嶄嬌鐢ㄥ勾銆? <div style="border-right: #cccccc 1px solid; padding-right: 5px; border-top: #cccccc 1px solid; padding-left: 4px; font-size: 13px; padding-bottom: 4px; border-left: #cccccc 1px solid; width: 98%; word-break: break-all; padding-top: 4px; border-bottom: #cccccc 1px solid; background-color: #eeeeee"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><img alt="" src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /><span style="color: #000000">*(縐?-</span><span style="color: #000000">59</span><span style="color: #000000">)    <br /><img alt="" src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />*(鍒嗛挓0-</span><span style="color: #000000">59</span><span style="color: #000000">)  <br /><img alt="" src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />*(灝忔椂0-</span><span style="color: #000000">23</span><span style="color: #000000">)  <br /><img alt="" src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />*(鏃ユ湡1-</span><span style="color: #000000">31</span><span style="color: #000000">)  <br /><img alt="" src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />*(鏈堜喚1-12鎴栨槸JAN-DEC)  <br /><img alt="" src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />*(鏄熸湡1-7鎴栨槸SUN-SAT)  <br /><img alt="" src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /><br /><img alt="" src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />紺轟緥錛?nbsp;<br /><img alt="" src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />*/</span><span style="color: #000000">5</span><span style="color: #000000">  * * * * </span><span style="color: #000000">6</span><span style="color: #000000">-</span><span style="color: #000000">7</span><span style="color: #000000">  :: 姣忎釜鍛?鍒板懆鏃ワ紝姣忛殧5縐掗挓鎵ц涓嬈°?br /> <br /><img alt="" src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />*/</span><span style="color: #000000">1</span><span style="color: #000000"> * * </span><span style="color: #000000">7</span><span style="color: #000000">-</span><span style="color: #000000">9</span><span style="color: #000000"> </span><span style="color: #000000">1</span><span style="color: #000000">-</span><span style="color: #000000">2</span><span style="color: #000000"> </span><span style="color: #000000">1</span><span style="color: #000000">-</span><span style="color: #000000">7</span><span style="color: #000000"> :: 1鏈堝埌2鏈堜腑鐨?鍙峰埌9鍙鳳紝涓斿繀欏昏婊¤凍鍛ㄤ竴鍒板懆鏃ワ紝姣忛殧1縐掗挓鎵ц涓嬈°?nbsp;<br /><br /><img alt="" src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />*/</span><span style="color: #000000">1</span><span style="color: #000000"> * * </span><span style="color: #000000">7</span><span style="color: #000000">-</span><span style="color: #000000">9</span><span style="color: #000000"> </span><span style="color: #000000">1</span><span style="color: #000000">,</span><span style="color: #000000">5</span><span style="color: #000000"> </span><span style="color: #000000">1</span><span style="color: #000000">-</span><span style="color: #000000">7</span><span style="color: #000000">  :: 娉ㄦ剰閲岄潰鐨?/span><span style="color: #000000">,</span><span style="color: #000000">(閫楀彿)錛屽彧鏈?鏈堝拰5鏈堢殑7鍒?鍙鳳紝涓斿繀欏昏婊¤凍鍛ㄤ竴鍒板懆鏃ワ紝姣忎竴縐掗挓鎵ц涓嬈°?nbsp;<br /><br /><img alt="" src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />*/</span><span style="color: #000000">1</span><span style="color: #000000"> </span><span style="color: #000000">17</span><span style="color: #000000">-</span><span style="color: #000000">59</span><span style="color: #000000"> * </span><span style="color: #000000">7</span><span style="color: #000000">-</span><span style="color: #000000">9</span><span style="color: #000000"> </span><span style="color: #000000">1</span><span style="color: #000000">,</span><span style="color: #000000">5</span><span style="color: #000000"> </span><span style="color: #000000">1</span><span style="color: #000000">-</span><span style="color: #000000">7</span><span style="color: #000000"> :: 鍙В閲?7-</span><span style="color: #000000">59</span><span style="color: #000000">,</span><span style="color: #000000">鏄寚浠庣17鍒嗛挓鍒扮59鍒嗛挓錛屽湪鎸囧畾鐨勬椂闂村唴錛屾瘡涓縐掔鎵ц涓嬈?nbsp;<br /><br /><img alt="" src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />* </span><span style="color: #000000">17</span><span style="color: #000000">-</span><span style="color: #000000">59</span><span style="color: #000000"> * </span><span style="color: #000000">7</span><span style="color: #000000">-</span><span style="color: #000000">9</span><span style="color: #000000"> </span><span style="color: #000000">1</span><span style="color: #000000">,</span><span style="color: #000000">5</span><span style="color: #000000"> </span><span style="color: #000000">1</span><span style="color: #000000">-</span><span style="color: #000000">7</span><span style="color: #000000">  :: 姝や唬鐮佺殑鍔熻兘涓庝笂闈㈠畬鍏ㄧ浉鍚屻傚鏋滀笉鍐欑鍗充負(fù)姣忎竴縐掓墽琛屼竴嬈°?nbsp;<br /></span><span style="color: #000000"><br />  59</span><span style="color: #000000"> </span><span style="color: #000000">19</span><span style="color: #000000">-</span><span style="color: #000000">23</span><span style="color: #000000"> * </span><span style="color: #000000">7</span><span style="color: #000000">-</span><span style="color: #000000">9</span><span style="color: #000000"> </span><span style="color: #000000">1</span><span style="color: #000000">,</span><span style="color: #000000">5</span><span style="color: #000000"> </span><span style="color: #000000">1</span><span style="color: #000000">-</span><span style="color: #000000">7</span><span style="color: #000000">  :: 19鍒?23鍒嗙殑姣?9縐掗挓鏃跺彧鎵ц涓嬈°?nbsp;<br /><img alt="" src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /><br /></span><span style="color: #000000">  59</span><span style="color: #000000"> </span><span style="color: #000000">19</span><span style="color: #000000">,</span><span style="color: #000000">26</span><span style="color: #000000"> * </span><span style="color: #000000">7</span><span style="color: #000000">-</span><span style="color: #000000">9</span><span style="color: #000000"> </span><span style="color: #000000">1</span><span style="color: #000000">,</span><span style="color: #000000">5</span><span style="color: #000000"> </span><span style="color: #000000">1</span><span style="color: #000000">-</span><span style="color: #000000">7</span><span style="color: #000000">  :: 娉ㄦ剰閲岄潰鐨?/span><span style="color: #000000">,</span><span style="color: #000000">(閫楀彿)錛屾槸鎸囧彧鏈?9鍒嗘垨鏄?6鍒嗙殑56縐掗挓鏃舵墽琛屼竴嬈°?nbsp;<br /><img alt="" src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /><br />  * * </span><span style="color: #000000">16</span><span style="color: #000000">-</span><span style="color: #000000">23</span><span style="color: #000000"> </span><span style="color: #000000">7</span><span style="color: #000000">-</span><span style="color: #000000">9</span><span style="color: #000000"> </span><span style="color: #000000">1</span><span style="color: #000000">,</span><span style="color: #000000">5</span><span style="color: #000000"> </span><span style="color: #000000">1</span><span style="color: #000000">-</span><span style="color: #000000">7</span><span style="color: #000000">  :: 瀹氫箟姣忓ぉ鐨?6鐐瑰埌23鐐規(guī)瘡涓縐掗挓鎵ц涓嬈°?nbsp;<br /><img alt="" src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /><br /></span><span style="color: #000000">  59</span><span style="color: #000000"> </span><span style="color: #000000">59</span><span style="color: #000000"> </span><span style="color: #000000">23</span><span style="color: #000000"> * * </span><span style="color: #000000">1</span><span style="color: #000000">-</span><span style="color: #000000">5</span><span style="color: #000000">  :: 瀹氫箟姣忓懆1鍒板懆5</span><span style="color: #000000">,</span><span style="color: #000000">鏅氫笂23:</span><span style="color: #000000">59</span><span style="color: #000000">:59縐掑彧鎵ц涓嬈°?br /><img alt="" src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />榪欎釜鐩稿綋鐢ㄦ湁銆傚彲浠ュ伐浣滄椂闂存瘡澶╃粰鐢ㄦ埛鍙戦偖浠躲?nbsp;<br /><img alt="" src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /></span></div><br />鍦⊿pring3.0涓紩鐢ㄤ簡(jiǎn)鏂扮殑鍛藉悕絀洪棿-task錛?<br />task:scheduler 鐢ㄤ簬瀹氫箟涓涓猅hreadPoolTaskScheduler,騫跺彲浠ユ寚瀹氱嚎紼嬫睜鐨勫ぇ灝忥紝<br />鍗硃ool-size.鎵鏈変換鍔¢槦鍒楅兘灝嗕細(xì)鍦ㄦ寚瀹氬ぇ灝忕殑綰跨▼姹犱腑榪愯錛?<br /><br />瀹氫箟濡備笅錛?br /> <div style="border-right: #cccccc 1px solid; padding-right: 5px; border-top: #cccccc 1px solid; padding-left: 4px; font-size: 13px; padding-bottom: 4px; border-left: #cccccc 1px solid; width: 98%; word-break: break-all; padding-top: 4px; border-bottom: #cccccc 1px solid; background-color: #eeeeee"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><img alt="" src="http://www.tkk7.com/Images/OutliningIndicators/None.gif" align="top" /><span style="color: #008000"><!--</span><span style="color: #008000"> 瀵逛簬鍚屼竴涓狿ojo鍙互澹版槑澶氭錛屽茍璁劇疆鏍囪灞炴?nbsp;</span><span style="color: #008000">--></span><span style="color: #000000">  <br /><img alt="" src="http://www.tkk7.com/Images/OutliningIndicators/None.gif" align="top" /></span><span style="color: #0000ff"><</span><span style="color: #800000">bean </span><span style="color: #ff0000">id</span><span style="color: #0000ff">="one"</span><span style="color: #ff0000"> class</span><span style="color: #0000ff">="cn.itcast.schedule.One"</span><span style="color: #0000ff">></span><span style="color: #000000">  <br /><img alt="" src="http://www.tkk7.com/Images/OutliningIndicators/None.gif" align="top" /></span><span style="color: #0000ff"><</span><span style="color: #800000">property </span><span style="color: #ff0000">name</span><span style="color: #0000ff">="task"</span><span style="color: #ff0000"> value</span><span style="color: #0000ff">="A"</span><span style="color: #0000ff">></</span><span style="color: #800000">property</span><span style="color: #0000ff">></span><span style="color: #000000">  <br /><img alt="" src="http://www.tkk7.com/Images/OutliningIndicators/None.gif" align="top" /></span><span style="color: #0000ff"></</span><span style="color: #800000">bean</span><span style="color: #0000ff">></span><span style="color: #000000">  <br /><img alt="" src="http://www.tkk7.com/Images/OutliningIndicators/None.gif" align="top" /><br /><img alt="" src="http://www.tkk7.com/Images/OutliningIndicators/None.gif" align="top" /></span><span style="color: #0000ff"><</span><span style="color: #800000">bean </span><span style="color: #ff0000">id</span><span style="color: #0000ff">="two"</span><span style="color: #ff0000"> class</span><span style="color: #0000ff">="cn.itcast.schedule.One"</span><span style="color: #0000ff">></span><span style="color: #000000">  <br /><img alt="" src="http://www.tkk7.com/Images/OutliningIndicators/None.gif" align="top" /></span><span style="color: #0000ff"><</span><span style="color: #800000">property </span><span style="color: #ff0000">name</span><span style="color: #0000ff">="task"</span><span style="color: #ff0000"> value</span><span style="color: #0000ff">="B"</span><span style="color: #0000ff">></</span><span style="color: #800000">property</span><span style="color: #0000ff">></span><span style="color: #000000">  <br /><img alt="" src="http://www.tkk7.com/Images/OutliningIndicators/None.gif" align="top" /></span><span style="color: #0000ff"></</span><span style="color: #800000">bean</span><span style="color: #0000ff">></span><span style="color: #000000">  <br /><img alt="" src="http://www.tkk7.com/Images/OutliningIndicators/None.gif" align="top" /><br /><img alt="" src="http://www.tkk7.com/Images/OutliningIndicators/None.gif" align="top" /></span><span style="color: #0000ff"><</span><span style="color: #800000">bean </span><span style="color: #ff0000">id</span><span style="color: #0000ff">="three"</span><span style="color: #ff0000"> class</span><span style="color: #0000ff">="cn.itcast.schedule.One"</span><span style="color: #0000ff">></span><span style="color: #000000">  <br /><img alt="" src="http://www.tkk7.com/Images/OutliningIndicators/None.gif" align="top" /></span><span style="color: #0000ff"><</span><span style="color: #800000">property </span><span style="color: #ff0000">name</span><span style="color: #0000ff">="task"</span><span style="color: #ff0000"> value</span><span style="color: #0000ff">="C"</span><span style="color: #0000ff">></</span><span style="color: #800000">property</span><span style="color: #0000ff">></span><span style="color: #000000">  <br /><img alt="" src="http://www.tkk7.com/Images/OutliningIndicators/None.gif" align="top" /></span><span style="color: #0000ff"></</span><span style="color: #800000">bean</span><span style="color: #0000ff">></span><span style="color: #000000">  <br /><img alt="" src="http://www.tkk7.com/Images/OutliningIndicators/None.gif" align="top" /><br /><img alt="" src="http://www.tkk7.com/Images/OutliningIndicators/None.gif" align="top" /></span><span style="color: #008000"><!--</span><span style="color: #008000"> 澹版槑涓涓叿鏈変袱涓嚎紼嬬殑姹狅紝姣忎竴涓璞″皢鑾峰彇鍚屾牱鐨勮繍琛屾満浼?nbsp;</span><span style="color: #008000">--></span><span style="color: #000000">  <br /><img alt="" src="http://www.tkk7.com/Images/OutliningIndicators/None.gif" align="top" /></span><span style="color: #0000ff"><</span><span style="color: #800000">task:scheduler </span><span style="color: #ff0000">id</span><span style="color: #0000ff">="sch"</span><span style="color: #ff0000"> pool-size</span><span style="color: #0000ff">="2"</span><span style="color: #0000ff">/></span><span style="color: #000000">  <br /><img alt="" src="http://www.tkk7.com/Images/OutliningIndicators/None.gif" align="top" /><br /><img alt="" src="http://www.tkk7.com/Images/OutliningIndicators/None.gif" align="top" /></span><span style="color: #008000"><!--</span><span style="color: #008000"> 寮曠敤綰跨▼姹?nbsp;</span><span style="color: #008000">--></span><span style="color: #000000">  <br /><img alt="" src="http://www.tkk7.com/Images/OutliningIndicators/None.gif" align="top" /></span><span style="color: #0000ff"><</span><span style="color: #800000">task:scheduled-tasks </span><span style="color: #ff0000">scheduler</span><span style="color: #0000ff">="sch"</span><span style="color: #0000ff">></span><span style="color: #000000">  <br /><img alt="" src="http://www.tkk7.com/Images/OutliningIndicators/None.gif" align="top" />     </span><span style="color: #008000"><!--</span><span style="color: #008000"> 寮曠敤Spring Bean騫惰緗皟鐢ㄧ殑鏂規(guī)硶鐨勬椂闂撮棿闅?nbsp;</span><span style="color: #008000">--></span><span style="color: #000000"> <br /><img alt="" src="http://www.tkk7.com/Images/OutliningIndicators/None.gif" align="top" />     </span><span style="color: #0000ff"><</span><span style="color: #800000">task:scheduled </span><span style="color: #ff0000">ref</span><span style="color: #0000ff">="one"</span><span style="color: #ff0000"> method</span><span style="color: #0000ff">="doSomeThing"</span><span style="color: #ff0000">  fixed-delay</span><span style="color: #0000ff">="#{1000*3}"</span><span style="color: #0000ff">/></span><span style="color: #000000"> <br /></span><span style="color: #0000ff">       <</span><span style="color: #800000">task:scheduled </span><span style="color: #ff0000">ref</span><span style="color: #0000ff">="two"</span><span style="color: #ff0000"> method</span><span style="color: #0000ff">="doSomeThing"</span><span style="color: #ff0000">  fixed-delay</span><span style="color: #0000ff">="#{1000*3}"</span><span style="color: #0000ff">/></span><span style="color: #000000"> <br /></span><span style="color: #0000ff">       <</span><span style="color: #800000">task:scheduled </span><span style="color: #ff0000">ref</span><span style="color: #0000ff">="three"</span><span style="color: #ff0000"> method</span><span style="color: #0000ff">="doSomeThing"</span><span style="color: #ff0000">  fixed-delay</span><span style="color: #0000ff">="#{1000*3}"</span><span style="color: #0000ff">/></span><span style="color: #000000"> <br /></span><span style="color: #0000ff">  </</span><span style="color: #800000">task:scheduled-tasks</span><span style="color: #0000ff">></span><span style="color: #000000"> <br /><img alt="" src="http://www.tkk7.com/Images/OutliningIndicators/None.gif" align="top" /><br /><img alt="" src="http://www.tkk7.com/Images/OutliningIndicators/None.gif" align="top" /></span><span style="color: #008000"><!--</span><span style="color: #008000"> 閰嶇疆涓涓畾鏃舵墽琛岀殑浠誨姟 </span><span style="color: #008000">--></span><span style="color: #000000"> <br /><img alt="" src="http://www.tkk7.com/Images/OutliningIndicators/None.gif" align="top" /></span><span style="color: #0000ff"><</span><span style="color: #800000">bean </span><span style="color: #ff0000">id</span><span style="color: #0000ff">="work"</span><span style="color: #ff0000"> class</span><span style="color: #0000ff">="cn.itcast.schedule.Two"</span><span style="color: #0000ff">/></span><span style="color: #000000"> <br /><img alt="" src="http://www.tkk7.com/Images/OutliningIndicators/None.gif" align="top" /><br /><img alt="" src="http://www.tkk7.com/Images/OutliningIndicators/None.gif" align="top" /></span><span style="color: #0000ff"><</span><span style="color: #800000">task:scheduler </span><span style="color: #ff0000">id</span><span style="color: #0000ff">="sendMail"</span><span style="color: #0000ff">/></span><span style="color: #000000"> <br /><img alt="" src="http://www.tkk7.com/Images/OutliningIndicators/None.gif" align="top" /><br /><img alt="" src="http://www.tkk7.com/Images/OutliningIndicators/None.gif" align="top" /></span><span style="color: #0000ff"><</span><span style="color: #800000">task:scheduled-tasks </span><span style="color: #ff0000">scheduler</span><span style="color: #0000ff">="sendMail"</span><span style="color: #0000ff">></span><span style="color: #000000"> <br /><img alt="" src="http://www.tkk7.com/Images/OutliningIndicators/None.gif" align="top" />     </span><span style="color: #008000"><!--</span><span style="color: #008000"> 瀹氫箟鍦?鏈?鍙?9:37:1縐掓墽琛屼竴嬈★紝鏃犺鏄懆鍑?nbsp;</span><span style="color: #008000">--></span><span style="color: #000000"> <br /><img alt="" src="http://www.tkk7.com/Images/OutliningIndicators/None.gif" align="top" />     </span><span style="color: #0000ff"><</span><span style="color: #800000">task:scheduled </span><span style="color: #ff0000">ref</span><span style="color: #0000ff">="work"</span><span style="color: #ff0000"> method</span><span style="color: #0000ff">="work"</span><span style="color: #ff0000"> cron</span><span style="color: #0000ff">="1 37 19 8 1 *"</span><span style="color: #0000ff">/></span><span style="color: #000000"> <br /><img alt="" src="http://www.tkk7.com/Images/OutliningIndicators/None.gif" align="top" /></span><span style="color: #0000ff"></</span><span style="color: #800000">task:scheduled-tasks</span><span style="color: #0000ff">></span><span style="color: #000000"> </span></div><br /><br />瀹氫箟濂戒箣鍚庯紝姝e父鍚姩瀹瑰櫒鍗沖彲錛屽彧鏈夋潯浠剁鍚堬紝鍗充細(xì)鎸夎姹傛墽琛屼換鍔°?<img src ="http://www.tkk7.com/paulwong/aggbug/389451.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/paulwong/" target="_blank">paulwong</a> 2012-10-12 10:51 <a href="http://www.tkk7.com/paulwong/archive/2012/10/12/389451.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>SPRING BATCH SCRENhttp://www.tkk7.com/paulwong/archive/2012/10/11/389425.htmlpaulwongpaulwongThu, 11 Oct 2012 10:10:00 GMThttp://www.tkk7.com/paulwong/archive/2012/10/11/389425.htmlhttp://www.tkk7.com/paulwong/comments/389425.htmlhttp://www.tkk7.com/paulwong/archive/2012/10/11/389425.html#Feedback0http://www.tkk7.com/paulwong/comments/commentRss/389425.htmlhttp://www.tkk7.com/paulwong/services/trackbacks/389425.htmlA job runs at a specific period in the day at a specific interval (e.g. between 1am - 3am at 15 minute intervals) . When it completes with a specific status, it stops (and does not run after 15 minutes) and does not get triggered again until the next day again at 1am, and at the same time, it triggers all dependent jobs.

SCENARIO 2:
A job is scheduled to run at a specific time of day. It continues to run at regular intervals until a condition is met, after which it stops running. It will then start running the next day at the scheduled time and process repeats.

Reference:

spring+quartz 鍔ㄦ佷換鍔℃柟妗?/div>

Quartz+Spring 鑷畾涔変綔涓氳皟搴︼紙浣滀笟鍦―B涓厤緗級(jí)

Quartz鍦⊿pring涓姩鎬佽緗甤ronExpression錛坰pring璁劇疆鍔ㄦ佸畾鏃朵換鍔★級(jí)

Quartz瀹炵幇Java璋冨害鎿嶄綔

Sping 涓厤緗甉uartz錛孲chedulerFactoryBean涓嶈兘鑷姩鍚姩



paulwong 2012-10-11 18:10 鍙戣〃璇勮
]]>SPRING BATCH ADMIN瀹夎瀹炲綍http://www.tkk7.com/paulwong/archive/2012/09/23/388382.htmlpaulwongpaulwongSun, 23 Sep 2012 11:36:00 GMThttp://www.tkk7.com/paulwong/archive/2012/09/23/388382.htmlhttp://www.tkk7.com/paulwong/comments/388382.htmlhttp://www.tkk7.com/paulwong/archive/2012/09/23/388382.html#Feedback0http://www.tkk7.com/paulwong/comments/commentRss/388382.htmlhttp://www.tkk7.com/paulwong/services/trackbacks/388382.html
  • 涓嬭澆
    浠庝簯绔笅杞芥枃浠訛細(xì)http://s3.amazonaws.com/dist.springframework.org/release/BATCHADM/spring-batch-admin-1.2.1.RELEASE.zip

  • 鏇存敼JOBREPOSITRY鐨勬暟鎹簱
    鏀寔浠庡惎鍔↗VM鏃朵紶鍙傛暟錛屽嵆濡傛灉鍚姩JVM鏃朵紶浜?DENVIRONMENT=mysql鍊鹼紝鍒欒鍙朾atch-mysql.properties鏂囦歡錛屽鏈紶鍊鹼紝鍒欓粯璁よbatch-hsql.properties鏂囦歡錛屽鎵句笉鍒版鏂囦歡錛屾墠璇誨彇batch-default.properties鏂囦歡錛屽洜姝ゅ皢batch-mysql.properties絳夊垹闄わ紝鍙繚鐣檇efault鏂囦歡錛岄噷闈㈡斁鏁版嵁搴撻┍鍔ㄧ▼搴忕瓑淇℃伅鏄紑鍙戠幆澧冩椂鐨勯閫夊仛娉曘傜浉鍏崇殑properties鏂囦歡鍙幓http://www.springsource.org/download/community涓笅杞姐傞『渚垮皢JDK鏀規(guī)垚1.6錛孲PRING-BATCH鐨勭増鏈敼鎴愭渶鏂扮殑2.1.8銆?br />
  • 鐢熸垚WAR鍖?nbsp;
    鍏堢敤MAVEN瀹夎PARENT鍖咃紝鍐嶅畨瑁匒DMIN鍖呫?br />
  • 閮ㄧ講
    鎵撳紑TOMCAT錛屽皢WAR鍖呬涪榪涘幓鍗沖彲錛屽鏋滆鍦‥CLIPSE涓皟璇曪紝灝嗘涓や釜PROJECT 瀵煎叆鍒癊CLIPSE涓紝瀹夎RUN-JETTY-RUN鎻掍歡錛屽嵆鍙湪ECLIPSE涓惎鍔↗ETTY錛岃孧AVEN欏圭洰涓嶇敤鏀規(guī)垚ECLIPSE鐨刉EB欏圭洰錛屾帹鑽愶紒
    璁塊棶緗戝潃錛歨ttp://localhost:8080/spring-batch-admin-sample銆?br />
  • 閮ㄧ講JOB
    灝唈ob鐨剆pring閰嶇疆鏂囦歡鍜岀浉鍏砪lass濡俰temreader絳夋墦鎴恓ar鍖咃紝鏀懼埌META-INF/spring/batch/jobs/涓嬶紝鍒欎細(xì)鑷姩鏄劇ず鍒癠I涓?br />
    <鐐瑰嚮涓嬭澆淇敼鍚庣殑鎺у埗鍙?/a>> <鐐瑰嚮涓嬭澆渚嬪瓙>


  • paulwong 2012-09-23 19:36 鍙戣〃璇勮
    ]]>
    SPRING BATCH 璧勬簮http://www.tkk7.com/paulwong/archive/2012/09/20/388179.htmlpaulwongpaulwongThu, 20 Sep 2012 05:25:00 GMThttp://www.tkk7.com/paulwong/archive/2012/09/20/388179.htmlhttp://www.tkk7.com/paulwong/comments/388179.htmlhttp://www.tkk7.com/paulwong/archive/2012/09/20/388179.html#Feedback0http://www.tkk7.com/paulwong/comments/commentRss/388179.htmlhttp://www.tkk7.com/paulwong/services/trackbacks/388179.htmlhttp://www.cnblogs.com/gulvzhe/archive/2011/11/06/2238125.html 

    http://www.ibm.com/developerworks/cn/java/j-lo-springbatch1/

    鍗曞厓嫻嬭瘯渚嬪瓙
    http://code.google.com/p/springbatchhanson/

    鍗曞厓嫻嬭瘯STEP

    Spring Batch In Action渚嬪瓙


    Pro Spring Batch渚嬪瓙
    http://www.apress.com/9781430234524

    Spring Batch瀹樻柟渚嬪瓙
    http://www.springsource.org/download/community

    Spring Batch 涔?Sample錛堝浐瀹氶暱鏍煎紡鏂囦歡璇誨啓錛?鍏?
    http://mowengaobo.iteye.com/blog/1522137

    SPRING BATCH REFERENCE


    paulwong 2012-09-20 13:25 鍙戣〃璇勮
    ]]>
    spring batch鍩烘湰姒傚康http://www.tkk7.com/paulwong/archive/2012/09/19/388027.htmlpaulwongpaulwongTue, 18 Sep 2012 16:19:00 GMThttp://www.tkk7.com/paulwong/archive/2012/09/19/388027.htmlhttp://www.tkk7.com/paulwong/comments/388027.htmlhttp://www.tkk7.com/paulwong/archive/2012/09/19/388027.html#Feedback0http://www.tkk7.com/paulwong/comments/commentRss/388027.htmlhttp://www.tkk7.com/paulwong/services/trackbacks/388027.html
    涓繪祦紼嬶細(xì)
    鐢盝obRunner鍚姩Job錛孞ob鍚姩Step錛孲tep鍚姩TaskLet錛孴askLet鍚姩Chunk錛孋hunk鍚姩ItemRader/ItemProcessor/ItemWriter銆?br />
    Step涔嬮棿鍙互璁懼畾嫻佺▼錛屽嵆鍦⊿tep闂存斁涓涓狣ecision錛屽湪涓婁竴姝ユ斁涓涓狶istener錛屾牴鎹潯浠舵妸鏌愬彉閲忓兼斁鍒癈ontext涓紝Decision鏍規(guī)嵁姝ゅ煎喅瀹氫笅涓姝ユ槸鍝釜銆?br />
    DefaultLineMapper錛氬皢STRING杞垚MAP

    DelimitedLineTokenizer錛氬皢琛屼互璞嗗彿鍒嗗壊鍑烘潵鏀懼埌LIST

    BeanWrapperFieldSetMapper錛氬皢MAP杞垚VO

    FlatFileItemWriter錛氳緭鍑哄埌鏂囦歡

    DelimitedLineAggregator錛氬璞¤漿瀛楃涓?br />
    鑷畾涔塗askLet錛氬鏋滀換鍔′笉鏄鎴栧啓閭g,灝辨柊澧炶嚜瀹氫箟綾誨畬鎴愭墍闇宸ヤ綔





    http://www.cnblogs.com/gulvzhe/archive/2011/11/06/2238125.html 

    http://www.ibm.com/developerworks/cn/java/j-lo-springbatch1/

    http://www.visa4uk.fco.gov.uk/Welcome.htm

    paulwong 2012-09-19 00:19 鍙戣〃璇勮
    ]]>
    主站蜘蛛池模板: 亚洲成年人免费网站| 亚洲乱码中文字幕综合| 男人的天堂亚洲一区二区三区| 最好免费观看韩国+日本| 亚洲av无码天堂一区二区三区| 亚洲综合伊人久久综合| 久久亚洲私人国产精品vA| 国产亚洲精品影视在线| 免费无遮挡无遮羞在线看| 免费观看在线禁片| 97热久久免费频精品99| 国产免费人成在线视频| 亚洲精品国产品国语在线| 亚洲av专区无码观看精品天堂| 色偷偷亚洲第一综合| 好紧我太爽了视频免费国产 | 成人自慰女黄网站免费大全| 久久久久久成人毛片免费看| 天天摸夜夜摸成人免费视频 | 亚洲美女又黄又爽在线观看| 亚洲国产美女视频| 女人裸身j部免费视频无遮挡| 久久99精品免费视频| 麻豆精品国产免费观看| 精品久久香蕉国产线看观看亚洲| 99亚偷拍自图区亚洲| 国产一级a毛一级a看免费人娇| 在线观看无码AV网站永久免费| 亚洲乱码国产一区网址| 亚洲最大的视频网站| 成年免费大片黄在线观看com| 亚洲香蕉免费有线视频| 亚洲精品国产精品乱码不卞| 亚洲小视频在线播放| 国产精品小视频免费无限app| 男人的好免费观看在线视频| 国产精品福利片免费看| 免费人成网站在线观看10分钟| 久久亚洲精品无码观看不卡| 亚洲真人无码永久在线观看| 免费成人在线电影|