use of com.redhat.training.bank.message.NewBankAccount in project AD482-apps by RedHatTraining.
the class AccountResource method sendMessageAboutNewBankAccount.
private void sendMessageAboutNewBankAccount(BankAccount bankAccount) {
LOGGER.info("New Bank Account - ID: " + bankAccount.id + ", Balance: " + bankAccount.balance);
// TODO: Send a message about the new bank account
emitter.send(new NewBankAccount(bankAccount.id, bankAccount.balance));
}
use of com.redhat.training.bank.message.NewBankAccount in project AD482-apps by RedHatTraining.
the class NewBankAccountConsumer method processMessage.
// TODO: Create the consumer implementation
@Incoming("new-bank-account-in")
@Blocking
@Transactional
public void processMessage(NewBankAccount message) {
BankAccount entity = BankAccount.findById(message.getId());
if (entity != null) {
entity.profile = message.getBalance() < 100000 ? "regular" : "premium";
LOGGER.info("Updated Bank Account - ID: " + message.getId() + " - Type: " + entity.profile);
} else {
LOGGER.info("Bank Account not found!");
}
}
Aggregations