func (exporter *MetadataServiceExporter) Export(url *common.URL) error {
	if !exporter.IsExported() {
		if url == nil || url.SubURL == nil {
			return errors.New("metadata server url is nil, pls check your configuration")
		}
		version, _ := exporter.metadataService.Version()
		exporter.lock.Lock()
		defer exporter.lock.Unlock()
		exporter.ServiceConfig = config.NewServiceConfig(
			config.WithServiceID(constant.SIMPLE_METADATA_SERVICE_NAME),
			config.WithServiceProtocolKeys(constant.DEFAULT_PROTOCOL),
			config.WithServiceProtocol(constant.DEFAULT_PROTOCOL, config.NewProtocolConfig(
				config.WithProtocolName(constant.DEFAULT_PROTOCOL),
				config.WithProtocolPort(strconv.Itoa(constant.DEFAULT_METADATAPORT)),
			)),
			config.WithServiceRegistry("N/A"),
			config.WithServiceInterface(constant.METADATA_SERVICE_NAME),
			config.WithServiceGroup(config.GetApplicationConfig().Name),
			config.WithServiceVersion(version),
			config.WithProxyFactoryKey(constant.DEFAULT_Key),
			config.WithServiceInterface(constant.METADATA_SERVICE_NAME),
			config.WithServiceMetadataType(constant.REMOTE_METADATA_STORAGE_TYPE),
		)
		exporter.ServiceConfig.Implement(exporter.metadataService)
		err := exporter.ServiceConfig.Export()
		logger.Infof("The MetadataService exports urls : %v ", exporter.ServiceConfig.GetExportedUrls())
		return err
	}
	logger.Warnf("The MetadataService has been exported : %v ", exporter.ServiceConfig.GetExportedUrls())
	return nil
}
Export will export the metadataService
package configurable
import (
	"strconv"
	"sync"
)
import (
	"github.com/pkg/errors"
)
import (
	"dubbo.apache.org/dubbo-go/v3/common"
	"dubbo.apache.org/dubbo-go/v3/common/constant"
	"dubbo.apache.org/dubbo-go/v3/common/logger"
	"dubbo.apache.org/dubbo-go/v3/config"
	_ "dubbo.apache.org/dubbo-go/v3/metadata/mapping/metadata"
	"dubbo.apache.org/dubbo-go/v3/metadata/service"
	"dubbo.apache.org/dubbo-go/v3/metadata/service/exporter"
	_ "dubbo.apache.org/dubbo-go/v3/metadata/service/remote"
	_ "dubbo.apache.org/dubbo-go/v3/protocol/dubbo"
)
type MetadataServiceExporter struct {
	ServiceConfig   *config.ServiceConfig
	lock            sync.RWMutex
	metadataService service.MetadataService
}
func NewMetadataServiceExporter(metadataService service.MetadataService) exporter.MetadataServiceExporter {
	return &MetadataServiceExporter{
		metadataService: metadataService,
	}
}