I want to send a list from rest client to rest web service which will start a job in Spring Batch. Is that possible or must I save the list in database/flatfile before start
If you look at actual schema which stores meta data for spring batch
you will see list of available types supported by job to be parameters (there is string_val
, date_val
, long_val
, double_val
). So when job is started each job parameter is persisted in DB with key_name
as name of parameter and value stored in one of mentioned _val
tables. type_cd
gives a hint which type was used.
Also documentation for JobParameter gives a hint what can be used as job parameter:
Domain representation of a parameter to a batch job. Only the following types can be parameters: String, Long, Date, and Double. The identifying flag is used to indicate if the parameter is to be used as part of the identification of a job instance.
I think best way would be either to create table in DB which stores list of parameters and pass id of that record as JobParameter
or to serialize list to json and pass it as String
in job as JobParameter
. If you go with second option be aware that string_val
is stored in DB as varchar
250 so limit is 250 characters.