Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Name is the name of the cron job. Name string // Schedule is the cron schedule for the job. Schedule string // Job is the job to be executed. It has a Run method where the actual job logic is implemented and returns a list of messages to be published. Job Job // BrokerURLs is the list of Kafka broker URLs. BrokerURLs []string // ProducerConfig is the configuration for the Kafka producer. ProducerConfig *sarama.Config }
Config holds the configuration for a cron job.
type Job ¶
type Job interface {
Run() ([]*sarama.ProducerMessage, error)
}
Job defines the interface for jobs to be executed.
type ProducerCron ¶
type ProducerCron struct {
// contains filtered or unexported fields
}
ProducerCron contains the configuration and associated cron meth
func New ¶
func New(cfg *Config) (*ProducerCron, error)
NewProducerCron creates a new ProducerCron instance.
func (*ProducerCron) GetErrorChan ¶
func (cp *ProducerCron) GetErrorChan() <-chan error
GetErrorChan returns the error channel.
func (*ProducerCron) StartCron ¶
func (cp *ProducerCron) StartCron() error
StartCron starts the cron scheduler and runs the job at the specified schedule.
func (*ProducerCron) StopCron ¶
func (cp *ProducerCron) StopCron()
StopCron stops the cron scheduler.
Click to show internal directories.
Click to hide internal directories.