def build_config_keys_map(spec):
    """Build config keys map

    Return
    ------
    Dict where each item:

        <config_key>: { "group": <grouping>, "type": <http|message_router|data_router> }

    where grouping includes "streams_publishes", "streams_subscribes", "services_calls"
    """
    # subscribing as http doesn't have config key
    ss = [ (s["config_key"], { "group": "streams_subscribes", "type": s["type"] })
        for s in spec["streams"]["subscribes"] if "config_key" in s]
    sp = [ (s["config_key"], { "group": "streams_publishes", "type": s["type"] })
        for s in spec["streams"]["publishes"] ]
    sc = [ (s["config_key"], { "group": "services_calls" })
        for s in spec["services"]["calls"] ]
    return dict(ss+sp+sc)