Skip to content

gabrielhora/elementar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

    Elementar
    =========

    Very simple distributed background job executor based on Redis and the Redisson library.


    ---

    Add to your project:

    <!-- add the repository -->
    <repositories>
        <repository>
            <id>elementar-mvn-repo</id>
            <url>https://raw.github.com/gabrielhora/elementar/mvn-repo/</url>
            <snapshots>
                <enabled>true</enabled>
                <updatePolicy>always</updatePolicy>
            </snapshots>
        </repository>
    </repositories>

    <!-- add the dependency -->
    <dependency>
        <groupId>gsch</groupId>
        <artifactId>elementar</artifactId>
        <version>0.1.1</version>
    </dependency>


    The worker jar can be downloaded from https://raw.github.com/gabrielhora/elementar/mvn-repo/gsch/elementar/0.1.1/elementar-0.1.1-jar-with-dependencies.jar


    ---

    Define your jobs:

    class MyJob extends Job
    {
        public void run()
        {
            // do something here
        }
    }

    // create a new task manager and enqueue the job
    TaskManager taskManager = new TaskManager("localhost", 6379);
    taskManager.enqueue(new MyJob());


    Start the worker:

    You will need the elementar jar file and the your project's jar file (I recomend using
    a fat jar so you don't have to specify a huge classpath in the command line).
    You can scale out to as many workers as you want.

    $ java -cp \
        jar-with-your-jobs-and-dependencies.jar:elementar.jar \
        -Dredis_host=localhost \ # optional
        -Dredis_port=6379 \      # optional
        -Dinterval=1000 \        # optional
        -Dthreads=50 \           # optional
        gsch.Worker

About

Very simple distributed background job executor based on Redis and the Redisson library.

Resources

Stars

Watchers

Forks

Packages

No packages published