Skip to content

Instantly share code, notes, and snippets.

@pjvds
Created December 2, 2014 13:21
Show Gist options
  • Save pjvds/de59c122a3a61d0ee2ec to your computer and use it in GitHub Desktop.
Save pjvds/de59c122a3a61d0ee2ec to your computer and use it in GitHub Desktop.
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package samza.examples.wikipedia.task;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.samza.config.Config;
import org.apache.samza.storage.kv.KeyValueStore;
import org.apache.samza.system.IncomingMessageEnvelope;
import org.apache.samza.system.OutgoingMessageEnvelope;
import org.apache.samza.system.SystemStream;
import org.apache.samza.task.MessageCollector;
import org.apache.samza.task.StreamTask;
import org.apache.samza.task.TaskContext;
import org.apache.samza.task.TaskCoordinator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import samza.examples.wikipedia.system.WikipediaFeed.WikipediaFeedEvent;
import samza.examples.wikipedia.task.WikipediaFeedStreamTask;
public class WikipediaParserStreamTask implements StreamTask, InitableTask {
private static final Logger log = LoggerFactory
.getLogger(WikipediaParserStreamTask.class);
public WikipediaParserStreamTask() {
System.err.println("CTOR");
}
public void init(Config config, TaskContext context) {
System.err.println("INITTED");
}
@SuppressWarnings("unchecked")
@Override
public void process(IncomingMessageEnvelope envelope, MessageCollector collector, TaskCoordinator coordinator) {
System.err.println("PROCESSING MSG");
System.err.println(envelope.getMessage());
log.info("foobar");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment