Skip to content

Commit

Permalink
Debug job detail.
Browse files Browse the repository at this point in the history
  • Loading branch information
sonus21 committed Dec 3, 2019
1 parent b12f7b0 commit 177593b
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,23 @@
import com.github.sonus21.rqueue.spring.boot.application.app.service.FailureManager;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

@Component
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
@Transactional
@Slf4j
public class MessageListener {
@NonNull private ConsumedMessageService consumedMessageService;
@NonNull private FailureManager failureManager;

@RqueueListener("${job.queue.name}")
public void onMessage(Job job) throws Exception {
if (failureManager.shouldFail(job.getId())) {
log.debug("{}", job);
throw new Exception("Failing job task to be retried");
}
consumedMessageService.save(job);
Expand Down

0 comments on commit 177593b

Please sign in to comment.