humbleCoder
humbleCoder

Reputation: 685

Can couchbase be used as the underlying JobRepository for spring-batch?

We have a requirement where we have to read a batch of a entitytype from the database, submit info about each entity to a service which will callback later with some data to update in the caller entity, save all the caller entities with the updated data. We thought of using spring-batch however we use Couchbase as our database which is eventually consistent and has no support for transactions.

I was going through the spring-batch documentation and I came across the Spring Batch Meta-Data ERD diagram here :

https://docs.spring.io/spring-batch/4.1.x/reference/html/index-single.html#metaDataSchema

With the above information in mind, my question is: Can Couchbase be used as the underlying job-repository for spring-batch? What are the things I should keep in mind if its possible to use it? Any links to example implementations would be welcome.

Upvotes: 1

Views: 280

Answers (1)

Mahmoud Ben Hassine
Mahmoud Ben Hassine

Reputation: 31600

The JobRepository needs to be transactional in order for Spring Batch to work properly. Here is an excerpt from the Transaction Configuration for the JobRepository section of the reference documentation:

The behavior of the framework is not well defined if the repository methods are not transactional.

Since Couchbase has no support for transactions as you mentioned, it is not possible to use it as an underlying datasource for the JobRepository.

Upvotes: 2

Related Questions