Giter VIP home page Giter VIP logo

geev's Introduction

Geev

Maven Central Travis IC codecov Codacy Badge Javadocs

Geev is an implementation of the Piran Role-Based Node Discovery (PIRAN/RBND) version 1 specification. Geev is a simple library you can add to your application and use it to discover other nodes and their roles. To understand the protocol see RBND-specification

The Name

Geev is a mythical hero of the Iranian historical and mythical epic book, Shahnaame. Who went abroad and searched several years to find Kay-khosrow the king of the Iran. He finally found the king and brought him and his mother back to Iran.

Usage

First add maven dependency like this:

<dependency>
        <groupId>com.piran-framework</groupId>
        <artifactId>geev</artifactId>
        <version>0.3-RELEASE</version>
</dependency>

Then you can create a new geev object like this:

Geev geev = new Geev(new GeevConfig.Builder()
            .onJoin((node) -> /* do what you want when a new node found*/)
            .onLeave((node) -> /* also do what you want when a node left*/)
            .setMySelf(new Node("YourNodeRole",yourInetAddress,yourPort))
            .build()

It start a background thread to do discovery.

Spring-boot starter

A Spring-boot-starter has been particularly designed for Geev which could be mounted on Spring-boot applications. By adding @EnableGeevContainer class-level annotation on the Configuration class, Geev starts and scans all the beans with @GeevHook annotation. Note that, if a class is marked with @GeevHook, that class would be qualified to be a Spring component bean as well, so there would be no need to add @Component or @Service by doing so. Every GeevHook class can contain methods annotated by @NodeJoined or @NodeLeft. These method invoked when a new node joined or a existing node left. To use geev starter add this dependency to your project:

<dependency>
        <groupId>com.piran-framework</groupId>
        <artifactId>geev-spring-boot-starter</artifactId>
        <version>0.3-RELEASE</version>
</dependency>

###Spring-Boot properties To add geev-starter to a spring-boot application, add three properties besides spring-boot properties: geev.broadcast #to indicate use broadcast strategy. default true geev.multicast-address #indicate the multicast address used in multicast strategy geev.discovery-port #which port geev use default 5172 geev.myself-role #role of the node geev.myself-ip #ip of the node geev.myself-port #port of the node

They are the same as GeevConfig fields.

Build

You need jdk >= 1.8 and maven to build geev. simply use maven to build and install the artifact into your local repository by the command:

mvn install

Then you can add geev into your project POM file like this:

<dependency>
        <groupId>com.piran-framework</groupId>
        <artifactId>geev</artifactId>
        <version>0.3-RELEASE</version>
</dependency>

Contribution

Any contributions are welcomed. Also if you find any problem using geev you can create issue in github issue tracker of the project. There is just one limitation for the contribution and it's respect the code style located in code-style.xml

License

Copyright (c) 2018 Isa Hekmatizadeh.

Geev is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Geev is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.