diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..9a95485 --- /dev/null +++ b/Makefile @@ -0,0 +1,5 @@ +all: + go build -o elasticstream cmd/main.go + +clean: + rm -f elasticstream diff --git a/client.go b/client.go index 9d3770c..001a38e 100644 --- a/client.go +++ b/client.go @@ -1,6 +1,8 @@ package elasticstream import ( + "fmt" + "github.com/elastic/go-elasticsearch/v8" ) @@ -41,8 +43,13 @@ func (c *Client) Open() error { return nil } -func (c *Client) Read() (Data, error) { - return Data{}, nil +func (c *Client) Read() (*Data, error) { + + data, ok := <-c.ch + if !ok { + return nil, fmt.Errorf("error reading data from channel") + } + return &data, nil } // func (c *Client) Ack(ctx context.Context, position int) error {