-
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.
create scheduler for checking reserved domain transactions
- Loading branch information
Showing
5 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
src/main/java/com/staketab/minanames/config/SchedulerConfig.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,11 @@ | ||
package com.staketab.minanames.config; | ||
|
||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.scheduling.annotation.EnableScheduling; | ||
|
||
@Configuration | ||
@EnableScheduling | ||
@ConditionalOnProperty(name = "scheduled.enabled", matchIfMissing = true) | ||
public class SchedulerConfig { | ||
} |
5 changes: 5 additions & 0 deletions
5
src/main/java/com/staketab/minanames/repository/PayableTransactionRepository.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 |
---|---|---|
@@ -1,9 +1,14 @@ | ||
package com.staketab.minanames.repository; | ||
|
||
import com.staketab.minanames.entity.PayableTransactionEntity; | ||
import com.staketab.minanames.entity.dto.TxStatus; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import java.util.List; | ||
|
||
@Repository | ||
public interface PayableTransactionRepository extends JpaRepository<PayableTransactionEntity, String> { | ||
|
||
List<PayableTransactionEntity> findAllByTxStatus(TxStatus txStatus); | ||
} |
22 changes: 22 additions & 0 deletions
22
src/main/java/com/staketab/minanames/scheduler/CheckerReservedTransactionScheduler.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,22 @@ | ||
package com.staketab.minanames.scheduler; | ||
|
||
import com.staketab.minanames.service.abstraction.TxService; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | ||
import org.springframework.scheduling.annotation.Scheduled; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Slf4j | ||
@Component | ||
@RequiredArgsConstructor | ||
@ConditionalOnProperty(value = "scheduled.checker-tx-reserve.enabled", havingValue = "true") | ||
public class CheckerReservedTransactionScheduler { | ||
|
||
private final TxService txService; | ||
|
||
@Scheduled(fixedDelayString = "${scheduled.checker-tx-reserve.upload-mills}") | ||
public void updateProjects() { | ||
txService.checkTransactions(); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -4,4 +4,5 @@ | |
|
||
public interface TxService { | ||
PayableTransactionEntity getOrCreate(String txHash); | ||
void checkTransactions(); | ||
} |
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