本文整理汇总了Golang中github.com/cloudfoundry/noaa.Consumer.Stream方法的典型用法代码示例。如果您正苦于以下问题:Golang Consumer.Stream方法的具体用法?Golang Consumer.Stream怎么用?Golang Consumer.Stream使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/cloudfoundry/noaa.Consumer
的用法示例。
在下文中一共展示了Consumer.Stream方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1:
})
Describe("Stream", func() {
var envelopeChan chan *events.Envelope
var errorChan chan error
var doneChan chan struct{}
var stopChan chan struct{}
perform := func() {
connection = noaa.NewConsumer(trafficControllerUrl, tlsSettings, consumerProxyFunc)
envelopeChan = make(chan *events.Envelope)
errorChan = make(chan error, 10)
stopChan = make(chan struct{})
doneChan = make(chan struct{})
go func() {
connection.Stream(appGuid, authToken, envelopeChan, errorChan, stopChan)
close(doneChan)
}()
}
BeforeEach(func() {
startFakeTrafficController()
})
It("attempts to connect five times", func() {
fakeHandler.fail = true
perform()
fakeHandler.Close()
Eventually(errorChan, 3).Should(HaveLen(5))
示例2:
})
})
})
Describe("Stream", func() {
var envelopeChan chan *events.Envelope
var errorChan chan error
var doneChan chan struct{}
perform := func() {
cnsmr = noaa.NewConsumer(trafficControllerUrl, tlsSettings, consumerProxyFunc)
envelopeChan = make(chan *events.Envelope)
errorChan = make(chan error, 10)
doneChan = make(chan struct{})
go func() {
cnsmr.Stream(appGuid, authToken, envelopeChan, errorChan)
close(doneChan)
}()
}
BeforeEach(func() {
startFakeTrafficController()
})
It("attempts to connect five times", func() {
fakeHandler.fail = true
perform()
fakeHandler.Close()
Eventually(errorChan, 3).Should(HaveLen(5))