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

Feature / enable&disable duration #81

Merged
merged 8 commits into from
Sep 3, 2024

Conversation

ugurcanerdogan
Copy link
Member

By disabling the duration feature, the exception topic is continuously consumed. When the messages that come after the cron statement is triggered are consumed while they are in the currently running batch process, the current consumption process is closed and this message is published to the topic again to be consumed at the new trigger time.

This PR also includes naming changes.

#77

cronsumer.go Outdated
@@ -29,5 +29,5 @@ func New(cfg *kafka.Config, c kafka.ConsumeFn) kafka.Cronsumer {
cfg.Logger.Infof("Topic [%s] verified successfully!", cfg.Consumer.Topic)
}

return internal.NewCronsumer(cfg, c)
return internal.NewCronsumerClient(cfg, c)
Copy link
Member

Choose a reason for hiding this comment

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

I think, no need to put Client as suffix

gocron "github.com/robfig/cron/v3"
)

type cronsumerClient struct {
Copy link
Member

Choose a reason for hiding this comment

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

I think, this file is not cron_client, it initializes cronsumer etc.

@@ -447,6 +447,48 @@ func Test_Should_Discard_Message_When_Header_Filter_Defined(t *testing.T) {
}
}

func Test_Should_Consume_Exception_Message_Successfully_When_Duration_Zero(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

we need to refactor this

@Abdulsametileri
Copy link
Member

Linter check 🙏🏻

})
}

func (s *cronsumerClient) startListen(cfg kafka.ConsumerConfig) func() {
Copy link
Member

Choose a reason for hiding this comment

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

pay attention to goroutine leak, refactor here

Copy link
Member

@Abdulsametileri Abdulsametileri left a comment

Choose a reason for hiding this comment

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

I think some refactoring needed

@Abdulsametileri Abdulsametileri merged commit 741d6f4 into main Sep 3, 2024
2 checks passed
@Abdulsametileri Abdulsametileri deleted the feature/enable&disable-duration branch September 3, 2024 06:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants