title: Apache Beam Not Saving Unbounded Data To Text File
body: <p>I've created a Pipeline to save Google Cloud Pubsub messages into text files using Apache Beam and Java.
  Whenever I run the pipeline within Google Dataflow with <code>--runner=DataflowRunner</code> the messages are saved correctly.</p>
  
  <p>However, when I run the same pipeline with <code>--runner=DirerctRunner</code> the messages are not saved.</p>
  
  <p>I can watch the events coming through the pipeline, but nothing happens.</p>
  
  <p>The pipeline is the code below:</p>
  
  <pre><code>public static void main(String[] args) {
      ExerciseOptions options = PipelineOptionsFactory.fromArgs(args).withValidation().as(ExerciseOptions.class);
  
      Pipeline pipeline = Pipeline.create(options);
  
      pipeline
        .apply("Read Messages from Pubsub",
          PubsubIO
            .readStrings()
            .fromTopic(options.getTopicName()))
  
        .apply("Set event timestamp", ParDo.of(new DoFn&lt;String, String&gt;() {
          @ProcessElement
          public void processElement(ProcessContext context) {
            context.outputWithTimestamp(context.element(), Instant.now());
          }
        }))
  
        .apply("Windowing", Window.into(FixedWindows.of(Duration.standardMinutes(5))))
  
        .apply("Write to File",
          TextIO
            .write()
            .withWindowedWrites()
            .withNumShards(1)
            .to(options.getOutputPrefix()));
  
      pipeline.run();
    }
  </code></pre>
  
  <p>What I'm doing wrong? Is it possible to run this pipeline locally?</p>