Skip to content

Feature: Implement producer with middleware support #1

@cyberhck

Description

@cyberhck

with the middleware, we'll be able to plug various things, we can get away with just a raw producer without any serialization for now.

Once we have a raw producer, we can then introduce a producer that respects schema out of the box.

Acceptance Criteria:

  • Can initialize a producer
  • Can add middleware to that producer
  • The signature of the middleware should be same as core
  • Can produce *kafka.Message
  • Can Flush(time.Duration)
  • Can Close()

Here's how I want to initialize a producer:

package main

func main() {
    messageProducer := producer.New(getConfluentProducer())
    messageProducer.AddMiddleware(tracing.Middleware()) // don't worry about actually creating this middleware
    messageProducer.AddMiddleware(block_storage.Middleware() // don't worry about actually creating this middleware
    messageProducer.Produce(&kafka.Message{})
    messageProducer.Flush(time.Milliseconds * 100)
    err := messageProducer.Close()
    if err != nil {
        panic(err)
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions