How about filtering events by event type

I’ve tried
1.api.Topic("Allocation"): {"AllocationUpdated"},
2. eventCh, err := events.Stream(ctx, topics, index, &api.QueryOptions{ AuthToken: envConfig.Nomad.Token, Namespace: "AllocationUpdated", })
it’s dosent work
Please advise on the correct way to write ~~ @jrasell

Hi @wangyuanhang111,

Thanks for using Nomad! Based on what I see in this unit test, the api package allows you to subscribe to events using the api.EventStream() accessor rather than api.Topic. The code from that test is included here as an example.

streamCh, err := c.EventStream().Stream(ctx, map[Topic][]string{
		TopicNode: {nodeID},
	}, 0, nil)

Does this help?