gearpump-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (GEARPUMP-109) Add Java example for WordCount in document.
Date Thu, 28 Apr 2016 01:24:12 GMT

    [ https://issues.apache.org/jira/browse/GEARPUMP-109?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15261351#comment-15261351
] 

ASF GitHub Bot commented on GEARPUMP-109:
-----------------------------------------

Github user manuzhang commented on a diff in the pull request:

    https://github.com/apache/incubator-gearpump/pull/6#discussion_r61362813
  
    --- Diff: docs/dev-write-1st-app.md ---
    @@ -55,13 +163,58 @@ object Split {
     }
     ```
     
    -Like Split, every processor extends a `TaskActor`.  The `onStart` method is called once
before any message comes in; `onNext` method is called to process every incoming message.
Note that Gearpump employs the message-driven model and that's why Split sends itself a message
at the end of `onStart` and `onNext` to trigger next message processing.
    +</div>
    +
    +<div data-lang="java" markdown="1">
    +```java
    +public class Split extends Task {
    +
    +  public static String TEXT = "This is a good start for java! bingo! bingo! ";
    +
    +  public Split(TaskContext taskContext, UserConfig userConf) {
    +    super(taskContext, userConf);
    +  }
    +
    +  private Long now() {
    +    return System.currentTimeMillis();
    +  }
    +
    +  @Override
    +  public void onStart(StartTime startTime) {
    +    self().tell(new Message("start", now()), self());
    +  }
    +
    +  @Override
    +  public void onNext(Message msg) {
    +
    +    // Split the TEXT to words
    +    String[] words = TEXT.split(" ");
    +    for (int i = 0; i < words.length; i++) {
    +      context.output(new Message(words[i], now()));
    +    }
    +    self().tell(new Message("next", now()), self());
    +  }
    +}
    +```
    +
    +</div>
    +
    +</div>
    +
    +Essentially, each processor consists of two descriptions:
    +
    +1. A `Task` to define the operation.
    +
    +2. A parallelism level to define the parallelism of this processor. I.e. this processor
will have how many tasks running in parallel. 
    --- End diff --
    
    => "A parallelism level to define the number of tasks of this processor to run in parallel."


> Add Java example for WordCount in document.
> -------------------------------------------
>
>                 Key: GEARPUMP-109
>                 URL: https://issues.apache.org/jira/browse/GEARPUMP-109
>             Project: Apache Gearpump
>          Issue Type: Improvement
>          Components: doc
>    Affects Versions: 0.8.1
>            Reporter: Weihua Jiang
>            Assignee: Weihua Jiang
>            Priority: Minor
>
> Currently, in our document, we only have Scala version for wordcount. It is better to
have both Scala version and Java version.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message