Skip to content

Commit

Permalink
FIXED merge conflicts and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
EwanValentine committed Dec 9, 2019
1 parent ac814f2 commit af355a9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 17 deletions.
13 changes: 0 additions & 13 deletions discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,19 +97,6 @@ func WithAWSBackend() Option {
args.Locator = locator.NewCloudmapLocator(servicediscovery.New(sess))
args.LogAdapter = logger.NewSTDOutAdapter()
args.TraceAdapter = tracer.NewXrayAdapter()
}

// NewDiscovery creates a new Discover object to communicate with the various services
func NewDiscovery(opts ...Option) *Discover {
sess := session.Must(session.NewSession())
args := &Options{
QueueAdapter: queue.NewSQSAdapter(sqs.New(sess)),
FunctionAdapter: function.NewLambdaAdapter(lambda.New(sess)),
AutomateAdapter: automate.NewSSMAdapter(ssm.New(sess)),
PubsubAdapter: pubsub.NewSNSAdapter(sns.New(sess)),
Locator: locator.NewCloudmapLocator(servicediscovery.New(sess)),
LogAdapter: logger.NewSTDOutAdapter(),
TraceAdapter: tracer.NewXrayAdapter(),
}
}

Expand Down
8 changes: 4 additions & 4 deletions examples/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,27 @@ func main() {
discovery := d.NewDiscovery()
res, err := discovery.Request("acme-prod.scheduler->create-job", types.Request{
Body: []byte(`{ "frequency": "* * * * *", "type": "test" }`),
}, nil)
})
if err != nil {
log.Panic(err)
}
log.Println(string(res.Body))

messages, err := discovery.Listen("acme-prod.service-discovery->test-queue", nil)
messages, err := discovery.Listen("acme-prod.service-discovery->test-queue")
if err != nil {
log.Panic(err)
}

go func() {
discovery.Queue("acme-prod.service-discovery->test-queue", types.Request{
Body: []byte(`{ "message": "hello" }`),
}, nil)
})
}()

go func() {
discovery.Queue("acme-prod.service-discovery->test-queue", types.Request{
Body: []byte(`{ "message": "again" }`),
}, nil)
})
}()

for message := range messages {
Expand Down

0 comments on commit af355a9

Please sign in to comment.