Package org.apache.s4.client

Examples of org.apache.s4.client.Message


        // TODO handle application upgrade
        logger.info("Loading application [{}] from file [{}]", appName, s4r.getAbsolutePath());

        S4RLoaderFactory loaderFactory = injector.getInstance(S4RLoaderFactory.class);
        S4RLoader cl = loaderFactory.createS4RLoader(s4r.getAbsolutePath());
        try {
            JarFile s4rFile = new JarFile(s4r);
            if (s4rFile.getManifest() == null) {
                logger.warn("Cannot load s4r archive [{}] : missing manifest file");
                return null;
            }
            if (!s4rFile.getManifest().getMainAttributes().containsKey(new Name(MANIFEST_S4_APP_CLASS))) {
                logger.warn("Cannot load s4r archive [{}] : missing attribute [{}] in manifest", s4r.getAbsolutePath(),
                        MANIFEST_S4_APP_CLASS);
                return null;
            }
            String appClassName = s4rFile.getManifest().getMainAttributes().getValue(MANIFEST_S4_APP_CLASS);
            logger.info("App class name is: " + appClassName);
            App app = null;

            try {
                Object o = (cl.loadClass(appClassName)).newInstance();
                app = (App) o;
                injector.injectMembers(app);
            } catch (Exception e) {
                logger.error("Could not load s4 application form s4r file [{" + s4r.getAbsolutePath() + "}]", e);
                return null;
View Full Code Here


    public App loadApp(File s4r, String appName) {

        // TODO handle application upgrade
        logger.info("Loading application [{}] from file [{}]", appName, s4r.getAbsolutePath());

        S4RLoaderFactory loaderFactory = injector.getInstance(S4RLoaderFactory.class);
        S4RLoader cl = loaderFactory.createS4RLoader(s4r.getAbsolutePath());
        try {
            JarFile s4rFile = new JarFile(s4r);
            if (s4rFile.getManifest() == null) {
                logger.warn("Cannot load s4r archive [{}] : missing manifest file");
                return null;
View Full Code Here

            inputReader = new InputStreamReader(System.in);
            br = new BufferedReader(inputReader);

            // send all messages
            for  (String inputLine = null; (inputLine = br.readLine()) != null;) {
                Message m = new Message(streamName, clazz, inputLine);
                d.send(m);
            }
           
            // read all responses
            while (true) {
                Message response = d.recv();
                System.out.println(response);
            }
            /*List<Message> responses = d.recvAll(999999999);
            for (Message message : responses) {
                System.out.println(message);
View Full Code Here

           
            inputReader = new InputStreamReader(System.in);
            br = new BufferedReader(inputReader);

            for  (String inputLine = null; (inputLine = br.readLine()) != null;) {
                Message m = new Message(streamName, clazz, inputLine);
                d.send(m);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
View Full Code Here

                System.exit(1);          
            }

            // read all responses
            while (true) {
                Message response = d.recv();
                System.out.println(displayId + ":" + response);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
View Full Code Here

                        System.err.printf("Invalid _index value %d\n",
                                          classIndex);
                        return;
                    }
                   
                    Message message = new Message(eventTypeInfo.getStreamName(), eventTypeInfo.getClassName(), inputLine);
                    sendMessage(message);
                    emitCount++;
                } catch (JSONException je) {
                    je.printStackTrace();
                    System.err.printf("Bad input data %s\n", inputLine);
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.client.Message

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.