Spring Batch
Spring Cloud StreamをRabbitMQと組み合わせて、RabbitMQ管理画面から文字列をpublishしてspringアプリケーションでconsumeするだけのサンプルを作成する。 ソースコード・手順 build.gradle https://start.spring.io/ でCloud Stream, Spring for RabbitMQ…
Spring Batchは5.0から色々な変更が入った事を最近知った。 docs.spring.io What's new in Spring Batch 5 from ikeyat www.slideshare.net なので、良くやる設定などでとりあえず触ってみる。何分初めてさわるバージョンなので間違ってる事書いていたら申し…
従来、メタテーブルを永続化しなくするためにMapJobRepositoryFactoryBeanを使う事があったがspring-batch v5.0で削除予定になったようだ。 * @deprecated as of v4.3 in favor or using the {@link JobRepositoryFactoryBean} * with an in-memory database…
背景 Javaでキーブレイク*1を意識することはあまり無い。JPAならOneToManyで自動的にコレクションにマッピングされるし、JSONやXMLでも同様である。 今回、spring-batchでO/Rをとある事情で使えずSQLを直接使用、かつ、キーブレイクが必要になった。その実現…
https://docs.spring.io/spring-batch/docs/current/reference/html/monitoring-and-metrics.html を試す。 Spring Batch 4.2はMicrometerベースのメトリクスを自動的に収集する。なので、プロパティでそのメトリクスの送信設定をすれば、データがそちらに送…
現象 タイトル通りSpring Batch + MySQL + JTA(Atomikos)環境下で以下のような例外がスローされる。 Caused by: org.springframework.dao.DataAccessResourceFailureException: Unable to commit new sequence value changes for BATCH_JOB_SEQ at org.sprin…
Spring Batchのチュートリアル https://spring.io/guides/gs/batch-processing/ を動かします。このサンプルはいわゆるデータインポート処理で、CSVからデータ読み込み・変換・保存、を行います。 プロジェクト作成 Spring Bootの組み込みDB自動設定 build.g…
Spring Batchでstep間でデータを共有する方法について。機能的に豊富では無いが、そこはSpring Batchとして積極的に提供する機能では無い、という設計判断なのだと思う。 以下ではそのやり方について述べる。 JobのExecutionContext JobのExecutionContextに…
ソースコード plugins { id 'org.springframework.boot' version '2.2.2.RELEASE' id 'io.spring.dependency-management' version '1.0.8.RELEASE' id 'java' } dependencies { implementation 'org.springframework.boot:spring-boot-starter-batch' compil…
https://terasoluna-batch.github.io/guideline/5.0.0.RELEASE/ja/Ch05_FileAccess.html によると、コントロールブレイク処理(またはキーブレイク処理)、と呼ぶものをspring-batchで実現する方法について。 コントロールブレイク処理(またはキーブレイク処理…
https://docs.spring.io/spring-batch/docs/current/reference/html/scalability.html#partitioning のPartitioningを試す。 ソースコード plugins { id 'org.springframework.boot' version '2.2.2.RELEASE' id 'io.spring.dependency-management' version …
https://docs.spring.io/spring-batch/docs/4.1.x/reference/html/spring-batch-integration.html#remote-chunking のRemote Chunkingをためす。 このサンプルは、Spring Integegration -> Active MQを介してMasterからworkerおprocessor + writerを呼び出す…
https://docs.spring.io/spring-batch/docs/current/reference/html/scalability.html#scalabilityParallelSteps のパラレルstepを試す。http://kagamihoge.hatenablog.com/entry/2020/01/07/110847 は単一のstepをマルチスレッド化する方法だが、こちらは複…
https://docs.spring.io/spring-batch/docs/current/reference/html/scalability.html#scalability のMulti-threaded Stepを試す。 plugins { id 'org.springframework.boot' version '2.2.2.RELEASE' id 'io.spring.dependency-management' version '1.0.8.…
現象 ほぼタイトルで言い切っているけど。spring-batchでメタデータ保存でDBを使わなないようインメモリに格納するMapJobRepositoryFactoryBeanを使う場合が稀に良くある。この状況下で大量のstepを含むjobを実行すると徐々に実行速度が低下していく、という…
spring-integration勉強中です。 spring-integrationに文字列でjob名を渡し、その先でspring-batchを起動、をつくる。https://github.com/pakmans/spring-batch-integration-example/blob/master/pom.xml を参考にした。
https://docs.spring.io/spring-batch/4.1.x/reference/html/spring-batch-integration.html#springBatchIntegration https://qiita.com/kagamihoge/items/12fbbc2eac5b8a5ac1e0 俺の訳一覧リスト 1. Spring Batch Integration 1.1. Spring Batch Integratio…
https://docs.spring.io/spring-batch/4.1.x/reference/html/jsr-352.html#jsr-352 https://qiita.com/kagamihoge/items/12fbbc2eac5b8a5ac1e0 俺の訳一覧リスト *1 1. JSR-352 Support Spring Batch 3.0以降はJSR-352を完全に実装しています。このセクショ…
https://docs.spring.io/spring-batch/4.1.x/reference/html/common-patterns.html#commonPatterns https://qiita.com/kagamihoge/items/12fbbc2eac5b8a5ac1e0 俺の訳一覧リスト 1. Common Batch Patterns ある種のジョブはSpring Batch標準コンポーネントの…
https://docs.spring.io/spring-batch/4.1.x/reference/html/testing.html#testing https://qiita.com/kagamihoge/items/12fbbc2eac5b8a5ac1e0 俺の訳一覧リスト 1. Unit Testing バッチ以外のアプリケーション同様に、バッチジョブの一部として書いたコード…
https://docs.spring.io/spring-batch/4.1.x/reference/html/retry.html#retry https://qiita.com/kagamihoge/items/12fbbc2eac5b8a5ac1e0 俺の訳一覧リスト 1. Retry 処理をロバストかつ失敗の可能性を下げるには、次回以降には成功する確率が高い場合、そ…
https://docs.spring.io/spring-batch/4.1.x/reference/html/repeat.html#repeat https://qiita.com/kagamihoge/items/12fbbc2eac5b8a5ac1e0 俺の訳一覧リスト 1. Repeat 1.1. RepeatTemplate バッチ処理とは繰り返し処理であり、simple optimizationとなる…
https://docs.spring.io/spring-batch/4.1.x/reference/html/scalability.html#scalability https://qiita.com/kagamihoge/items/12fbbc2eac5b8a5ac1e0 俺の訳一覧リスト 1. Scaling and Parallel Processing 大半のバッチ処理はシングルスレッド・シングル…
https://docs.spring.io/spring-batch/4.1.x/reference/html/readersAndWriters.html#readersAndWriters https://qiita.com/kagamihoge/items/12fbbc2eac5b8a5ac1e0 俺の訳一覧リスト 1.7. XML Item Readers and Writers Spring BatchはXMLを読み込みJavaオ…
https://docs.spring.io/spring-batch/4.1.x/reference/html/readersAndWriters.html#readersAndWriters https://qiita.com/kagamihoge/items/12fbbc2eac5b8a5ac1e0 俺の訳一覧リスト 1. ItemReaders and ItemWriters すべてのバッチ処理は、大規模データの…
https://docs.spring.io/spring-batch/4.1.x/reference/html/step.html#configureStep https://qiita.com/kagamihoge/items/12fbbc2eac5b8a5ac1e0 俺の訳一覧リスト 1. Configuring a Step ドメインのチャプターで解説したように、Stepは、バッチjobのシーケ…
https://docs.spring.io/spring-batch/4.1.x/reference/html/job.html#configureJob https://qiita.com/kagamihoge/items/12fbbc2eac5b8a5ac1e0 俺の訳一覧リスト 1. Configuring and Running a Job domain sectionでは、以下図を用いてアーキテクチャデザイ…
https://docs.spring.io/spring-batch/4.1.x/reference/html/domain.html#domainLanguageOfBatch https://qiita.com/kagamihoge/items/12fbbc2eac5b8a5ac1e0 俺の訳一覧リスト 1. The Domain Language of Batch 何らかの経験のあるバッチアーキテクトにとっ…
https://docs.spring.io/spring-batch/4.1.x/reference/html/whatsnew.html#whatsNew https://qiita.com/kagamihoge/items/12fbbc2eac5b8a5ac1e0 俺の訳一覧リスト 1. What’s New in Spring Batch 4.1 Spring Batch 4.1 releaseは以下の新機能があります。 @…
https://docs.spring.io/spring-batch/4.1.x/reference/html/spring-batch-intro.html#spring-batch-intro https://qiita.com/kagamihoge/items/12fbbc2eac5b8a5ac1e0 俺の訳一覧リスト 1. Spring Batch Introduction エンタープライズ領域の多くのアプリケ…