美国职业棒球比分多的获胜吗:BlogJava - 棒球比分大小怎么算|网站//www.355548.live/paulwong/zh-cnThu, 16 Jul 2020 00:06:33 GMTThu, 16 Jul 2020 00:06:33 GMT60Spring Cloud異步場景分布式事務怎樣做?試試RocketMQ - 棒球比分大小怎么算|网站//www.355548.live/paulwong/archive/2020/07/15/435596.htmlpaulwongpaulwongWed, 15 Jul 2020 02:33:00 GMT//www.355548.live/paulwong/archive/2020/07/15/435596.html//www.355548.live/paulwong/comments/435596.html//www.355548.live/paulwong/archive/2020/07/15/435596.html#Feedback0//www.355548.live/paulwong/comments/commentRss/435596.html//www.355548.live/paulwong/services/trackbacks/435596.html
分布式的場景下,訂單服務在一個JVM下,積分服務在另一個JVM下,兩者要如何才能達到數據一致(原子)性?


https://zlt2000.gitee.io/2019-09-23-rocketmq-transaction/


paulwong 2020-07-15 10:33 發表評論
]]>
!!zlt-microservices-platform - 棒球比分大小怎么算|网站//www.355548.live/paulwong/archive/2020/07/15/435595.htmlpaulwongpaulwongWed, 15 Jul 2020 02:15:00 GMT//www.355548.live/paulwong/archive/2020/07/15/435595.html//www.355548.live/paulwong/comments/435595.html//www.355548.live/paulwong/archive/2020/07/15/435595.html#Feedback0//www.355548.live/paulwong/comments/commentRss/435595.html//www.355548.live/paulwong/services/trackbacks/435595.html1. 總體架構圖

mark


2. 功能介紹

mark




https://github.com/zlt2000/microservices-platform 

https://zlt2000.gitee.io/

產品文檔(付費,微信登錄):
https://www.kancloud.cn/zlt2000/microservices-platform




paulwong 2020-07-15 10:15 發表評論
]]>
LINUX SHELL - 棒球比分大小怎么算|网站//www.355548.live/paulwong/archive/2020/07/06/435591.htmlpaulwongpaulwongMon, 06 Jul 2020 01:23:00 GMT//www.355548.live/paulwong/archive/2020/07/06/435591.html//www.355548.live/paulwong/comments/435591.html//www.355548.live/paulwong/archive/2020/07/06/435591.html#Feedback0//www.355548.live/paulwong/comments/commentRss/435591.html//www.355548.live/paulwong/services/trackbacks/435591.htmlhttps://tecadmin.net/tutorial/bash-scripting/

Check existence of input argument in a Bash shell script
https://stackoverflow.com/questions/6482377/check-existence-of-input-argument-in-a-bash-shell-script

How to Check if a File or Directory Exists in Bash
https://linuxize.com/post/bash-check-if-file-exists/

bash string compare to multiple correct values
https://stackoverflow.com/questions/21157435/bash-string-compare-to-multiple-correct-values

Bash – Check If Two Strings are Equal
https://tecadmin.net/tutorial/bash/examples/check-if-two-strings-are-equal/







paulwong 2020-07-06 09:23 發表評論
]]>
如何優雅地停止SPRING BATCH中的REMOTE CHUNKING JOB - 棒球比分大小怎么算|网站//www.355548.live/paulwong/archive/2020/06/23/435547.htmlpaulwongpaulwongTue, 23 Jun 2020 03:00:00 GMT//www.355548.live/paulwong/archive/2020/06/23/435547.html//www.355548.live/paulwong/comments/435547.html//www.355548.live/paulwong/archive/2020/06/23/435547.html#Feedback0//www.355548.live/paulwong/comments/commentRss/435547.html//www.355548.live/paulwong/services/trackbacks/435547.html 1、什么時候發出停止指令
2、如何等待遠程STEP的完成

一般停止JOB,可用JobOperator.stop(long executionId)來停止,但這個無法確定什么時候發出停止指令,如果是在CHUNK的處理中途發出,則會出現回滾的現象。
BATCH_STEP_EXECUTION - 棒球比分大小怎么算|网站 thead tr {background-color: ActiveCaption; color: CaptionText;} th, td {vertical-align: top; font-family: "Tahoma", Arial, Helvetica, sans-serif; font-size: 8pt; padding: 4px; } table, td {border: 1px solid silver;} table {border-collapse: collapse;} thead .col0 {width: 173px;} .col0 {text-align: right;} thead .col1 {width: 82px;} .col1 {text-align: right;} thead .col2 {width: 282px;} thead .col3 {width: 164px;} .col3 {text-align: right;} thead .col4 {width: 161px;} thead .col5 {width: 161px;} thead .col6 {width: 109px;} thead .col7 {width: 127px;} .col7 {text-align: right;} thead .col8 {width: 109px;} .col8 {text-align: right;} thead .col9 {width: 118px;} .col9 {text-align: right;} thead .col10 {width: 117px;} .col10 {text-align: right;} thead .col11 {width: 142px;} .col11 {text-align: right;} thead .col12 {width: 150px;} .col12 {text-align: right;} thead .col13 {width: 166px;} .col13 {text-align: right;} thead .col14 {width: 137px;} .col14 {text-align: right;} thead .col15 {width: 109px;} thead .col16 {width: 156px;} thead .col17 {width: 161px;}
STEP_EXECUTION_ID VERSION STEP_NAME JOB_EXECUTION_ID START_TIME END_TIME STATUS COMMIT_COUNT READ_COUNT FILTER_COUNT WRITE_COUNT READ_SKIP_COUNT WRITE_SKIP_COUNT PROCESS_SKIP_COUNT ROLLBACK_COUNT EXIT_CODE EXIT_MESSAGE LAST_UPDATED
2304 169 step2HandleXXX 434 2020-06-22 16:27:54 2020-06-22 16:32:46 STOPPED 167 5010 0 4831 0 155 0 161 STOPPED org.springframework.batch.core.JobInterruptedException 2020-06-22 16:32:46


另外SPRING BATCH也不會等遠程STEP執行完成,就將JOB的狀態設為Complete。

發出停止的指令應通過ChunkListener達成:

public class ItemMasterChunkListener extends ChunkListenerSupport{
    
    private static final Logger log = LoggerFactory.getLogger(ItemMasterChunkListener.class);
    
    
    @Override
    public void beforeChunk(ChunkContext context) {
        log.info("ItemMasterProcessor.beforeChunk");
    }


    @Override
    public void afterChunk(ChunkContext context) {
        log.info("ItemMasterProcessor.afterChunk");
        if(XXXX.isStoppingOrPausing()) {
            log.info("context.getStepContext().getStepExecution().setTerminateOnly()");
            context.getStepContext().getStepExecution().setTerminateOnly();
        }
    }


    @Override
    public void afterChunkError(ChunkContext context) {
        log.info("ItemMasterProcessor.afterChunkError");
    }


}


配置BEAN:

@Bean
@StepScope
public ItemMasterChunkListener novaXItemMasterChunkListener() {
     return new ItemMasterChunkListener();
}
    
this.masterStepBuilderFactory
                    .<X, X>get("step2Handle")
                    .listener(itemMasterChunkListener())
                    .build();


由于是在CHUNK完成的時候發出停止指令,就不會出現ROLLBACK的情況。

等待遠程STEP完成,通過讀取MQ上的MESSAGE是否被消費完成,PENDDING的MESSAGE為0的條件即可。

public class JobExecutionListenerSupport implements JobExecutionListener {

    /* (non-Javadoc)
     * @see org.springframework.batch.core.domain.JobListener#afterJob()
     
*/
    @Override
    public void afterJob(JobExecution jobExecution) {
        Integer totalPendingMessages = 0;
        String queueName = "";
        
        
        String messageSelector = "JOB_EXECUTION_ID=" + jobExecution.getJobInstance().getInstanceId();
        do{
            totalPendingMessages = 
                    this.jmsTemplate.browseSelected(queueName, messageSelector, 
                                (session, browser) -> 
                                    Collections.list(browser.getEnumeration()).size()
                            );
            
            String brokerURL = null;
            if(jmsTemplate.getConnectionFactory() instanceof JmsPoolConnectionFactory) {
                JmsPoolConnectionFactory connectionFactory =
                        (JmsPoolConnectionFactory)jmsTemplate.getConnectionFactory();
                ActiveMQConnectionFactory activeMQConnectionFactory =
                        (ActiveMQConnectionFactory)connectionFactory.getConnectionFactory();
                brokerURL = activeMQConnectionFactory.getBrokerURL();
            } else if(jmsTemplate.getConnectionFactory() instanceof CachingConnectionFactory) {
                CachingConnectionFactory connectionFactory =
                        (CachingConnectionFactory)jmsTemplate.getConnectionFactory();
                ActiveMQConnectionFactory activeMQConnectionFactory =
                        (ActiveMQConnectionFactory)connectionFactory.getTargetConnectionFactory();
                brokerURL = activeMQConnectionFactory.getBrokerURL();
            }
            
            LOGGER.info("queueName = {}, {}, totalPendingMessages = {}, url={}", 
                    queueName, messageSelector, totalPendingMessages, brokerURL);
            Assert.notNull(totalPendingMessages, "totalPendingMessages must not be null.");
            try {
                Thread.sleep(5_000);
            } catch (InterruptedException e) {
                LOGGER.error(e.getMessage(), e);
            }
        } while(totalPendingMessages.intValue() > 0);
        
    }

    /* (non-Javadoc)
     * @see org.springframework.batch.core.domain.JobListener#beforeJob(org.springframework.batch.core.domain.JobExecution)
     
*/
    @Override
    public void beforeJob(JobExecution jobExecution) {
    }

}


這樣整個JOB就能無異常地停止,且會等待遠程STEP完成。

Reference:
https://docs.spring.io/spring-batch/docs/4.1.3.RELEASE/reference/html/common-patterns.html#stoppingAJobManuallyForBusinessReasons

https://stackoverflow.com/questions/13603949/count-number-of-messages-in-a-jms-queue

https://stackoverflow.com/questions/55499965/spring-batch-stop-job-execution-from-external-class

https://stackoverflow.com/questions/34621885/spring-batch-pollable-channel-with-replies-contains-chunkresponses-even-if-job




paulwong 2020-06-23 11:00 發表評論
]]>
為啥文件的CHECKSUM中SHA512比MD5高級? - 棒球比分大小怎么算|网站//www.355548.live/paulwong/archive/2020/06/16/435513.htmlpaulwongpaulwongTue, 16 Jun 2020 02:21:00 GMT//www.355548.live/paulwong/archive/2020/06/16/435513.html//www.355548.live/paulwong/comments/435513.html//www.355548.live/paulwong/archive/2020/06/16/435513.html#Feedback0//www.355548.live/paulwong/comments/commentRss/435513.html//www.355548.live/paulwong/services/trackbacks/435513.htmlhttps://stackoverflow.com/questions/2117732/reasons-why-sha512-is-superior-to-md5


paulwong 2020-06-16 10:21 發表評論
]]>
GIT資源 - 棒球比分大小怎么算|网站//www.355548.live/paulwong/archive/2020/06/04/435480.htmlpaulwongpaulwongThu, 04 Jun 2020 02:38:00 GMT//www.355548.live/paulwong/archive/2020/06/04/435480.html//www.355548.live/paulwong/comments/435480.html//www.355548.live/paulwong/archive/2020/06/04/435480.html#Feedback0//www.355548.live/paulwong/comments/commentRss/435480.html//www.355548.live/paulwong/services/trackbacks/435480.html//jartto.wang/tags/git/



paulwong 2020-06-04 10:38 發表評論
]]>
徹底搞懂 Git-Rebase - 棒球比分大小怎么算|网站//www.355548.live/paulwong/archive/2020/06/04/435479.htmlpaulwongpaulwongThu, 04 Jun 2020 02:37:00 GMT//www.355548.live/paulwong/archive/2020/06/04/435479.html//www.355548.live/paulwong/comments/435479.html//www.355548.live/paulwong/archive/2020/06/04/435479.html#Feedback0//www.355548.live/paulwong/comments/commentRss/435479.html//www.355548.live/paulwong/services/trackbacks/435479.htmlGIT會將功能分支1上的所有COMMIT另存一個文件,回退到分支1原始狀態,再更新至當前分支1的狀態,再把另存文件的COMMIT執行一遍,就成了已經合并的新的功能分支1。

//jartto.wang/2018/12/11/git-rebase/


paulwong 2020-06-04 10:37 發表評論
]]>
How To Run Java Jar Application with Systemd on Linux - 棒球比分大小怎么算|网站//www.355548.live/paulwong/archive/2020/05/11/435427.htmlpaulwongpaulwongMon, 11 May 2020 08:16:00 GMT//www.355548.live/paulwong/archive/2020/05/11/435427.html//www.355548.live/paulwong/comments/435427.html//www.355548.live/paulwong/archive/2020/05/11/435427.html#Feedback0//www.355548.live/paulwong/comments/commentRss/435427.html//www.355548.live/paulwong/services/trackbacks/435427.htmlhttps://computingforgeeks.com/how-to-run-java-jar-application-with-systemd-on-linux/

systemd自啟動java程序
https://www.cnblogs.com/yoyotl/p/8178363.html
------------------------------------------------------------

[Unit]
Description=TestJava
After=network.target

[Service]
Type=forking
ExecStart=/home/test/startTest.sh
ExecStop=/home/test/stopTest.sh

[Install]
WantedBy=multi-user.target

-------------------------------------------------------------
How to Autorun application at the start up in Linux
https://developer.toradex.com/knowledge-base/how-to-autorun-application-at-the-start-up-in-linux

How to automatically run program on Linux startup
https://www.simplified.guide/linux/automatically-run-program-on-startup


Systemd 入門教程:實戰篇
https://www.ruanyifeng.com/blog/2016/03/systemd-tutorial-part-two.html

Systemd 入門教程:命令篇

//www.ruanyifeng.com/blog/2016/03/systemd-tutorial-commands.html

paulwong 2020-05-11 16:16 發表評論
]]>
MariaDB Galera Cluster - 棒球比分大小怎么算|网站//www.355548.live/paulwong/archive/2020/05/09/435424.htmlpaulwongpaulwongSat, 09 May 2020 03:08:00 GMT//www.355548.live/paulwong/archive/2020/05/09/435424.html//www.355548.live/paulwong/comments/435424.html//www.355548.live/paulwong/archive/2020/05/09/435424.html#Feedback0//www.355548.live/paulwong/comments/commentRss/435424.html//www.355548.live/paulwong/services/trackbacks/435424.htmlWhat is MariaDB Galera Cluster? https://mariadb.com/kb/en/what-is-mariadb-galera-cluster/

Prepare yum install repository:
https://downloads.mariadb.org/mariadb/repositories/#distro=CentOS&distro_release=centos7-amd64--centos7&mirror=coreix&version=10.4

MariaDB Galera Cluster部署實戰
https://jeremyxu2010.github.io/2018/02/mariadb-galera-cluster%E9%83%A8%E7%BD%B2%E5%AE%9E%E6%88%98/

9 Tips for Going in Production with Galera Cluster for MySQL
https://severalnines.com/blog/9-tips-going-production-galera-cluster-mysql

HA for MySQL and MariaDB - Comparing Master-Master Replication to Galera Cluster
https://severalnines.com/database-blog/ha-mysql-and-mariadb-comparing-master-master-replication-galera-cluster

Galera Cluster for MySQL - Tutorial
https://severalnines.com/resources/tutorials/galera-cluster-mysql-tutorial












paulwong 2020-05-09 11:08 發表評論
]]>
How to disable IPv6 on CentOS / RHEL 7 - 棒球比分大小怎么算|网站//www.355548.live/paulwong/archive/2020/05/06/435410.htmlpaulwongpaulwongWed, 06 May 2020 04:42:00 GMT//www.355548.live/paulwong/archive/2020/05/06/435410.html//www.355548.live/paulwong/comments/435410.html//www.355548.live/paulwong/archive/2020/05/06/435410.html#Feedback0//www.355548.live/paulwong/comments/commentRss/435410.html//www.355548.live/paulwong/services/trackbacks/435410.html https://www.thegeekdiary.com/centos-rhel-7-how-to-disable-ipv6/

https://linuxconfig.org/redhat-8-enable-disable-ipv6




]]>
{ganrao}