0

I have SpringBoot microservices which points to MSSQL (primary/secondary, no Listner) and getting DB connection from config engine. Below are the properties.

spring.datasource.url=jdbc:sqlserver://{primarydb}:{port};databaseName={DBname};failoverPartner={secondarydb};databaseName={DBname}
spring.datasource.username={user}
spring.datasource.password={passwd}

Since we don't have Listner for our DB, when DBA switch primarydb our microservices start failing. Once we loose DB connection we should receive an email/phone text notification. Can somebody please guide me how to acheive this?

As a workaround we restage those microservices in order to establish DB connection. In future we are going to have Listner for our DB which will point to primary/secondary whichever is active.

Rohan Dongre
  • 39
  • 10
  • Have you already investigated the spring.datasource.testonborrow or spring.datasource.testWhileIdle properties ? It could allow you to sent a valdiation query and uppon fail you could manage to catch the rror and plug whatever warning service you may want – damus4 Aug 23 '19 at 20:36
  • Thanks @damus4 I will definitely try this. – Rohan Dongre Aug 24 '19 at 16:04

0 Answers0