Skip to content

Commit

Permalink
fix: publish message with 1h ttl (#396)
Browse files Browse the repository at this point in the history
Messages were published with a TTL of 5 minutes, which means the engine
buffers them for 5 minutes. The buffered message is then expected to
correlate to a process instance's event later in the chaos experiment.

However, in some cases, the chaos experiment takes longer than these 5
minutes. When the message is expired, the chaos experiment can no longer
succeed even though it retries for an hour. For example, this occurred
in the action:
- Should be able to create a process instance and await the message
correlation

Changing the TTL of the published message fixes this problem by
buffering the message for the same duration as the retry period.
  • Loading branch information
ChrisKujawa authored Aug 24, 2023
2 parents e6accf7 + 75b09a7 commit 3cc7593
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion go-chaos/cmd/publish.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func AddPublishCmd(rootCmd *cobra.Command, flags *Flags) {

internal.LogVerbose("Send message '%s', with correaltion key '%s' (ASCII: %d) ", flags.msgName, correlationKey, int(correlationKey[0]))

messageResponse, err := zbClient.NewPublishMessageCommand().MessageName(flags.msgName).CorrelationKey(correlationKey).TimeToLive(time.Minute * 5).Send(context.TODO())
messageResponse, err := zbClient.NewPublishMessageCommand().MessageName(flags.msgName).CorrelationKey(correlationKey).TimeToLive(time.Hour * 1).Send(context.TODO())
partitionIdFromKey := internal.ExtractPartitionIdFromKey(messageResponse.Key)

internal.LogInfo("Message was sent and returned key %d, which corresponds to partition: %d", messageResponse.Key, partitionIdFromKey)
Expand Down

0 comments on commit 3cc7593

Please sign in to comment.