Skip to content

Commit 76c5ea6

Browse files
emilklassonPhilip Pålsson
andauthored
Correlation id as a custom type (#13)
Co-authored-by: Philip Pålsson <philip.palsson@insurello.se>
1 parent ef4bc6e commit 76c5ea6

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/Insurello.RabbitMqClient/MqClient.fs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,12 @@ module MqClient =
5252
| Json of string
5353
| Binary of byte array
5454

55+
type CorrelationId =
56+
| Generate
57+
| Id of string
58+
5559
type PublishMessage =
56-
{ CorrelationId: string
60+
{ CorrelationId: CorrelationId
5761
Headers: Map<string, string>
5862
Content: Content }
5963

@@ -431,7 +435,10 @@ module MqClient =
431435
(ContentType = contentTypeStringFromContent message.Content,
432436
Persistent = true,
433437
MessageId = messageId,
434-
CorrelationId = message.CorrelationId,
438+
CorrelationId =
439+
(match message.CorrelationId with
440+
| Generate -> ""
441+
| Id correlationId -> correlationId),
435442
Headers =
436443
(message.Headers
437444
|> Map.map (fun _ v -> v :> obj)

0 commit comments

Comments
 (0)