code: func (a *Manager) subscribeAgent(ctx context.Context, name string, agent Agent, conn choria.AgentConnector) error {
  	if _, found := a.subs[name]; found {
  		return fmt.Errorf("Could not subscribe agent %s, it's already subscribed", name)
  	}
  
  	a.subs[name] = []string{}
  
  	for _, collective := range a.fw.Config.Collectives {
  		target := conn.AgentBroadcastTarget(collective, name)
  		subname := fmt.Sprintf("%s.%s", collective, name)
  
  		a.log.Infof("Subscribing agent %s to %s", name, target)
  		err := conn.QueueSubscribe(ctx, subname, target, "", a.requests)
  		if err != nil {
  			a.log.Errorf("Could not subscribe agent %s to %s, rewinding all subscriptions for this agent", name, target)
  			for _, sub := range a.subs[name] {
  				conn.Unsubscribe(sub)
  			}
  
  			return fmt.Errorf("Subscription failed: %s", err)
  		}
  
  		a.subs[name] = append(a.subs[name], subname)
  	}
  
  	return nil
  }
docs: // Subscribes an agent to all its targets on the connector.  Should any subscription fail
  // all the preceding subscriptions for this agents is unsubscribed and an error returned.
  // Errors during the unsub is just ignored because it's quite possible that they would fail
  // too but this avoids problems of messages arriving we did not expect.
  //
  // In practise though this is something done during bootstrap and failure here should exit
  // the whole instance, so it's probably not needed