本文整理汇总了Java中org.apache.flume.source.avro.Status类的典型用法代码示例。如果您正苦于以下问题:Java Status类的具体用法?Java Status怎么用?Java Status使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Status类属于org.apache.flume.source.avro包,在下文中一共展示了Status类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: append
import org.apache.flume.source.avro.Status; //导入依赖的package包/类
@Override
public Status append(AvroFlumeEvent avroEvent) {
logger.debug("Avro source {}: Received avro event: {}", getName(),
avroEvent);
sourceCounter.incrementAppendReceivedCount();
sourceCounter.incrementEventReceivedCount();
Event event = EventBuilder.withBody(avroEvent.getBody().array(),
toStringMap(avroEvent.getHeaders()));
try {
getChannelProcessor().processEvent(event);
} catch (ChannelException ex) {
logger.warn("Avro source " + getName() + ": Unable to process event. " +
"Exception follows.", ex);
return Status.FAILED;
}
sourceCounter.incrementAppendAcceptedCount();
sourceCounter.incrementEventAcceptedCount();
return Status.OK;
}
示例2: append
import org.apache.flume.source.avro.Status; //导入依赖的package包/类
@Override
public Status append(AvroFlumeEvent event) throws AvroRemoteException {
if (failed) {
logger.debug("Event rejected");
return Status.FAILED;
}
logger.debug("LB: Received event from append(): {}",
new String(event.getBody().array(), Charset.forName("UTF8")));
appendCount++;
return Status.OK;
}
示例3: appendBatch
import org.apache.flume.source.avro.Status; //导入依赖的package包/类
@Override
public Status appendBatch(List<AvroFlumeEvent> events) throws
AvroRemoteException {
if (failed) {
logger.debug("Event batch rejected");
return Status.FAILED;
}
logger.debug("LB: Received {} events from appendBatch()",
events.size());
appendBatchCount++;
return Status.OK;
}
示例4: append
import org.apache.flume.source.avro.Status; //导入依赖的package包/类
@Override
public Status append(AvroFlumeEvent avroEvent) {
if (logger.isDebugEnabled()) {
if (LogPrivacyUtil.allowLogRawData()) {
logger.debug("Avro source {}: Received avro event: {}", getName(), avroEvent);
} else {
logger.debug("Avro source {}: Received avro event", getName());
}
}
sourceCounter.incrementAppendReceivedCount();
sourceCounter.incrementEventReceivedCount();
Event event = EventBuilder.withBody(avroEvent.getBody().array(),
toStringMap(avroEvent.getHeaders()));
try {
getChannelProcessor().processEvent(event);
} catch (ChannelException ex) {
logger.warn("Avro source " + getName() + ": Unable to process event. " +
"Exception follows.", ex);
return Status.FAILED;
}
sourceCounter.incrementAppendAcceptedCount();
sourceCounter.incrementEventAcceptedCount();
return Status.OK;
}
示例5: appendBatch
import org.apache.flume.source.avro.Status; //导入依赖的package包/类
@Override
public Status appendBatch(List<AvroFlumeEvent> events) {
logger.debug("Avro source {}: Received avro event batch of {} events.",
getName(), events.size());
sourceCounter.incrementAppendBatchReceivedCount();
sourceCounter.addToEventReceivedCount(events.size());
List<Event> batch = new ArrayList<Event>();
for (AvroFlumeEvent avroEvent : events) {
Event event = EventBuilder.withBody(avroEvent.getBody().array(),
toStringMap(avroEvent.getHeaders()));
batch.add(event);
}
try {
getChannelProcessor().processEventBatch(batch);
} catch (Throwable t) {
logger.error("Avro source " + getName() + ": Unable to process event " +
"batch. Exception follows.", t);
if (t instanceof Error) {
throw (Error) t;
}
return Status.FAILED;
}
sourceCounter.incrementAppendBatchAcceptedCount();
sourceCounter.addToEventAcceptedCount(events.size());
return Status.OK;
}
示例6: testProcess
import org.apache.flume.source.avro.Status; //导入依赖的package包/类
@Test
public void testProcess() throws InterruptedException,
EventDeliveryException, InstantiationException, IllegalAccessException {
setUp();
Event event = EventBuilder.withBody("test event 1", Charsets.UTF_8);
Server server = createServer(new MockAvroServer());
server.start();
sink.start();
Assert.assertTrue(LifecycleController.waitForOneOf(sink,
LifecycleState.START_OR_ERROR, 5000));
Transaction transaction = channel.getTransaction();
transaction.begin();
for (int i = 0; i < 10; i++) {
channel.put(event);
}
transaction.commit();
transaction.close();
for (int i = 0; i < 5; i++) {
Sink.Status status = sink.process();
Assert.assertEquals(Sink.Status.READY, status);
}
Assert.assertEquals(Sink.Status.BACKOFF, sink.process());
sink.stop();
Assert.assertTrue(LifecycleController.waitForOneOf(sink,
LifecycleState.STOP_OR_ERROR, 5000));
server.close();
}
示例7: appendBatch
import org.apache.flume.source.avro.Status; //导入依赖的package包/类
@Override
public Status appendBatch(List<AvroFlumeEvent> events)
throws AvroRemoteException {
logger.debug("Received event batch:{}; delaying for {}ms", events, delay);
sleep();
return Status.OK;
}
示例8: append
import org.apache.flume.source.avro.Status; //导入依赖的package包/类
@Override
public Status append(AvroFlumeEvent avroEvent) {
if (isFail) {
return Status.FAILED;
}
appendCount.incrementAndGet();
return super.append(avroEvent);
}
示例9: appendBatch
import org.apache.flume.source.avro.Status; //导入依赖的package包/类
@Override
public Status appendBatch(List<AvroFlumeEvent> events) {
if (isFail) {
return Status.FAILED;
}
appendCount.addAndGet(events.size());
return super.appendBatch(events);
}
示例10: appendBatch
import org.apache.flume.source.avro.Status; //导入依赖的package包/类
@Override
public Status appendBatch(List<AvroFlumeEvent> events) {
logger.debug("Avro source {}: Received avro event batch of {} events.",
getName(), events.size());
sourceCounter.incrementAppendBatchReceivedCount();
sourceCounter.addToEventReceivedCount(events.size());
List<Event> batch = new ArrayList<Event>();
for (AvroFlumeEvent avroEvent : events) {
Event event = EventBuilder.withBody(avroEvent.getBody().array(),
toStringMap(avroEvent.getHeaders()));
batch.add(event);
}
try {
getChannelProcessor().processEventBatch(batch);
} catch (Throwable t) {
logger.error("Avro source " + getName() + ": Unable to process event " +
"batch. Exception follows.", t);
if (t instanceof Error) {
throw (Error) t;
}
return Status.FAILED;
}
sourceCounter.incrementAppendBatchAcceptedCount();
sourceCounter.addToEventAcceptedCount(events.size());
return Status.OK;
}
示例11: start
import org.apache.flume.source.avro.Status; //导入依赖的package包/类
private void start() {
flumeServer = RpcTestUtils.startServer(new AvroSourceProtocol(){
@Override
public Status append(AvroFlumeEvent event) throws AvroRemoteException {
return protocol.append(event);
}
@Override
public Status appendBatch(List<AvroFlumeEvent> events) throws AvroRemoteException {
return protocol.appendBatch(events);
}
});
}
示例12: appendBatch
import org.apache.flume.source.avro.Status; //导入依赖的package包/类
@Override
public Status appendBatch(List<AvroFlumeEvent> events) throws
AvroRemoteException {
LOG.info("Failed: Received {} events from appendBatch()",
events.size());
return Status.FAILED;
}
示例13: append
import org.apache.flume.source.avro.Status; //导入依赖的package包/类
@Override
public Status append(AvroFlumeEvent event) throws AvroRemoteException {
LOG.info("OK Sleep: Received event from append(): {}",
new String(event.getBody().array(), Charset.forName("UTF8")));
try {
Thread.sleep(sleepTime);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return Status.OK;
}
示例14: appendBatch
import org.apache.flume.source.avro.Status; //导入依赖的package包/类
/**
* Sends the AvroFlumeEvents from it's argument list to the Apache Flink
* {@link DataStream}.
*
* @param events
* The events that is sent to the dataStream
* @return A Status.OK message if sending the events was successful.
*/
@Override
public Status appendBatch(List<AvroFlumeEvent> events) {
for (AvroFlumeEvent avroEvent : events) {
collect(avroEvent);
}
return Status.OK;
}
示例15: appendBatch
import org.apache.flume.source.avro.Status; //导入依赖的package包/类
@Override
public Status appendBatch(final List<AvroFlumeEvent> events) throws AvroRemoteException {
Preconditions.checkState(eventQueue.addAll(events));
for (final AvroFlumeEvent event : events) {
// System.out.println("Received event " + event.getHeaders().get(new org.apache.avro.util.Utf8(FlumeEvent.GUID)));
}
return Status.OK;
}