Package com.twitter.hbc.core.processor

Examples of com.twitter.hbc.core.processor.StringDelimitedProcessor


  @Test
  public void testDelimitedStreamProcessing() throws Exception {
    SimpleStreamProvider simpleStream = new SimpleStreamProvider(messages, true, false);

    BlockingQueue<String> queue = new ArrayBlockingQueue<String>(10);
    HosebirdMessageProcessor processor = new StringDelimitedProcessor(queue);

    int count = processStream(simpleStream, processor, queue);

    assertEquals(messages.length, count);
  }
View Full Code Here


    SimpleStreamProvider simpleStream = new SimpleStreamProvider(messages, true, true);
    int count = 0;
    try {
      InputStream stream = simpleStream.createInputStream();
      BlockingQueue<String> queue = new ArrayBlockingQueue<String>(10);
      HosebirdMessageProcessor processor = new StringDelimitedProcessor(queue);
      processor.setup(stream);
      // read until we hit the IOException
      while (count < messages.length * 2) {
        processor.process();
        // trimming to get rid of the CRLF
        assertTrue(messages[count].equals(queue.take().trim()));
        count++;
      }
      fail();
View Full Code Here

    // Create a new BasicClient. By default gzip is enabled.
    Client client = new ClientBuilder()
            .hosts(Constants.STREAM_HOST)
            .endpoint(endpoint)
            .authentication(auth)
            .processor(new StringDelimitedProcessor(queue))
            .build();

    // Establish a connection
    client.connect();
View Full Code Here

    SimpleStreamProvider simpleStream = new SimpleStreamProvider(messages, true, true);
    int count = 0;
    try {
      InputStream stream = simpleStream.createInputStream();
      BlockingQueue<String> queue = new ArrayBlockingQueue<String>(10);
      HosebirdMessageProcessor processor = new StringDelimitedProcessor(queue);
      processor.setup(stream);
      // read until we hit the IOException
      while (count < messages.length * 2) {
        processor.process();
        // trimming to get rid of the CRLF
        assertTrue(messages[count].equals(queue.take().trim()));
        count++;
      }
      fail();
View Full Code Here

    BasicClient client = new ClientBuilder()
            .name("sampleExampleClient")
            .hosts(Constants.STREAM_HOST)
            .endpoint(endpoint)
            .authentication(auth)
            .processor(new StringDelimitedProcessor(queue))
            .build();

    // Establish a connection
    client.connect();
View Full Code Here

    // Create a new BasicClient. By default gzip is enabled.
    BasicClient client = new ClientBuilder()
      .hosts(Constants.STREAM_HOST)
      .endpoint(endpoint)
      .authentication(auth)
      .processor(new StringDelimitedProcessor(queue))
      .build();

    // Create an executor service which will spawn threads to do the actual work of parsing the incoming messages and
    // calling the listeners on each message
    int numProcessingThreads = 4;
View Full Code Here

    // Create a new BasicClient. By default gzip is enabled.
    BasicClient client = new ClientBuilder()
            .hosts(Constants.SITESTREAM_HOST)
            .endpoint(endpoint)
            .authentication(auth)
            .processor(new StringDelimitedProcessor(queue))
            .build();

    // Create an executor service which will spawn threads to do the actual work of parsing the incoming messages and
    // calling the listeners on each message
    int numProcessingThreads = 4;
View Full Code Here

        ClientBuilder builder = new ClientBuilder()
                .name("twitter-spout")
                .hosts(hosebirdHosts)
                .endpoint(endpoint)
                .authentication(hosebirdAuth)
                .processor(new StringDelimitedProcessor(tweetsToProcess));

        Client hbc = builder.build();
        hbc.connect();
    }
View Full Code Here

  private void initializeClient(StatusesSampleEndpoint endpoint, Authentication auth) {

    client = new ClientBuilder().name("twitterSourceClient").hosts(Constants.STREAM_HOST)
        .endpoint(endpoint).authentication(auth)
        .processor(new StringDelimitedProcessor(queue)).build();

    client.connect();
  }
View Full Code Here

TOP

Related Classes of com.twitter.hbc.core.processor.StringDelimitedProcessor

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.