数据流作业完成后通知Google PubSub

编程入门 行业动态 更新时间:2024-10-25 00:37:11
本文介绍了数据流作业完成后通知Google PubSub的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在Google Dataflow作业完成之后,是否可以将消息发布到Google Pubsub?我们需要通知从属系统传入数据的处理已完成.将数据写入接收器后,Dataflow如何发布?

Is there a way to publish a message onto Google Pubsub after a Google Dataflow job completes? We have a need to notify dependent systems that the processing of incoming data is complete. How could Dataflow publish after writing data to the sink?

我们想在管道完成对GCS的写入后通知.我们的管道如下所示:

We want to notify after a pipeline completes writing to GCS. Our pipeline looks like this:

Pipeline.create(options) .apply(....) .apply(AvroIO.Write.named("Write to GCS") .withSchema(Extract.class) .to(options.getOutputPath()) .withSuffix(".avro")); p.run();

如果我们在pipeline.apply(...)方法之外添加逻辑,则在代码完成执行时(而不是在管道完成时)会收到通知.理想情况下,我们可以在AvroIO接收器之后添加另一个.apply(...)并将消息发布到PubSub.

If we add logic outside of the pipeline.apply(...) methods we are notified when the code completes execution, not when the pipeline is completed. Ideally we could add another .apply(...) after the AvroIO sink and publish a message to PubSub.

推荐答案

当管道完成时,您有两个选择可得到通知,然后随后发布消息-或在管道完成运行后执行任何操作:

You have two options to get notified when your pipeline finishes, and then subsequently publish a message - or do whatever you want to after the pipeline finishes running:

  • 使用BlockingPipelineRunner.这将同步运行.
  • 使用DataflowPipelineRunner.这将异步运行管道.然后,您可以轮询管道的状态,并等待其完成.
  • Use the BlockingPipelineRunner. This will run your pipeline synchronously.
  • Use the DataflowPipelineRunner. This will run your pipeline asynchronously. You can then poll the pipeline for its status, and wait for it to finish.
  • 更多推荐

    数据流作业完成后通知Google PubSub

    本文发布于:2023-11-24 08:51:33,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1624542.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:作业   数据流   通知   完成后   PubSub

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!