Skip to content

AmayaFramework/amaya-events

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

amaya-events maven-central

A library that implements the event system.

Getting Started

To install it, you will need:

  • Java 11+
  • Maven/Gradle

Features

  • Universal event descriptor
  • Calling events by name
  • Java concurrent api based event calls
  • Flexible and convenient implementation

Installing

Gradle dependency

dependencies {
    implementation group: 'io.github.amayaframework', name: 'amaya-events', version: 'LATEST'
}

Maven dependency

<dependency>
    <groupId>io.github.amayaframework</groupId>
    <artifactId>amaya-events</artifactId>
    <version>LATEST</version>
</dependency>

Usage example

import io.github.amayaframework.events.*;

import java.util.concurrent.ForkJoinPool;

public class Main {
    public static void main(String[] args) throws InterruptedException {
        final var event = Event.of("CountEvent", Integer.class);
        var factory = new ParallelManagerFactory(ForkJoinPool::commonPool);
        var manager = factory.create();
        manager.set(event, count -> System.out.println("The count is now " + count));
        manager.fireNow(event, 5);
        manager.stop();
    }
}

This code will output:

The count is now 5

Built With

  • Gradle - Dependency management
  • jfunc - Functional interfaces, utilities

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details