{"id":20935154,"url":"https://github.com/philippheuer/events4j","last_synced_at":"2025-07-09T12:08:11.065Z","repository":{"id":32644546,"uuid":"133151090","full_name":"PhilippHeuer/events4j","owner":"PhilippHeuer","description":"Java Event Dispatcher / Consumer","archived":false,"fork":false,"pushed_at":"2025-07-05T13:46:51.000Z","size":750,"stargazers_count":26,"open_issues_count":0,"forks_count":6,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-07-09T12:06:54.640Z","etag":null,"topics":["events","hacktoberfest","java","reactor"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PhilippHeuer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-05-12T13:56:51.000Z","updated_at":"2025-07-05T13:46:13.000Z","dependencies_parsed_at":"2023-09-22T02:32:30.294Z","dependency_job_id":"cb7ac0c3-544e-49a4-addd-3f15de6cbaa7","html_url":"https://github.com/PhilippHeuer/events4j","commit_stats":{"total_commits":205,"total_committers":11,"mean_commits":"18.636363636363637","dds":0.6146341463414634,"last_synced_commit":"3d1dc4400b5bddfad7fd80cb6b15d33b20855225"},"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"purl":"pkg:github/PhilippHeuer/events4j","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PhilippHeuer%2Fevents4j","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PhilippHeuer%2Fevents4j/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PhilippHeuer%2Fevents4j/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PhilippHeuer%2Fevents4j/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PhilippHeuer","download_url":"https://codeload.github.com/PhilippHeuer/events4j/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PhilippHeuer%2Fevents4j/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264455988,"owners_count":23611065,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["events","hacktoberfest","java","reactor"],"created_at":"2024-11-18T22:13:15.347Z","updated_at":"2025-07-09T12:08:11.041Z","avatar_url":"https://github.com/PhilippHeuer.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# *Events4J*\n\n[![Latest](https://img.shields.io/github/release/PhilippHeuer/events4j/all.svg?style=flate\u0026label=latest)](https://search.maven.org/search?q=com.github.philippheuer.events4j)\n[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/philippheuer/events4j/badge)](https://securityscorecards.dev/viewer/?uri=github.com/philippheuer/events4j)\n\n[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=github-com-133151090\u0026metric=bugs)](https://sonarcloud.io/summary/overall?id=github-com-133151090)\n[![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=github-com-133151090\u0026metric=code_smells)](https://sonarcloud.io/summary/overall?id=github-com-133151090)\n[![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=github-com-133151090\u0026metric=duplicated_lines_density)](https://sonarcloud.io/summary/overall?id=github-com-133151090)\n[![SonarCloud Coverage](https://sonarcloud.io/api/project_badges/measure?project=github-com-133151090\u0026metric=coverage)](https://sonarcloud.io/component_measures?metric=Coverage\u0026view=list\u0026id=github-com-133151090)\n\nClick the module name in the table below for specific import instructions. (gradle, maven, ...)\n\n| Module                                                                                                                                                                                                                                 | Javadoc                                                                                                                                                                                                       | Description                                        |\n|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------|\n| [![Lib](https://img.shields.io/maven-central/v/com.github.philippheuer.events4j/events4j-api?label=events4j-api)](https://search.maven.org/artifact/com.github.philippheuer.events4j/events4j-api)                                     | [![Javadoc](https://javadoc.io/badge2/com.github.philippheuer.events4j/events4j-api/javadoc.svg?label=javadoc)](https://javadoc.io/doc/com.github.philippheuer.events4j/events4j-api)                         | contains all interfaces                            |\n| [![Lib](https://img.shields.io/maven-central/v/com.github.philippheuer.events4j/events4j-core?label=events4j-core)](https://search.maven.org/artifact/com.github.philippheuer.events4j/events4j-core)                                  | [![Javadoc](https://javadoc.io/badge2/com.github.philippheuer.events4j/events4j-core/javadoc.svg?label=javadoc)](https://javadoc.io/doc/com.github.philippheuer.events4j/events4j-core)                       | contains the EventManager implementation           |\n| [![Lib](https://img.shields.io/maven-central/v/com.github.philippheuer.events4j/events4j-kotlin?label=events4j-kotlin)](https://search.maven.org/artifact/com.github.philippheuer.events4j/events4j-kotlin)                            |                                                                                                                                                                                                               | improvements for usage in kotlin projects          |\n| [![Lib](https://img.shields.io/maven-central/v/com.github.philippheuer.events4j/events4j-handler-simple?label=events4j-handler-simple)](https://search.maven.org/artifact/com.github.philippheuer.events4j/events4j-handler-simple)    | [![Javadoc](https://javadoc.io/badge2/com.github.philippheuer.events4j/events4j-handler-simple/javadoc.svg?label=javadoc)](https://javadoc.io/doc/com.github.philippheuer.events4j/events4j-handler-simple)   | a simple synchronous event handler                 |\n| [![Lib](https://img.shields.io/maven-central/v/com.github.philippheuer.events4j/events4j-handler-reactor?label=events4j-handler-reactor)](https://search.maven.org/artifact/com.github.philippheuer.events4j/events4j-handler-reactor) | [![Javadoc](https://javadoc.io/badge2/com.github.philippheuer.events4j/events4j-handler-reactor/javadoc.svg?label=javadoc)](https://javadoc.io/doc/com.github.philippheuer.events4j/events4j-handler-reactor) | a event dispatcher using project reactor           |\n| [![Lib](https://img.shields.io/maven-central/v/com.github.philippheuer.events4j/events4j-handler-spring?label=events4j-handler-spring)](https://search.maven.org/artifact/com.github.philippheuer.events4j/events4j-handler-spring)    | [![Javadoc](https://javadoc.io/badge2/com.github.philippheuer.events4j/events4j-handler-spring/javadoc.svg?label=javadoc)](https://javadoc.io/doc/com.github.philippheuer.events4j/events4j-handler-spring)   | forward events to spring ApplicationEventPublisher |\n\n# Description\n\n**Events4J** provides the following features:\n\n- publish events\n- register consumers / listeners for events\n- comes with a few prebuilt handlers that you can use out of the box\n- provide your custom implementation to process events however you want\n\n# Usage\n\n## Initialization\n\n```java\nEventManager eventManager = new EventManager(); // new instance\neventManager.autoDiscovery(); // register modules automatically\n```\n\n## Event Producer\n\n```java\nTestEvent testEvent = new TestEvent();\neventManager.publish(testEvent);\n```\n\n## Event Consumer\n\n#### Subscriber-based\n\n```java\nIEventManager eventManager = new EventManager();\nReactorEventHandler reactorEventHandler = new ReactorEventHandler(eventManager);\neventManager.registerEventHandler(reactorEventHandler);\n```\n\nThe Consumer\n```java\nreactorEventHandler.onEvent(TestEvent.class).subscribe(event -\u003e {\n    log.info(\"TestEvent received\");\n});\n```\n\n#### Simple\n\nIf you want to use annotation-based events, you need to enable this feature. Annotation-based event consumers are disabled by default.\n\n```java\nIEventManager eventManager = new EventManager();\nSimpleEventHandler simpleEventHandler = new SimpleEventHandler();\neventManager.registerEventHandler(simpleEventHandler);\n```\n\n*The Consumer*\n```java\npublic class TestEventListener {\n\n    @EventSubscriber\n    public void onTestEvent(TestEvent testEvent) {\n        System.out.println(\"TestEvent received\");\n    }\n\n}\n```\n\n*Register the Consumer*\n```java\neventManager.registerListener(new TestEventListener());\n```\n\n#### Spring Events\n\nConfigure the following in your `application.properties` to enable spring application events:\n\n```yaml\nevents4j.handler.spring.enabled: true\n```\n\n*The Consumer*\n\n```java\n@EventListener\npublic void handleContextStart(TestEvent testEvent) {\n    System.out.println(\"TestEvent received\");\n}\n```\n\n## Kotlin\n\nThe kotlin module allows the usage of [flows](https://kotlinlang.org/docs/flow.html) to consume events.\n\n```kotlin\neventManager.flowOn\u003cTestEvent\u003e()\n    .collect { testEvent -\u003e\n        println(\"TestEvent received\")\n    }\n```\n\n## License\n\nReleased under the [MIT License](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphilippheuer%2Fevents4j","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphilippheuer%2Fevents4j","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphilippheuer%2Fevents4j/lists"}