Skip to content

Commit 2888b7c

Browse files
committed
[ESWE-1080] Fixes around missing queue
1) add back missing queue for local run 2) add back error log (cause) 3) add back missing `eventType` (message attribute) 4) rename queueId
1 parent 7f529a5 commit 2888b7c

File tree

5 files changed

+10
-5
lines changed

5 files changed

+10
-5
lines changed

src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/controllers/v1/person/ExpressionInterestController.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class ExpressionInterestController(
6060

6161
return ResponseEntity.ok().build()
6262
} catch (e: Exception) {
63-
logger.info("ExpressionInterestController: Unable to send message: ${e.message}")
63+
logger.error("ExpressionInterestController: Unable to send message: ${e.message}", e)
6464
return ResponseEntity.status(HttpStatus.BAD_REQUEST).build<Void>()
6565
}
6666
}

src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/exception/MessageFailedException.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ package uk.gov.justice.digital.hmpps.hmppsintegrationapi.exception
22

33
class MessageFailedException(
44
msg: String,
5-
) : RuntimeException(msg)
5+
cause: Throwable? = null,
6+
) : RuntimeException(msg, cause)

src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/services/PutExpressionInterestService.kt

+4-2
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@ import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.ExpressionO
88
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.ExpressionOfInterestMessage
99
import uk.gov.justice.hmpps.sqs.HmppsQueue
1010
import uk.gov.justice.hmpps.sqs.HmppsQueueService
11+
import uk.gov.justice.hmpps.sqs.eventTypeMessageAttributes
1112
import java.util.UUID
1213

1314
@Component
1415
class PutExpressionInterestService(
1516
private val hmppsQueueService: HmppsQueueService,
1617
private val objectMapper: ObjectMapper,
1718
) {
18-
private val eoiQueue by lazy { hmppsQueueService.findByQueueId("eoi-queue") as HmppsQueue }
19+
private val eoiQueue by lazy { hmppsQueueService.findByQueueId("jobsboardintegration") as HmppsQueue }
1920
private val eoiQueueSqsClient by lazy { eoiQueue.sqsClient }
2021
private val eoiQueueUrl by lazy { eoiQueue.queueUrl }
2122

@@ -35,10 +36,11 @@ class PutExpressionInterestService(
3536
.builder()
3637
.queueUrl(eoiQueueUrl)
3738
.messageBody(messageBody)
39+
.eventTypeMessageAttributes("mjma-jobs-board.job.expression-of-interest.created")
3840
.build(),
3941
)
4042
} catch (e: Exception) {
41-
throw MessageFailedException("Failed to send message to SQS")
43+
throw MessageFailedException("Failed to send message to SQS", e)
4244
}
4345
}
4446
}

src/main/resources/application-local.yml

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ hmpps.sqs:
1919
queues:
2020
audit:
2121
queueName: "audit"
22+
jobsboardintegration:
23+
queueName: "jobsboard-integration"
2224

2325
authorisation:
2426
consumers:

src/test/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/services/PutExpressionInterestServiceTest.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class PutExpressionInterestServiceTest :
3838

3939
beforeTest {
4040
reset(mockQueueService, mockSqsClient, mockObjectMapper)
41-
whenever(mockQueueService.findByQueueId("eoi-queue")).thenReturn(eoiQueue)
41+
whenever(mockQueueService.findByQueueId("jobsboardintegration")).thenReturn(eoiQueue)
4242
}
4343

4444
describe("sendExpressionOfInterest") {

0 commit comments

Comments
 (0)