Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ESWE-1181] Fix API clients, JPA auditing #25

Merged
merged 2 commits into from
Jan 30, 2025

Conversation

rickchoijd
Copy link
Contributor

Fix API clients

  1. MN API client: missing body
  2. JB API client: scopes' separator
  3. Error & debug logging
  4. Rename container name of local hmpps-auth (avoid conflict at Docker)

Fix JPA auditing

  • enable JPA auditing for @CreatedDate and @LastModifiedDate

1) MN API client: missing body
2) JB API client: scopes' separator
3) Error logging
4) Rename container name of local hmpps-auth (avoid conflict at Docker)
enable JPA auditing for `@CreatedDate` and `@LastModifiedDate`
@rickchoijd rickchoijd requested a review from gbmojo January 30, 2025 16:37
Comment on lines -27 to +29
container_name: hmpps-auth
container_name: integration-hmpps-auth
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename container for avoiding name clash to hmpps-auth instance (standalone at 9090)

import org.springframework.data.jpa.repository.config.EnableJpaAuditing

@Configuration
@EnableJpaAuditing
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enable JPA auditing for audit fields (create and last updated timestamps)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add client logging for troubleshooting, disabled by default.
enable this by setting api.client.logging.enabled to true, when needed

Comment on lines +31 to +33
.onErrorResume(WebClientResponseException.NotFound::class.java) { error ->
val errorResponse = if (error is WebClientResponseException) error.responseBodyAsString else null
log.warn("Employer not found. employerId={}; errorResponse={}", id, errorResponse)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error logging - write down the error response, if any

Comment on lines +32 to +34
.onErrorResume { error ->
val errorResponse = if (error is WebClientResponseException) error.responseBodyAsString else null
Mono.error(Exception("Fail to create employer! errorResponse=$errorResponse", error))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error logging - write down the error response, if any


logging.level:
uk.gov.justice.digital.hmpps.jobsboardintegrationapi:
shared.infrastructure: DEBUG
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set this to TRACE for troubleshooting

logging.level:
uk.gov.justice.digital.hmpps.jobsboardintegrationapi:
shared.infrastructure: DEBUG
reactor.netty.http.client: INFO
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set this to DEBUG for troubleshooting

@rickchoijd rickchoijd merged commit 8c256ff into main Jan 30, 2025
6 checks passed
@rickchoijd rickchoijd deleted the ESWE-1181-publish-employers-events-2 branch January 30, 2025 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants