Last active
June 16, 2018 03:39
-
-
Save nattaphonjeamjit/84c2ff2a999752f6325bcd6476971a72 to your computer and use it in GitHub Desktop.
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
@Override | |
public void savePaymentStatus(String paymentId, AcquiringResponse.PaymentStatus paymentStatus) { | |
pmcRedisTemplate.execute(new SessionCallback<Void>(){ | |
@Override | |
public Void execute(RedisOperations operations) throws DataAccessException { | |
operations.watch(paymentId); | |
if (!findPaymentStatusByPaymentId(paymentId).isPresent()) { | |
operations.multi(); | |
updatePaymentStatus(paymentId, paymentStatus.getValue()); | |
operations.exec(); | |
logger.debug("Saving status {} of payment id {} success", paymentStatus.getValue(), paymentId); | |
} else { | |
logger.debug("Payment id {} is already in redis", paymentId); | |
} | |
return null; | |
} | |
}); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment