[
https://issues.apache.org/jira/browse/BEAM-2965?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16417705#comment-16417705
]
Ben Menasha commented on BEAM-2965:
-----------------------------------
I didn't verify but I think this commit resolves this issue:
[https://github.com/apache/beam/commit/2e275264b21db45787833502e5e42907b05e28b8#diff-0d9d40209cb51abbc7247e0fac974872]
> PubsubIO.fromSubscription(ValueProvider) throws RuntimeException
> ------------------------------------------------------------------
>
> Key: BEAM-2965
> URL: https://issues.apache.org/jira/browse/BEAM-2965
> Project: Beam
> Issue Type: Bug
> Components: io-java-gcp
> Affects Versions: 2.1.0
> Reporter: Ben Menasha
> Assignee: Chamikara Jayalath
> Priority: Major
>
> The very simple Pipeline:
> public class PubsubTemplate {
> public interface PubsubTemplateOptions extends PipelineOptions {
> ValueProvider<String> getSubscription();
> void setSubscription(ValueProvider<String> value);
> }
> public static void main(String[] args) throws IOException {
> PubsubTemplateOptions options =
> PipelineOptionsFactory.fromArgs(args).withValidation()
> .as(PubsubTemplateOptions.class);
> Pipeline p = Pipeline.create(options);
> p.apply(PubsubIO.readStrings().
> fromSubscription(options.getSubscription()));
> p.run().waitUntilFinish();
> }
> }
> Throws the exception when generating a Dataflow template:
> java.lang.reflect.InvocationTargetException
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:497)
> at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:293)
> at java.lang.Thread.run(Thread.java:745)
> Caused by: java.lang.RuntimeException: Not called from a runtime context.
> at
> org.apache.beam.sdk.options.ValueProvider$RuntimeValueProvider.get(ValueProvider.java:223)
> at
> org.apache.beam.sdk.options.ValueProvider$NestedValueProvider.get(ValueProvider.java:131)
> at
> org.apache.beam.sdk.options.ValueProvider$NestedValueProvider.get(ValueProvider.java:131)
> at
> org.apache.beam.sdk.io.gcp.pubsub.PubsubUnboundedSource.getSubscription(PubsubUnboundedSource.java:1374)
> at
> org.apache.beam.sdk.io.gcp.pubsub.PubsubUnboundedSource$PubsubSource.<init>(PubsubUnboundedSource.java:1103)
> at
> org.apache.beam.sdk.io.gcp.pubsub.PubsubUnboundedSource.expand(PubsubUnboundedSource.java:1407)
> at
> org.apache.beam.sdk.io.gcp.pubsub.PubsubUnboundedSource.expand(PubsubUnboundedSource.java:110)
> at org.apache.beam.sdk.Pipeline.applyInternal(Pipeline.java:514)
> at org.apache.beam.sdk.Pipeline.applyTransform(Pipeline.java:454)
> at org.apache.beam.sdk.values.PBegin.apply(PBegin.java:44)
> at
> org.apache.beam.sdk.io.gcp.pubsub.PubsubIO$Read.expand(PubsubIO.java:730)
> at
> org.apache.beam.sdk.io.gcp.pubsub.PubsubIO$Read.expand(PubsubIO.java:536)
> at org.apache.beam.sdk.Pipeline.applyInternal(Pipeline.java:514)
> at org.apache.beam.sdk.Pipeline.applyTransform(Pipeline.java:454)
> at org.apache.beam.sdk.values.PBegin.apply(PBegin.java:44)
> at org.apache.beam.sdk.Pipeline.apply(Pipeline.java:165)
> at com.google.pubsubtemplate.PubsubTemplate.main(PubsubTemplate.java:34)
> ... 6 more
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)