congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
Worker.run
Code IndexAdd Tabnine to your IDE (free)

How to use
run
method
in
com.amazonaws.services.kinesis.clientlibrary.lib.worker.Worker

Best Java code snippets using com.amazonaws.services.kinesis.clientlibrary.lib.worker.Worker.run (Showing top 8 results out of 315)

origin: com.amazonaws/amazon-kinesis-client

@Override
public Integer call() throws Exception {
  int exitCode = 0;
  try {
    worker.run();
  } catch (Throwable t) {
    LOG.error("Caught throwable while processing data.", t);
    exitCode = 1;
  }
  return exitCode;
}
origin: harishreedharan/usingflumecode

 @Override
 public void run() {
  while (!Thread.currentThread().isInterrupted()){
   worker = new Worker(processorFactory, clientConfig);
   worker.run(); // Returns when worker is shutdown
  }
 }
});
origin: awslabs/amazon-kinesis-connectors

@Override
public void run() {
  if (worker != null) {
    // Start Amazon Kinesis Client Library worker to process records
    LOG.info("Starting worker in " + getClass().getSimpleName());
    try {
      worker.run();
    } catch (Throwable t) {
      LOG.error(t);
      throw t;
    } finally {
      LOG.error("Worker " + getClass().getSimpleName() + " is not running.");
    }
  } else {
    throw new RuntimeException("Initialize must be called before run.");
  }
}
origin: com.amazonaws/amazon-kinesis-connectors

@Override
public void run() {
  if (worker != null) {
    // Start Amazon Kinesis Client Library worker to process records
    LOG.info("Starting worker in " + getClass().getSimpleName());
    try {
      worker.run();
    } catch (Throwable t) {
      LOG.error(t);
      throw t;
    } finally {
      LOG.error("Worker " + getClass().getSimpleName() + " is not running.");
    }
  } else {
    throw new RuntimeException("Initialize must be called before run.");
  }
}
origin: awslabs/amazon-kinesis-aggregators

public int run() throws Exception {
  configure();
  System.out.println(String.format("Starting %s", appName));
  LOG.info(String.format("Running %s to process stream %s", appName,
      streamName));
  IRecordProcessorFactory recordProcessorFactory = new AggregatorProcessorFactory(
      aggGroup);
  worker = new Worker(recordProcessorFactory, this.config);
  int exitCode = 0;
  int failures = 0;
  // run the worker, tolerating as many failures as is configured
  while (failures < failuresToTolerate || failuresToTolerate == -1) {
    try {
      worker.run();
    } catch (Throwable t) {
      LOG.error("Caught throwable while processing data.", t);
      failures++;
      if (failures < failuresToTolerate) {
        LOG.error("Restarting...");
      } else {
        shutdown();
      }
      exitCode = 1;
    }
  }
  return exitCode;
}
origin: awslabs/dynamodb-cross-region-library

/**
 * Command line main method entry point
 *
 * @param args
 *            command line arguments
 */
public static void main(String[] args) {
  try {
    final Optional<Worker> workerOption = mainUnsafe(args);
    if (!workerOption.isPresent()) {
      return;
    }
    System.out.println("Starting replication now, check logs for more details.");
    workerOption.get().run();
  } catch (ParameterException e) {
    log.error(e);
    JCommander.getConsole().println(e.toString());
    System.exit(StatusCodes.EINVAL);
  } catch (Exception e) {
    log.fatal(e);
    JCommander.getConsole().println(e.toString());
    System.exit(StatusCodes.EINVAL);
  }
}
origin: aws/amazon-kinesis-video-streams-parser-library

@Override
public void run() {
  try {
    String workerId = InetAddress.getLocalHost().getCanonicalHostName() + ":" + UUID.randomUUID();
    KinesisClientLibConfiguration kinesisClientLibConfiguration = new KinesisClientLibConfiguration(APPLICATION_NAME, kdsStreamName, credentialsProvider, workerId);
    kinesisClientLibConfiguration.withInitialPositionInStream(SAMPLE_APPLICATION_INITIAL_POSITION_IN_STREAM).withRegionName(region.getName());
    final IRecordProcessorFactory recordProcessorFactory = () -> new KinesisRecordProcessor(rekognizedFragmentsIndex, credentialsProvider);
    final Worker worker = new Worker(recordProcessorFactory, kinesisClientLibConfiguration);
    System.out.printf("Running %s to process stream %s as worker %s...", APPLICATION_NAME, kdsStreamName, workerId);
    int exitCode = 0;
    try {
      worker.run();
    } catch (Throwable t) {
      System.err.println("Caught throwable while processing data.");
      t.printStackTrace();
      exitCode = 1;
    }
    System.out.println("Exit code : " + exitCode);
  } catch (Exception e) {
    e.printStackTrace();
  }
}
origin: com.sonymobile/lumbermill-aws-kcl

public void start()  {
  int mb = 1024 * 1024;
  LOG.info("Max memory:           {} mb", Runtime.getRuntime().maxMemory() / mb);
  LOG.info("Starting up Kinesis Consumer... (may take a few seconds)");
  AmazonKinesisClient kinesisClient = new AmazonKinesisClient(kinesisCfg.getKinesisCredentialsProvider(),
      kinesisCfg.getKinesisClientConfiguration());
  AmazonDynamoDBClient dynamoDBClient = new AmazonDynamoDBClient(kinesisCfg.getDynamoDBCredentialsProvider(),
      kinesisCfg.getDynamoDBClientConfiguration());
  AmazonCloudWatch cloudWatchClient = new AmazonCloudWatchClient(kinesisCfg.getCloudWatchCredentialsProvider(),
      kinesisCfg.getCloudWatchClientConfiguration());
  Worker worker = new Worker.Builder()
      .recordProcessorFactory(() -> new RecordProcessor(unitOfWorkListener, exceptionStrategy, metricsCallback, dry))
      .config(kinesisCfg)
      .kinesisClient(kinesisClient)
      .dynamoDBClient(dynamoDBClient)
      .cloudWatchClient(cloudWatchClient)
      .build();
  worker.run();
}
com.amazonaws.services.kinesis.clientlibrary.lib.workerWorkerrun

Javadoc

Start consuming data from the stream, and pass it to the application record processors.

Popular methods of Worker

  • <init>
  • shutdown
    Signals worker to shutdown. Worker will try initiating shutdown of all record processors. Note that
  • buildConsumer
  • cleanupShardConsumers
    NOTE: This method is internal/private to the Worker class. It has package access solely for testing.
  • createGracefulShutdownCallable
    Creates a callable that will execute the graceful shutdown process. This callable can be used to exe
  • createOrGetShardConsumer
    NOTE: This method is internal/private to the Worker class. It has package access solely for testing.
  • createWorkerShutdownCallable
  • finalShutdown
    Perform final shutdown related tasks for the worker including shutting down worker owned executor se
  • getExecutorService
    Returns default executor service that should be used by the worker.
  • getMetricsFactory
    Given configuration, returns appropriate metrics factory.
  • getShardInfoForAssignments
  • getShardInfoShardConsumerMap
  • getShardInfoForAssignments,
  • getShardInfoShardConsumerMap,
  • initialize,
  • isShutdownComplete,
  • requestShutdown,
  • runProcessLoop,
  • setField,
  • shouldShutdown,
  • startGracefulShutdown

Popular in Java

  • Finding current android device location
  • getSystemService (Context)
  • runOnUiThread (Activity)
  • putExtra (Intent)
  • Menu (java.awt)
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • SortedSet (java.util)
    SortedSet is a Set which iterates over its elements in a sorted order. The order is determined eithe
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • 14 Best Plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now