Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Comments

Fix waitFor and messagesLimit behaviour in Kafka consumer#584

Merged
yesnault merged 2 commits intoovh:masterfrom
sixstone-qq:sixstone-002/kafka/fix-wait-for
Sep 2, 2022
Merged

Fix waitFor and messagesLimit behaviour in Kafka consumer#584
yesnault merged 2 commits intoovh:masterfrom
sixstone-qq:sixstone-002/kafka/fix-wait-for

Conversation

@sixstone-qq
Copy link
Contributor

This PR includes two fixes over Kafka consumer executor:

  1. waitFor didn't work in some cases mixed with timeout property
    as it is reused by test executor. Using a goroutine over
    consume claim we can work on timeout and wait for without issues.

  2. messageLimit after Improve Kafka executor #448 may only work if there are more messages to
    consume in the topic, if the message limit is hit after consuming the
    last message from the topic, the condition is never met and it waits
    until timeout is reached leading to longer Kafka consumer step
    executions.

Before this, it may collide with timeout set and it didn't wait for it.

Signed-off-by: Enrique J. Hernández <[email protected]>
When there are no more messages to consume it may happen
the Kafka consumer times out failing but it actually consume
all messages

Signed-off-by: Enrique J. Hernández <[email protected]>
@sixstone-qq sixstone-qq force-pushed the sixstone-002/kafka/fix-wait-for branch from 6d6bd7f to 6244da7 Compare September 2, 2022 11:07
Copy link
Contributor

@philippgille philippgille left a comment

Choose a reason for hiding this comment

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

I forgot the second msg limit check in the other PR. Thanks for fixing it! LGTM

Copy link
Member

@yesnault yesnault left a comment

Choose a reason for hiding this comment

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

LGTM, thank you.

@yesnault yesnault merged commit 0649776 into ovh:master Sep 2, 2022
@fabriziomoscon
Copy link
Contributor

I am using: v1.1.0-rc.1

@sixstone-qq @philippgille I am experiencing that waitFor is now mandatory for kafka consumer executor. (note that the readme says optional).
If I don't specify it I receive a context deadline exceeded error:

step #2-0: Assertion "result.err ShouldBeEmpty" failed. expected 'kafka consumed failed: context deadline exceeded'

my full consumer looks as follow:

- type: kafka
      clientType: consumer
      withTLS: false
      withSASL: false
      withAVRO: true
      kafkaVersion: "2.6.0"
      markOffset: true
      initialOffset: oldest
      waitFor: 1
      groupID: venom
      addrs:
        - "{{.kafkaHost}}:{{.kafkaPort}}"
      schemaRegistryAddr: "{{.kafkaSchemaRegistryHost}}"
      topics:
        - "{{.ticketUpsertCommand}}"
      assertions:
        - result.err ShouldBeEmpty
        - result.messages.__len__ ShouldEqual 1
        - result.messagesjson.messagesjson0.value ShouldNotBeEmpty
        - result.messagesjson.messagesjson0.value.description ShouldContainSubstring "Strong Winds in 2 hours"

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.

4 participants