Initial commit
This commit is contained in:
23
src/main/java/com/test/payment/jobs/MpesaTransactionJob.java
Normal file
23
src/main/java/com/test/payment/jobs/MpesaTransactionJob.java
Normal file
@@ -0,0 +1,23 @@
|
||||
package com.test.payment.jobs;
|
||||
|
||||
|
||||
import com.test.payment.repository.MpesaRepository;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class MpesaTransactionJob {
|
||||
|
||||
private final MpesaRepository mpesaRepository;
|
||||
|
||||
@Scheduled(fixedDelay = 60000)
|
||||
public void pullTransactions() {
|
||||
mpesaRepository.findAllTransactions()
|
||||
.doOnNext(tx -> log.info("Checking transaction: {}", tx))
|
||||
.subscribe();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user