當前位置: 首頁>>代碼示例>>Golang>>正文


Golang doppler_endpoint.DopplerEndpoint類代碼示例

本文整理匯總了Golang中trafficcontroller/doppler_endpoint.DopplerEndpoint的典型用法代碼示例。如果您正苦於以下問題:Golang DopplerEndpoint類的具體用法?Golang DopplerEndpoint怎麽用?Golang DopplerEndpoint使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了DopplerEndpoint類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: serveWithDoppler

func (proxy *Proxy) serveWithDoppler(writer http.ResponseWriter, request *http.Request, dopplerEndpoint doppler_endpoint.DopplerEndpoint) {
	messagesChan := make(chan []byte, 100)
	stopChan := make(chan struct{})
	defer close(stopChan)

	go proxy.connector.Connect(dopplerEndpoint, messagesChan, stopChan)

	handler := dopplerEndpoint.HProvider(messagesChan, proxy.logger)
	handler.ServeHTTP(writer, request)
}
開發者ID:nagyistoce,項目名稱:cloudfoundry-loggregator,代碼行數:10,代碼來源:doppler_proxy.go

示例2: connectToServer

func (c *ChannelGroupConnector) connectToServer(serverAddress string, dopplerEndpoint doppler_endpoint.DopplerEndpoint, messagesChan chan<- []byte, stopChan <-chan struct{}) {
	l := c.listenerConstructor(dopplerEndpoint.Timeout, c.batcher, c.logger)
	serverUrl := fmt.Sprintf("ws://%s%s", serverAddress, dopplerEndpoint.GetPath())
	c.logger.Infof("proxy: connecting to doppler at %s", serverUrl)

	appId := dopplerEndpoint.StreamId
	err := l.Start(serverUrl, appId, messagesChan, stopChan)

	if err != nil {
		errorMsg := fmt.Sprintf("proxy: error connecting to %s: %s", serverAddress, err.Error())
		messagesChan <- c.generateLogMessage(errorMsg, appId)
		c.logger.Errorf("proxy: error connecting %s %s %s", appId, dopplerEndpoint.Endpoint, err.Error())
	}
}
開發者ID:kei-yamazaki,項目名稱:loggregator,代碼行數:14,代碼來源:channel_group_connector.go


注:本文中的trafficcontroller/doppler_endpoint.DopplerEndpoint類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。