Surya
Surya

Reputation: 11

Spring Batch - How to read data from JobExecutionContext

This is my business case - I receive a JMS message that has a unique database ID based on which I need to retrieve details from DB. Here are 2 options I'm exploring

a) Write a POJO JMS receiver - Then start the batch job. Now the challenge i'm facing is how do I pass the JMS message to the ItemReader? JobExecutionContext - This is not thread safe

b) Write the JMS receiver a ItemReader - Is it possible?

Note: I don't plan to use Spring Integration.

Upvotes: 1

Views: 213

Answers (1)

Mahmoud Ben Hassine
Mahmoud Ben Hassine

Reputation: 31590

  • For option a): You don't need the job execution context. Your Jms listener can start the job with the ID as a parameter, not as an attribute in the job execution context.
  • For option b): Yes that's possible. you can use the JmsItemReader for that.

Hope this helps.

Upvotes: 1

Related Questions