blob: 3511dc7629e56de97f75c7a44a6b65f0d11f471f [file] [log] [blame]
khenaidooabad44c2018-08-03 16:58:35 -04001package kafka
2
3import (
4 "context"
5)
6
7type callback func(bool, interface{})
8
9// A Topic definition - may be augmented with additional attributes eventually
10type Topic struct {
11 // The name of the topic. It must start with a letter,
12 // and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`),
13 // underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent
14 // signs (`%`).
15 Name string
16}
17
18type KVArg struct {
19 Key string
20 Value interface{}
21}
22
23// Client represents the set of APIs a Messaging Client must implement - In progress
24type Client interface {
25 Start()
26 Stop()
27 Subscribe(ctx context.Context, topic *Topic, cb callback, targetInterfaces ...interface{})
28 Publish(ctx context.Context, rpc string, cb callback, topic *Topic, waitForResponse bool, kvArgs ...*KVArg)
29 Unsubscribe(ctx context.Context, topic *Topic)
30}