数据流管道和pubsub仿真器 [英] Dataflow pipeline and pubsub emulator
问题描述
我正在尝试设置我的开发环境.我一直在使用pubsub模拟器进行开发和测试,而不是在生产环境中使用google cloud pubsub.为此,我设置了以下环境变量:
I'm trying to setup my development environment. Instead of using google cloud pubsub in production, I've been using the pubsub emulator for development and testing. To achieve this I set the following environment variable:
export PUBSUB_EMULATOR_HOST=localhost:8586
这适用于python google pubsub库,但是当我切换为使用java apache beam进行google数据流时,管道仍指向生产google pubsub.我需要设置管道上的设置,环境变量或方法,以便管道读取本地pubsub模拟器吗?
This worked for the python google pubsub library but when I switched to using java apache beam for google dataflow, the pipeline still points to production google pubsub. Is there a setting, environment variable or method on the pipeline that I need to set so that the pipeline reads for the local pubsub emulator?
推荐答案
我在PubsubOptions接口中找到了解决方案,并将其扩展到我自己的PipelineOptions实现中.然后使用setPubsubRootUrl()将其设置为仿真器的localhost:port.
I found the solution in the PubsubOptions interface, and extending it for my own PipelineOptions implementation. Then using setPubsubRootUrl() to set it to localhost:port of the emulator.
这篇关于数据流管道和pubsub仿真器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!