本文整理汇总了Golang中github.com/cloudfoundry/noaa/consumer.Consumer.FirehoseWithoutReconnect方法的典型用法代码示例。如果您正苦于以下问题:Golang Consumer.FirehoseWithoutReconnect方法的具体用法?Golang Consumer.FirehoseWithoutReconnect怎么用?Golang Consumer.FirehoseWithoutReconnect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/cloudfoundry/noaa/consumer.Consumer
的用法示例。
在下文中一共展示了Consumer.FirehoseWithoutReconnect方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1:
Describe("FirehoseWithoutReconnect", func() {
var (
incomings <-chan *events.Envelope
streamErrors <-chan error
idleTimeout time.Duration
)
BeforeEach(func() {
incomings = make(chan *events.Envelope)
startFakeTrafficController()
})
JustBeforeEach(func() {
cnsmr.SetIdleTimeout(idleTimeout)
incomings, streamErrors = cnsmr.FirehoseWithoutReconnect("subscription-id", authToken)
})
Context("when there is no TLS Config or consumerProxyFunc setting", func() {
Context("when the connection can be established", func() {
It("receives messages from the full firehose", func() {
fakeHandler.Close()
Eventually(fakeHandler.GetLastURL).Should(ContainSubstring("/firehose/subscription-id"))
})
Context("with a message", func() {
BeforeEach(func() {
fakeHandler.InputChan <- marshalMessage(createMessage("hello", 0))
})
示例2:
Describe("Stream", func() {
It("loads a token if the provided token is empty", func() {
cnsmr.Stream("some-fake-app-guid", "")
Eventually(refresher.RefreshAuthTokenCalled).Should(BeCalled())
})
It("loads a token if the provided token fails with 401", func() {
testHandler.responseStatuses <- http.StatusUnauthorized
cnsmr.Stream("some-fake-app-guid", "")
Eventually(refresher.RefreshAuthTokenCalled).Should(BeCalled())
})
})
Describe("FirehoseWithoutReconnect", func() {
It("loads a token if the provided token is empty", func() {
cnsmr.FirehoseWithoutReconnect("some-fake-app-guid", "")
Eventually(refresher.RefreshAuthTokenCalled).Should(BeCalled())
})
It("loads a token if the provided token fails with 401", func() {
testHandler.responseStatuses <- http.StatusUnauthorized
cnsmr.FirehoseWithoutReconnect("some-fake-app-guid", "")
Eventually(refresher.RefreshAuthTokenCalled).Should(BeCalled())
})
})
Describe("Firehose", func() {
It("loads a token if the provided token is empty", func() {
cnsmr.Firehose("some-fake-app-guid", "")
Eventually(refresher.RefreshAuthTokenCalled).Should(BeCalled())
})