Package org.apache.s4.collector

Examples of org.apache.s4.collector.EventWrapper


                }
                listByPartitionNumber.add(partitionInfo);
            }

            for (int partitionId : pInfoMap.keySet()) {
                EventWrapper eventWrapper = new EventWrapper(streamName,
                                                             event,
                                                             pInfoMap.get(partitionId));
                counts[partitionId]++;
                eventEmitter.emit(partitionId, eventWrapper);
            }
View Full Code Here


        CompoundKeyInfo compoundKeyInfo = new CompoundKeyInfo();
        compoundKeyInfo.setCompoundKey("key");
        compoundKeyInfo.setCompoundValue("value");
        List<CompoundKeyInfo> compoundKeyInfos = new ArrayList<CompoundKeyInfo>();
        compoundKeyInfos.add(compoundKeyInfo);
        EventWrapper eventWrapper = new EventWrapper(streamName, event,
                compoundKeyInfos);
        eventEmitter.emit(partitionId, eventWrapper);
    }
View Full Code Here

    }

    public void injectEvent(Object event, String streamName, int partitionId,
            List<CompoundKeyInfo> compoundKeyInfos) throws JSONException {

        EventWrapper eventWrapper = new EventWrapper(streamName, event,
                compoundKeyInfos);
        eventEmitter.emit(partitionId, eventWrapper);
    }
View Full Code Here

            String jevent = json.getString("object");

            Object obj = GsonUtil.get().fromJson(jevent, clazz);

            return new EventWrapper(streamName, keyNames, obj);

        } catch (JSONException e) {
            logger.error("problem with event JSON", e);
        } catch (ObjectBuilder.Exception e) {
            logger.error("failed to build object from JSON", e);
View Full Code Here

            }
        }

        public void processMessage(byte[] rawMessage) {
            // convert the byte array into an event object
            EventWrapper eventWrapper = null;
            try {
                eventWrapper = (EventWrapper) serDeser.deserialize(rawMessage);

            } catch (RuntimeException rte) {
                Logger.getLogger("s4")
View Full Code Here

    return streamName;
  }

  // TODO JSON-like stuff
  public void produceEvent(String message) {
    EventWrapper ew = new EventWrapper(streamName, message, null);
    for (org.apache.s4.listener.EventHandler handler : handlers) {
      try {
        handler.processEvent(ew);
      } catch (Exception e) {
        e.printStackTrace();
View Full Code Here

    //
    // }

    @Before
    public void prepareEmitter() throws IOException {
        injector = Guice.createInjector(new DefaultCommModule(Resources.getResource("default.s4.comm.properties")
                .openStream(), "cluster1"), new DefaultCoreModule(Resources.getResource("default.s4.core.properties")
                .openStream()));

        emitter = injector.getInstance(TCPEmitter.class);
View Full Code Here

    }

    public static Injector createInjectorWithNonFailFastZKClients() throws IOException {
        return Guice.createInjector(Modules.override(
                new DefaultCommModule(Resources.getResource("default.s4.comm.properties").openStream(), "cluster1"),
                new DefaultCoreModule(Resources.getResource("default.s4.core.properties").openStream())).with(
                new NonFailFastZookeeperClientsModule()));
    }
View Full Code Here

        super(numTasks);
    }

    public Injector newInjector() {
        try {
            return Guice.createInjector(new DefaultCommModule(Resources.getResource("default.s4.comm.properties")
                    .openStream(), CLUSTER_NAME));
        } catch (IOException e) {
            Assert.fail();
            return null;
        }
View Full Code Here

        super(numTasks);
    }

    @Override
    protected Injector newInjector() throws IOException {
        return Guice.createInjector(new DefaultCommModule(Resources.getResource("udp.s4.comm.properties").openStream(),
                "cluster1"), new UDPCommTestModule());
    }
View Full Code Here

TOP

Related Classes of org.apache.s4.collector.EventWrapper

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.