diff --git a/discovery.go b/discovery.go index 136ea2f..27bacd2 100644 --- a/discovery.go +++ b/discovery.go @@ -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(), } } diff --git a/examples/main.go b/examples/main.go index 953aea2..07f81c0 100644 --- a/examples/main.go +++ b/examples/main.go @@ -11,13 +11,13 @@ 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) } @@ -25,13 +25,13 @@ func main() { 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 {