-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7f0d72d
commit ec64b98
Showing
3 changed files
with
113 additions
and
1 deletion.
There are no files selected for viewing
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
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
32 changes: 32 additions & 0 deletions
32
sources/relational/debezium-reactivator/src/main/java/com/drasi/ShutdownListener.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.drasi; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.beans.factory.annotation.Qualifier; | ||
import org.springframework.context.ApplicationListener; | ||
import org.springframework.context.event.ContextClosedEvent; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class ShutdownListener implements ApplicationListener<ContextClosedEvent> { | ||
|
||
private static final Logger log = LoggerFactory.getLogger(ShutdownListener.class); | ||
|
||
private final ChangeMonitor changeMonitor; | ||
|
||
@Autowired | ||
public ShutdownListener(@Qualifier("changeMonitor") ChangeMonitor changeMonitor) { | ||
this.changeMonitor = changeMonitor; | ||
} | ||
|
||
@Override | ||
public void onApplicationEvent(ContextClosedEvent event) { | ||
log.info("Reactivator is shutting down."); | ||
try { | ||
changeMonitor.close(); | ||
} catch (Exception e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
} |