数据流管道和发布订阅模拟器 [英] Dataflow pipeline and pubsub emulator

查看:31
本文介绍了数据流管道和发布订阅模拟器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试设置我的开发环境.我一直在使用 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 进行谷歌数据流时,管道仍然指向生产谷歌 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.

这篇关于数据流管道和发布订阅模拟器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆