redelivery protection
This commit is contained in:
parent
2e37b8eec9
commit
23bc84bd98
@ -6,6 +6,7 @@ import java.nio.file.Path;
|
|||||||
import java.time.OffsetDateTime;
|
import java.time.OffsetDateTime;
|
||||||
import java.time.temporal.ChronoUnit;
|
import java.time.temporal.ChronoUnit;
|
||||||
|
|
||||||
|
import org.springframework.amqp.AmqpRejectAndDontRequeueException;
|
||||||
import org.springframework.amqp.core.Message;
|
import org.springframework.amqp.core.Message;
|
||||||
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
||||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||||
@ -40,6 +41,10 @@ public class OcrMessageReceiver {
|
|||||||
@RabbitListener(queues = MessagingConfiguration.OCR_REQUEST_QUEUE, concurrency = "1")
|
@RabbitListener(queues = MessagingConfiguration.OCR_REQUEST_QUEUE, concurrency = "1")
|
||||||
public void receiveOcr(Message in) throws IOException {
|
public void receiveOcr(Message in) throws IOException {
|
||||||
|
|
||||||
|
if (in.getMessageProperties().isRedelivered()) {
|
||||||
|
throw new AmqpRejectAndDontRequeueException("Redelivered OCR Request, aborting...");
|
||||||
|
}
|
||||||
|
|
||||||
DocumentRequest ocrRequestMessage = objectMapper.readValue(in.getBody(), DocumentRequest.class);
|
DocumentRequest ocrRequestMessage = objectMapper.readValue(in.getBody(), DocumentRequest.class);
|
||||||
String dossierId = ocrRequestMessage.getDossierId();
|
String dossierId = ocrRequestMessage.getDossierId();
|
||||||
String fileId = ocrRequestMessage.getFileId();
|
String fileId = ocrRequestMessage.getFileId();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user