-
Notifications
You must be signed in to change notification settings - Fork 0
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
Marc Gorzala
committed
Mar 28, 2024
1 parent
c5d9082
commit 10f49f0
Showing
10 changed files
with
89 additions
and
32 deletions.
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
16 changes: 16 additions & 0 deletions
16
src/main/java/net/dancier/kikeriki/adapter/out/infomail/InfoMailCheckJob.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,16 @@ | ||
package net.dancier.kikeriki.adapter.out.infomail; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.scheduling.annotation.Scheduled; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class InfoMailCheckJob { | ||
private static final Logger log = LoggerFactory.getLogger(InfoMailCheckJob.class); | ||
|
||
@Scheduled(fixedRate = 5000L) | ||
public void recheck() { | ||
log.info("rechecking"); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/java/net/dancier/kikeriki/adapter/out/infomail/InfomailServiceAdapter.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,12 @@ | ||
package net.dancier.kikeriki.adapter.out.infomail; | ||
|
||
import net.dancier.kikeriki.application.port.ScheduleInfomailCheck; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
public class InfomailServiceAdapter implements ScheduleInfomailCheck { | ||
@Override | ||
public void schedule(LocalDateTime when, String dancerId) { | ||
|
||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
src/main/java/net/dancier/kikeriki/application/CheckAndSendService.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 net.dancier.kikeriki.application; | ||
|
||
import jakarta.transaction.Transactional; | ||
import lombok.RequiredArgsConstructor; | ||
import net.dancier.kikeriki.application.domain.model.state.State; | ||
import net.dancier.kikeriki.application.port.StatePort; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
public class CheckAndSendService { | ||
private final Logger log = LoggerFactory.getLogger(CheckAndSendService.class); | ||
|
||
private final StatePort statePort; | ||
|
||
@Transactional | ||
public void checkAndSend(String dancerId) { | ||
log.info("CheckAndSend for {}", dancerId); | ||
State state = statePort.get(dancerId); | ||
if (state.isCandidateForSendingMail(LocalDateTime.now())) { | ||
sendMail(dancerId); | ||
statePort.save(state.toDto(), dancerId); | ||
} | ||
} | ||
public void sendMail(String dancerId) { | ||
log.info("Sending InfoMail..."); | ||
} | ||
} |
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
8 changes: 8 additions & 0 deletions
8
src/main/java/net/dancier/kikeriki/application/port/ScheduleInfomailCheck.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,8 @@ | ||
package net.dancier.kikeriki.application.port; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
public interface ScheduleInfomailCheck { | ||
void schedule(LocalDateTime when, String dancerId); | ||
|
||
} |
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
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