[25.09.20] Added GatewayDLQ use
This commit is contained in:
parent
cd82fec43a
commit
9434872193
@ -33,6 +33,7 @@ public class PriceConsumer {
|
||||
private final PriceService priceService;
|
||||
private final DlqService dlqService;
|
||||
private final String dlqName;
|
||||
private final String dlqGateway;
|
||||
|
||||
private CountDownLatch latch = new CountDownLatch(1);
|
||||
|
||||
@ -41,12 +42,14 @@ public class PriceConsumer {
|
||||
ObjectMapper objectMapper,
|
||||
PriceService priceService,
|
||||
DlqService dlqService,
|
||||
@Value("${destinations.pricing.priceDlq}") String dlqName
|
||||
@Value("${destinations.pricing.priceDlq}") String dlqName,
|
||||
@Value("${destinations.gateway.gatewayDlq}") String dlqGateway
|
||||
) {
|
||||
this.objectMapper = objectMapper;
|
||||
this.priceService = priceService;
|
||||
this.dlqService = dlqService;
|
||||
this.dlqName = dlqName;
|
||||
this.dlqGateway = dlqGateway;
|
||||
}
|
||||
|
||||
@JmsListener(destination = "${destinations.pricing.priceSave}")
|
||||
@ -100,7 +103,20 @@ public class PriceConsumer {
|
||||
});
|
||||
latch.countDown();
|
||||
} catch (JMSException jmsException) {
|
||||
logger.error("An Exception has occurred with a JMS action [%s]", jmsException);
|
||||
String dlqReason = format("An Exception [%s] has occurred with a JMS action [%s] on [%s]", CONSUME_PRICE_EVENT, jmsException,
|
||||
correlationId);
|
||||
|
||||
DlqInfo dlqInfo = new DlqInfo(
|
||||
message.getJMSMessageID(),
|
||||
dlqGateway,
|
||||
dlqReason,
|
||||
"0",
|
||||
correlationId
|
||||
);
|
||||
dlqService.sendToDlq(message, CONSUME_PRICE_EVENT.getMessage(), dlqInfo, jmsException, textMessage -> {
|
||||
textMessage.setStringProperty(MESSAGE_SAVE_SYNC_ID.getMessage(), syncId);
|
||||
return textMessage;
|
||||
});
|
||||
latch.countDown();
|
||||
} catch (Exception e) {
|
||||
String dlqReason = format("Couldn't sync incoming %s for price event [%s]", CONSUME_PRICE_EVENT, correlationId);
|
||||
|
||||
@ -30,6 +30,8 @@ destinations:
|
||||
pricing:
|
||||
priceSave: PricingSave
|
||||
priceDlq: PricingSave.dlq
|
||||
gateway:
|
||||
gatewayDlq: DBGateway.dlq
|
||||
|
||||
server:
|
||||
port: 9090
|
||||
Loading…
x
Reference in New Issue
Block a user