eBay / parallec-samples

Single file examples and ready-to-use servers show how to use parallec.io library. Examples to aggregate APIs and publish to Elastic Search and Kafka, and many more. www.parallec.io
92 stars 36 forks source link

Parallec-logo

Parallec Sample Applications


Sample Applications demonstrate how to use parallec.io library, such as aggregate APIs and publish to Elastic Search and Kafka.

Each file is independent with a main function and can be run directly. (TCP/HTTP Async API requires the sample HTTP/TCP servers to start in advance. Sample servers included here are independent executable files too).

More comprehensive examples are available in the test cases. Such as cancel tasks. Capacity aware scheduler and etc.

Sample App Location Overview
HTTP Basic Http. Handle Async APIs with auto progress polling. Asyn run Parallel Task with progress polling. Result aggregation. Provided a sample HttpServer will async job submission/polling API to test with. Send to elastic search. Request template with variable replacements.
SSH Sample Parallel SSH. Need to input the userName, ip, then [password / keyfile path]. Tested with EC2 instance in AWS.
PING Sample Parallel Ping App.
TCP Sample Parallel TCP app. Includes a sample TCP Echo Server to test with.

HTTP

Set Target Hosts

Please refer to the documentation to set target hosts differently.

Usage

You may simple fork the project, or copy and paste indivisual files after getting the correct dependencies

Maven

<dependency>
    <groupId>io.parallec</groupId>
    <artifactId>parallec-core</artifactId>
    <version>0.9.3</version>
</dependency>

Gradle

compile 'io.parallec:parallec-core:0.9.3'
Screenshots

Executing Http3WebAgrregateToElasticSearchMinApp.java, visualized in Kibana.

With elasticsearch-1.3.4 and kibana-3.1.2

Screenshot

Sample Spark Server


Sample Single File Web Server in Spark with Parallec . Require JDK 1.8+ due to Spark server.

Build & Run

Build:

Fork the project and run:

mvn clean compile assembly:single
Run:

In folder: parallec-samples/sample-spark-server/target: (if not conduct ping, no need of sudo)

sudo java -jar parallec-sample-spark-server-0.9.0-jar-with-dependencies.jar

Server APIs

The APIs tries to get target hosts from a local file in the same path.

 get("/http/:filename"
 get("/ssh/:filename/:concurrency/:showDetail"

targetHostFile location:

APIs:

Sample Output

http://localhost:4567/http/targetHostFile

Parallec: completed HTTP and sent to elastic search 
:3 Servers in 0.575 seconds. Results:  Results: [200 OK COUNT: 3 ]:
    www.parallec.io
    www.jeffpei.com
    www.ebay.com
###################################

At 2015.11.01.10.15.47.398-0800

Thanks for trying Parallec.io. Please submit a git issue for any questions you have.

Author and Contributors

Original Author

Yuanteng (Jeff) Pei

Contributors

Your name here

Licenses

Code licensed under Apache License v2.0

© 2015 eBay Software Foundation