Examples of PseudoTxnMemoryChannel


Examples of org.apache.flume.channel.PseudoTxnMemoryChannel

    context.put("sink.batchSize", "1");


    Configurables.configure(sink, context);

    Channel channel = new PseudoTxnMemoryChannel();
    Configurables.configure(channel, context);

    sink.setChannel(channel);
    sink.start();

    for (int i = 0; i < 10; i++) {
      Event event = new SimpleEvent();

      event.setBody(("Test event " + i).getBytes());

      channel.put(event);
      sink.process();

      Thread.sleep(500);
    }
View Full Code Here

Examples of org.apache.flume.channel.PseudoTxnMemoryChannel

  @Test
  public void testProcess() throws InterruptedException, LifecycleException,
      EventDeliveryException {

    Channel channel = new PseudoTxnMemoryChannel();
    Context context = new Context();

    context.put("logicalNode.name", "test");

    Configurables.configure(source, context);
    Configurables.configure(channel, context);

    source.setChannel(channel);

    for (long i = 0; i < 100; i++) {
      source.process();
      Event event = channel.take();

      Assert.assertArrayEquals(String.valueOf(i).getBytes(),
          new String(event.getBody()).getBytes());
    }
  }
View Full Code Here

Examples of org.apache.flume.channel.PseudoTxnMemoryChannel

  @Test
  public void testLifecycle() throws InterruptedException,
      EventDeliveryException {

    Channel channel = new PseudoTxnMemoryChannel();
    Context context = new Context();

    context.put("logicalNode.name", "test");

    Configurables.configure(source, context);
    Configurables.configure(channel, context);

    source.setChannel(channel);
    source.start();

    for (long i = 0; i < 100; i++) {
      source.process();
      Event event = channel.take();

      Assert.assertArrayEquals(String.valueOf(i).getBytes(),
          new String(event.getBody()).getBytes());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.