Код: Выделить всё
@Service
@RequiredArgsConstructor
public class MessageAsyncService {
@Async
public void run(Client client) {
while (no SIGTERM) {
Message message = getNewMessage(client);
if (message = null)
break;
sendMessage(client, message);
}
// Moreprocess
}
public void sendMessage(Client client, Message message) {
// Update DB
// Send message to client
// Send notification to another service
// Some other notification to another service
// Update DB
...
}
}
Подробнее здесь: https://stackoverflow.com/questions/787 ... al-is-sent