1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Talend ジョブの重複起動をTouchファイルで管理する

Posted at

はじめに

例として5分に1回呼び出される想定のジョブをtalendで作成した場合に、5分で処理が終わらずジョブが実行された状態で再度ジョブを実行するとエラーになります。
そのため、現在ジョブが動作しているかを確認するためにTalendのtFileTouchコンポーネントを利用する例を備忘録として記載します。

touchコマンドとは

touchはLinuxのコマンドとして用意されています。
機能として
* ファイルのタイムスタンプ変更
* 存在しないファイル名を指定するとファイルを新規作成
があります。-tで指定のタイムスタンプに更新が可能でオプション指定がない場合は現在時刻に更新されます。

touch sample.bat -t 指定の時刻へ更新

TalandにはtFileTouchコンポーネントが用意されており機能としてファイルを作成することができるため、この機能を利用しジョブ起動中のみ既定のファイルが存在する処理をジョブに追加することで重複起動を管理します。
image.png

Touchファイル確認手順

  1. touchファイルがあるか確認する
  2. ファイルがなければ作成しジョブの処理を継続、あればジョブを停止
  3. touchファイル削除

各コンポーネントのファイル名に追加

パラメータ.txt
ファイル名: "C:/talend/TOS_DI-Win32-20200219_1130-V7.3.1/workspace/job.touch"

tFileExist_1

条件分岐.txt
((Boolean)globalMap.get("tFileExist_1_EXISTS")) == false
((Boolean)globalMap.get("tFileExist_1_EXISTS")) == true

tFileTouch_1

オプション.txt
存在しない場合、ディレクトリを作成にチェック

tFileExist_2

パラメータ.txt
((Boolean)globalMap.get("tFileExist_1_EXISTS")) == true

image.png

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?