예제 #1
0
func main() {
	flag.Parse()
	alexander.ExportTypes(Message{})

	err := alexander.Start()
	defer alexander.Stop()
	if err != nil {
		log.Fatalf("Could not start alexander %s", err)
	}

	exitChan := make(chan bool)

	if *isProducer {
		go func() {
			for count := 0; count < 10; count++ {
				msg := &Message{Msg: *message, Origin: *nodeName, Sent: time.Now()}
				_, _, err := alexander.Do(msg, "PrintMe")
				if err != nil {
					log.Printf("Error processing task: %s", err)
				}
				time.Sleep(*frequency)
			}
			exitChan <- true
		}()
	}

	<-exitChan
}
예제 #2
0
func init() {
	aGraph := make(Graph)
	aNode := Node{}
	aPath := make(NodePath, 0)
	aNodeId := NodeId("Node")

	alexander.ExportTypes(aGraph, aPath, aNode, aNodeId)
}