-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce MessageListResponse so that correlationIds are not duplicat…
…ed for each message (since it would all be the same id) but only once in the body of the response.
- Loading branch information
Showing
4 changed files
with
48 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/main/kotlin/au/kilemon/messagequeue/rest/response/MessageListResponse.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package au.kilemon.messagequeue.rest.response | ||
|
||
import au.kilemon.messagequeue.filter.CorrelationIdFilter | ||
import au.kilemon.messagequeue.message.QueueMessage | ||
import io.swagger.v3.oas.annotations.media.Schema | ||
import org.slf4j.MDC | ||
|
||
/** | ||
* Response object used when multiple messages are being returned. | ||
* | ||
* @author github.com/Kilemonn | ||
*/ | ||
class MessageListResponse { | ||
@Schema(title = "The request correlation ID.", example = "1599dcd3-7424-4f97-bc99-b9b3e5c53d59", | ||
description = "A UUID that uniquely identifies the performed request. This will correlate with any logs written as part of this request for debugging purposes.") | ||
val correlationId: String? = MDC.get(CorrelationIdFilter.CORRELATION_ID) | ||
|
||
@Schema(description = "The retrieved or created QueueMessages.") | ||
val messages: List<QueueMessage> | ||
|
||
/** | ||
* Not converting to primary constructor, so we can use [Schema] annotations. | ||
*/ | ||
constructor(messages: List<QueueMessage>) | ||
{ | ||
this.messages = messages | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters