lightning-core

Core module of lightning, a java based, distributed, super fast, asynchronous, URL execution engine. More information at https://ebay.github.io/lightning

License

License

GroupId

GroupId

com.ebay
ArtifactId

ArtifactId

lightning-core
Last Version

Last Version

0.9.0
Release Date

Release Date

Type

Type

jar
Description

Description

lightning-core
Core module of lightning, a java based, distributed, super fast, asynchronous, URL execution engine. More information at https://ebay.github.io/lightning
Project URL

Project URL

https://ebay.github.io/lightning
Source Code Management

Source Code Management

https://github.com/eBay/lightning/tree/master/lightning-core

Download lightning-core

How to add to project

<!-- https://jarcasting.com/artifacts/com.ebay/lightning-core/ -->
<dependency>
    <groupId>com.ebay</groupId>
    <artifactId>lightning-core</artifactId>
    <version>0.9.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.ebay/lightning-core/
implementation 'com.ebay:lightning-core:0.9.0'
// https://jarcasting.com/artifacts/com.ebay/lightning-core/
implementation ("com.ebay:lightning-core:0.9.0")
'com.ebay:lightning-core:jar:0.9.0'
<dependency org="com.ebay" name="lightning-core" rev="0.9.0">
  <artifact name="lightning-core" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.ebay', module='lightning-core', version='0.9.0')
)
libraryDependencies += "com.ebay" % "lightning-core" % "0.9.0"
[com.ebay/lightning-core "0.9.0"]

Dependencies

compile (16)

Group / Artifact Type Version
org.springframework.boot : spring-boot-starter-websocket jar 1.0.0.RELEASE
junit : junit jar 4.10
org.springframework : spring-test jar 4.0.3.RELEASE
javax.servlet : jstl jar 1.2
org.apache.commons : commons-lang3 jar 3.0
org.apache.tomcat : tomcat-websocket jar 8.0.5
org.springframework.boot : spring-boot-starter-web jar 1.0.1.RELEASE
org.springframework.boot : spring-boot-starter-actuator jar 1.0.1.RELEASE
com.google.code.gson : gson jar 2.6.2
com.google.guava : guava jar 19.0
commons-beanutils : commons-beanutils-core jar 1.8.3
commons-fileupload : commons-fileupload jar 1.2.2
commons-io : commons-io jar 1.3.2
commons-configuration : commons-configuration jar 1.9
org.mockito : mockito-all jar 1.10.19
ch.qos.logback : logback-classic jar 1.1.6

test (2)

Group / Artifact Type Version
org.powermock : powermock-api-mockito jar 1.6.2
org.powermock : powermock-module-junit4 jar 1.6.2

Project Modules

There are no modules declared in this project.

Lightning logo

Lightning

Lightning is a Java based, super fast, multi-mode, asynchronous, and distributed URL execution engine from eBay that delivers at scale.
Please refer Detailed documentation for more information.

Build Status Release Documentation Core API Client API CoreCov ClientCov

Usage

Run In Embedded Mode

To configure lightning core as an embedded service within the application. Click to Learn more about different Modes of Operation.

// Build LightningClient in Embedded Mode
final LightningClient client = new LightningClientBuilder().setEmbeddedMode(true).build();

// Create task List
final List<Task> lightningTasks = new ArrayList<>();
lightningTasks.add(new URLTask("http://www.ebay.com"));
lightningTasks.add(new URLTask("http://www.stubhub.com"));
lightningTasks.add(new URLTask("http://github.com/"));


// Submit task List with LightningResponseCallback and Timeout
final LightningResponseCallback callback = new LightningResponseCallback() {
    // Called when request could not complete within the given timeout
    @Override
    public void onTimeout(LightningResponse response) {
        System.out.println("Lightning request timed out.");
    }

    // Called when the request execution is completed
    @Override
    public void onComplete(LightningResponse response) {
        System.out.println("Request execution complete.");
        final int failureCount = response.getFailedResponses().size();
        if (failureCount > 0) {
            System.out.println("One or more requests failed.");
        } else {
            System.out.println("All results are successful with HTTP 200.");
            // Consume response...

        }
        System.out.println(response.prettyPrint());
    }
};

client.submitWithCallback(lightningTasks, callback, 5000);

Please find step-by-step here.

Run In Standalone Mode

To configure lightning core as an external service.

//Build LightningClient and register with a core instance running @localhost on port 8989
LightningClient client = new LightningClientBuilder().addSeed("localhost").setCorePort(8989).build();

//Create tasks List
final List<Task> lightningTasks = new ArrayList<Task>();
lightningTasks.add(new URLTask("http://www.ebay.com"));
lightningTasks.add(new URLTask("http://www.stubhub.com"));
lightningTasks.add(new URLTask("http://github.com/"));

//Submit task List with LightningResponseCallback and Timeout
LightningResponseCallback callback = new LightningResponseCallback() {
    // Called when request could not complete within the given timeout
    @Override
    public void onTimeout(LightningResponse response) {
        log.info("Lightning request timed out.");
    }
    
    //Called when the request execution is completed
    @Override
    public void onComplete(LightningResponse response) {
        log.info("Request execution complete.");
        int failureCount = response.getFailedResponses().size();
        if (failureCount > 0) {
            log.info("One or more requests failed.");
        } else {
            log.info("All results are successful with HTTP 200.");
            //Consume response...
        }
        log.info(response.prettyPrint());
    }
};
client.submitWithCallback(tasks, callback, 5000);

Please find step-by-step here.

Changelog

See CHANGELOG.md

Contributors

Lightning is served to you by Shankar Shukla and Site Engineering Tools Team(Ananth, Prabhu Pandurangan, Pragadesh) at eBay Inc. We would like to give special thanks to our Director Sham Kalwit for his vision, valuable guidance and encouragement.

License

MIT

com.ebay

eBay

https://ebay.github.io/

Versions

Version
0.9.0