import backtype.storm.Config;
import backtype.storm.LocalCluster;
import backtype.storm.StormSubmitter;
import backtype.storm.testing.TestWordSpout;
import backtype.storm.tuple.Fields;
import backtype.storm.tuple.Values;
import backtype.storm.utils.Utils;
import storm.trident.TridentTopology;
import storm.trident.operation.BaseFunction;
import storm.trident.operation.TridentCollector;
import storm.trident.tuple.TridentTuple;

public class TemplateTridentTopology {

    private static class Exclamation extends BaseFunction {
        @Override
        public void execute(TridentTuple tuple, TridentCollector collector) {
            collector.emit(new Values(tuple.getString(0) + "!"));
        }
    }

    private static class Print extends BaseFunction {
        @Override
        public void execute(TridentTuple tuple, TridentCollector collector) {
            System.out.println(String.format("--- %s ---", tuple.getString(0)));
        }
    }

    public static void main(String[] args) throws Exception {
        TridentTopology topology = new TridentTopology();
        topology.newStream("spout1", new TestWordSpout())
                .each(new Fields("word"), new Exclamation(), new Fields("first_exclaim"))
                .each(new Fields("first_exclaim"), new Exclamation(), new Fields("second_exclaim"))
                .each(new Fields("second_exclaim"), new Print(), new Fields("output"));

        Config conf = new Config();
        conf.setDebug(true);

        if (args != null && args.length > 0) {
            conf.setNumWorkers(2);
            // Submit to remote Storm cluster
            StormSubmitter.submitTopology(args[0], conf, topology.build());
        } else {
            // Start a local Storm cluster for testing
            LocalCluster cluster = new LocalCluster();
            cluster.submitTopology("trident-topo-exclaim", conf, topology.build());
            Utils.sleep(20000);
            cluster.killTopology("trident-topo-exclaim");
            cluster.shutdown();
        }
    }


}
@@ -287,16 +287,59 @@
 pology;%0A
+import storm.trident.operation.BaseFilter;%0A
 import s
@@ -775,16 +775,22 @@
 ss Print
+Filter
  extends
@@ -787,39 +787,37 @@
 er extends BaseF
-unction
+ilter
  %7B%0A        @Over
@@ -832,36 +832,38 @@
      public 
-void execute
+boolean isKeep
 (TridentTupl
@@ -873,36 +873,8 @@
 uple
-, TridentCollector collector
 ) %7B%0A
@@ -950,24 +950,50 @@
 tring(0)));%0A
+            return false;%0A
         %7D%0A  
@@ -1430,31 +1430,15 @@
 rint
-(), new Fields(%22output%22
+Filter(
 ));%0A

Use a Filter for Print (instead of function)