فهرست منبع

stub creation of producer/consumer

Evan Huus 13 سال پیش
والد
کامیت
5fbffdc5fa
2فایلهای تغییر یافته به همراه12 افزوده شده و 2 حذف شده
  1. 6 1
      consumer.go
  2. 6 1
      producer.go

+ 6 - 1
consumer.go

@@ -1,5 +1,10 @@
 package kafka
 
 type Consumer struct {
-	client Client
+	client *Client
+	topic string
+}
+
+func NewConsumer(client *Client, topic string) *Consumer {
+	return &Consumer{client, topic}
 }

+ 6 - 1
producer.go

@@ -1,5 +1,10 @@
 package kafka
 
 type Producer struct {
-	client Client
+	client *Client
+	topic string
+}
+
+func NewProducer(client *Client, topic string) *Producer {
+	return &Producer{client, topic}
 }