func NewImport(a *servicedescriptor.ServiceDescriptor, cfg *config.Config) (i *Import) { i = new(Import) i.Service = service.NewService(a, service.IMPORTING, cfg, []byte{0}) i.logger = log.New(cfg.Logger(), fmt.Sprintf("export %s ", i.UUID()), log.Lshortfile) i.Connected().Then(i.onConnected) i.NewServiceConnections().Listen(i.sendListenFunctions) i.results = i.Messages(messages.RESULT) return }
func NewExport(a *appdescriptor.AppDescriptor, cfg *config.Config) (e *Export) { e = new(Export) e.Service = service.NewService(a, service.EXPORTING, cfg, []byte{0}) e.logger = log.New(cfg.Logger(), fmt.Sprintf("export %s ", e.UUID()), log.Lshortfile) e.requests = e.Messages(messages.REQUEST) e.listeners = map[string][]string{} e.r = eventual2go.NewReactor() e.r.React("listen", e.newListener) e.r.AddStream("listen", e.IncomingMessages(messages.LISTEN)) e.r.React("listen_stop", e.stopListener) e.r.AddStream("listen", e.IncomingMessages(messages.STOP_LISTEN)) e.r.React("reply", e.deliverResult) return }