Spark streaming exception No output streams registered, so nothing to execute

Source: Internet
Author: User

When implementing the Spark streaming demo, the code:

1  Public Static voidMain (string[] args) {2 3 4sparkconf conf =NewSparkconf (). Setappname ("spark_streaming"). Setmaster ("local");5Javasparkcontext sc =Newjavasparkcontext (conf); 6Javastreamingcontext JSSC =NewJavastreamingcontext (SC,NewDuration (2)); 7Javasqlcontext Sqlctx =NewJavasqlcontext (SC); 8 9 TenString[] Filters =NewString[] {"SOC"}; One  AJavareceiverinputdstream<status> Receiverstream =Twitterutils.createstream (jssc,filters); -  -  the  - Jssc.start (); - jssc.awaittermination (); -  +}

Running the above code will cause an exception:No output streams registered, so nothing to execute

The reason is that when an output operation occurs, the flow calculation operation is triggered, and when there is no output operation or calculation on the Dstream, some operations are usually required, such as in any way:

1 print () 2 Foreachrdd (func) 3 saveasobjectfiles (prefix, [suffix]) 4 saveastextfiles (prefix, [suffix]) 5 saveashadoopfiles (prefix, [suffix])

Refer to: Http://spark.apache.org/docs/latest/streaming-programming-guide.html#output-operations

Spark streaming exception No output streams registered, so nothing to execute

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.