Created
March 9, 2022 07:39
-
-
Save egcodes/288ab0b0293c355097c363e55268a59f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Configuration | |
@RequiredArgsConstructor(onConstructor = @__(@Autowired)) | |
public class ShedlockMongoConfiguration { | |
private final MongoFactory mongoFactory; | |
private final MongoReplicaSetFactory mongoReplicaSetFactory; | |
@Value("${sahibinden.mongodb.dbs.sahibinden.replicaSetName}") | |
private String mongoReplicaSetName; | |
@Bean | |
public LockProvider lockProvider() { | |
var mongoClient = (MongoClient) this.mongoReplicaSetFactory.getMongo(mongoReplicaSetName); | |
return new MongoLockProvider(mongoClient.getDatabase(mongoFactory.getDatabaseName())); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment