24 lines
629 B
Java
24 lines
629 B
Java
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();
|
|
}
|
|
}
|