diff --git a/lib/core/core.go b/lib/core/core.go index 2514a84..d482494 100644 --- a/lib/core/core.go +++ b/lib/core/core.go @@ -7,7 +7,8 @@ import ( ) func Start(ctx lib.Context) { - Listen(ctx) + fmt.Println("Start:", ctx.Config().Name()) + lib.RunCtx(ctx, Listen) } func Listen(ctx lib.Context) { diff --git a/lib/message/message.go b/lib/message/message.go index dc7a9bf..be5c11d 100644 --- a/lib/message/message.go +++ b/lib/message/message.go @@ -40,7 +40,7 @@ func SimpleAddress(srv string) *address { } } -// base functions +// public functions func Send(ctx lib.Context, addr lib.Address, msg lib.Message) { if srv, ok := ctx.Services()[addr.Service()]; ok { diff --git a/tests/etc/etc.go b/tests/etc/etc.go index 1a5b246..3b150fb 100644 --- a/tests/etc/etc.go +++ b/tests/etc/etc.go @@ -21,6 +21,9 @@ func Config() lib.Config { Base: b("config", config.Start), ConfigFormat: "etc", }) + cfg.Add(config.Cfg{ + Base: b("test-receiver", core.Start), + }) return &cfg } diff --git a/tests/scopes_test.go b/tests/scopes_test.go index 39706f0..030c2a4 100644 --- a/tests/scopes_test.go +++ b/tests/scopes_test.go @@ -19,7 +19,7 @@ func TestConfig(tb *tbase.T) { func AppTest(t *testing.T) { ctx := t.Ctx - t.AssertEqual(len(ctx.Services()), 2) + t.AssertEqual(len(ctx.Services()), 3) } func ConfigTest(t *testing.T) { @@ -36,4 +36,6 @@ func SendTest(t *testing.T) { rcvr := message.SimpleAddress("testing") msg := message.StrMessage("demo") rcvr.Send(ctx, msg) + rcvr = message.SimpleAddress("test-receiver") + rcvr.Send(ctx, msg) }