use of tech.aroma.data.cassandra.Tables.Inbox in project aroma-data-operations by RedRoma.
the class CassandraInboxRepository method saveMessageForUser.
@Override
public void saveMessageForUser(@Required User user, @Required Message message, @Required LengthOfTime lifetime) throws TException {
checkThat(message).throwing(ex -> new InvalidArgumentException(ex.getMessage())).is(validMessage());
checkThat(user).throwing(ex -> new InvalidArgumentException(ex.getMessage())).is(validUser());
Statement insertStatement = createStatementToSaveMessage(message, user, lifetime);
try {
cassandra.execute(insertStatement);
} catch (Exception ex) {
LOG.error("Failed to save Message in Cassandra Inbox. User [{}] Message [{}]", user.userId, message, ex);
throw new OperationFailedException("Could not save message in Inbox: " + ex.getMessage());
}
}
Aggregations