Java Code Examples for backtype.storm.utils.Utils#loadClojureFn()
The following examples show how to use
backtype.storm.utils.Utils#loadClojureFn() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ClojureBolt.java From jstorm with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") @Override public void prepare(final Map stormConf, final TopologyContext context, final OutputCollector collector) { IFn hof = Utils.loadClojureFn(_fnSpec.get(0), _fnSpec.get(1)); try { IFn preparer = (IFn) hof.applyTo(RT.seq(_params)); final Map<Keyword, Object> collectorMap = new PersistentArrayMap(new Object[]{Keyword.intern(Symbol.create("output-collector")), collector, Keyword.intern(Symbol.create("context")), context}); List<Object> args = new ArrayList<Object>() { { add(stormConf); add(context); add(collectorMap); } }; _bolt = (IBolt) preparer.applyTo(RT.seq(args)); // this is kind of unnecessary for clojure try { _bolt.prepare(stormConf, context, collector); } catch (AbstractMethodError ignored) { } } catch (Exception e) { throw new RuntimeException(e); } }
Example 2
Source File: ClojureBolt.java From jstorm with Apache License 2.0 | 5 votes |
@Override public Map<String, Object> getComponentConfiguration() { IFn hof = Utils.loadClojureFn(_confSpec.get(0), _confSpec.get(1)); try { return (Map) hof.applyTo(RT.seq(_params)); } catch (Exception e) { throw new RuntimeException(e); } }
Example 3
Source File: ClojureSpout.java From jstorm with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") @Override public void open(final Map conf, final TopologyContext context, final SpoutOutputCollector collector) { IFn hof = Utils.loadClojureFn(_fnSpec.get(0), _fnSpec.get(1)); try { IFn preparer = (IFn) hof.applyTo(RT.seq(_params)); final Map<Keyword, Object> collectorMap = new PersistentArrayMap(new Object[]{Keyword.intern(Symbol.create("output-collector")), collector, Keyword.intern(Symbol.create("context")), context}); List<Object> args = new ArrayList<Object>() { { add(conf); add(context); add(collectorMap); } }; _spout = (ISpout) preparer.applyTo(RT.seq(args)); // this is kind of unnecessary for clojure try { _spout.open(conf, context, collector); } catch (AbstractMethodError ignored) { } } catch (Exception e) { throw new RuntimeException(e); } }
Example 4
Source File: ClojureSpout.java From jstorm with Apache License 2.0 | 5 votes |
@Override public Map<String, Object> getComponentConfiguration() { IFn hof = Utils.loadClojureFn(_confSpec.get(0), _confSpec.get(1)); try { return (Map) hof.applyTo(RT.seq(_params)); } catch (Exception e) { throw new RuntimeException(e); } }