Package com.datasift.client.stream

Examples of com.datasift.client.stream.Interaction


            String data = getDataAsString();
            try {
                ObjectNode meta = (ObjectNode) DataSiftClient.MAPPER.readTree(data);
                ArrayNode interactions = (ArrayNode) meta.get("interactions");
                for (JsonNode interaction : interactions) {
                    send(new Interaction(interaction));
                }
                buffer.discardReadBytes();
            } catch (IOException e) {
                log.warn("Failed to decode interactions", e);
            }
View Full Code Here


        if (done) {
            String data = getDataAsString();
            try {
                ArrayNode interactions = (ArrayNode) DataSiftClient.MAPPER.readTree(data);
                for (JsonNode interaction : interactions) {
                    send(new Interaction(interaction));
                }
                buffer.discardReadBytes();
            } catch (IOException e) {
                log.warn("Failed to decode interactions", e);
            }
View Full Code Here

        String line;
        try {
            while ((line = data.readLine()) != null) {
                //System.out.println(line);
                ObjectNode interaction = (ObjectNode) DataSiftClient.MAPPER.readTree(line);
                send(new Interaction(interaction));
            }
            buffer.discardReadBytes();
        } catch (IOException e) {
            log.info("Failed to decode interaction ", e);
        }
View Full Code Here

        //don't forget to start it, AFTER creating the pull subscription
        datasift.historics().start(historic).sync();

        PulledInteractions historicSubscriptions = datasift.push().pull(historicsSubscription).sync();

        Interaction interaction;
        while (!((interaction = historicSubscriptions.take()) instanceof LastInteraction)) {
            System.out.println(interaction);
        }
        System.out.println("We're done!");
    }
View Full Code Here

        PushSubscription streamSubscription = datasift.push()
                .createPull(PullJsonType.JSON_NEW_LINE, stream, "pull test").sync();

        PulledInteractions streamSubscriptions = datasift.push().pull(streamSubscription).sync();

        Interaction interaction;
        //non-blocking loop - if no data is available at the time of request the loop will be exited
        //if using this approach you must remember to manually call streamSubscriptions.stopPulling();
        for (Interaction i : streamSubscriptions) {
            System.out.println(i);
        }
View Full Code Here

            }
            try {
                ObjectNode meta = (ObjectNode) DataSiftClient.MAPPER.readTree(data);
                ArrayNode interactions = (ArrayNode) meta.get("interactions");
                for (JsonNode interaction : interactions) {
                    send(new Interaction(interaction));
                }
                buffer.discardReadBytes();
            } catch (IOException e) {
                log.warn("Failed to decode interactions", e);
            }
View Full Code Here

                return;
            }
            try {
                ArrayNode interactions = (ArrayNode) DataSiftClient.MAPPER.readTree(data);
                for (JsonNode interaction : interactions) {
                    send(new Interaction(interaction));
                }
                buffer.discardReadBytes();
            } catch (IOException e) {
                log.warn("Failed to decode interactions", e);
            }
View Full Code Here

        String line;
        try {
            while ((line = data.readLine()) != null) {
                //System.out.println(line);
                ObjectNode interaction = (ObjectNode) DataSiftClient.MAPPER.readTree(line);
                send(new Interaction(interaction));
            }
            buffer.discardReadBytes();
        } catch (IOException e) {
            log.info("Failed to decode interaction ", e);
        }
View Full Code Here

TOP

Related Classes of com.datasift.client.stream.Interaction

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.