{"id":37028638,"url":"https://github.com/coditory/quark-eventbus","last_synced_at":"2026-01-14T03:25:44.434Z","repository":{"id":63250720,"uuid":"560006350","full_name":"coditory/quark-eventbus","owner":"coditory","description":null,"archived":false,"fork":false,"pushed_at":"2024-04-22T09:20:28.000Z","size":130,"stargazers_count":0,"open_issues_count":5,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2024-05-01T09:39:48.158Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/coditory.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["coditory"]}},"created_at":"2022-10-31T14:50:05.000Z","updated_at":"2024-05-13T10:42:45.936Z","dependencies_parsed_at":"2023-11-06T11:26:38.980Z","dependency_job_id":"4e437177-dbe7-409a-b11f-146852a8239e","html_url":"https://github.com/coditory/quark-eventbus","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/coditory/quark-eventbus","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coditory%2Fquark-eventbus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coditory%2Fquark-eventbus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coditory%2Fquark-eventbus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coditory%2Fquark-eventbus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coditory","download_url":"https://codeload.github.com/coditory/quark-eventbus/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coditory%2Fquark-eventbus/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28408841,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T01:52:23.358Z","status":"online","status_checked_at":"2026-01-14T02:00:06.678Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2026-01-14T03:25:43.686Z","updated_at":"2026-01-14T03:25:44.418Z","avatar_url":"https://github.com/coditory.png","language":"Java","readme":"# Quark EventBus\n[![Build](https://github.com/coditory/quark-eventbus/actions/workflows/build.yml/badge.svg)](https://github.com/coditory/quark-eventbus/actions/workflows/build.yml)\n[![Coverage](https://codecov.io/gh/coditory/quark-eventbus/branch/master/graph/badge.svg?token=DHH8U96FKV)](https://codecov.io/gh/coditory/quark-eventbus)\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.coditory.quark/quark-eventbus/badge.svg)](https://mvnrepository.com/artifact/com.coditory.quark/quark-eventbus)\n\n\u003e Super simple, lightweight, single purpose, in-memory EventBus java library. Similar to eventBuses provided by [Spring Framework](https://docs.spring.io/spring-framework/docs/5.3.9/javadoc-api/org/springframework/context/ApplicationEvent.html)\nor [Guava](https://github.com/google/guava/wiki/EventBusExplained) but without the unrelated parts.\n\n- lightweight, no dependencies\n- single purpose, not part of a framework\n- provides both functional and annotation based API\n- public API annotated with `@NotNull` and `@Nullable` for better [kotlin integration](https://kotlinlang.org/docs/java-to-kotlin-nullability-guide.html#platform-types)\n- integrates with [event bus](https://github.com/coditory/quark-context)\n\nThis EventBus is threadsafe and synchronous. It deliberately provides no asynchronous api to keep it super simple.\n\n## Installation\n\nAdd to your `build.gradle`:\n\n```gradle\ndependencies {\n    implementation \"com.coditory.quark:quark-eventbus:0.0.6\"\n}\n```\n\n## Usage\n\n### EventHandler subscription\n\n```java\npublic class Application {\n    public static void main(String[] args) {\n        EventBus eventBus = EventBus.create();\n        eventBus.subscribe(new TwoHandlers());\n        eventBus.emit(\"hello\");\n        eventBus.emit(42);\n    }\n\n    static class TwoHandlers {\n        @EventHandler\n        void handle(String event) {\n            System.out.println(\"String event: \" + event);\n        }\n\n        @EventHandler\n        void handle(Integer event) {\n            System.out.println(\"Integer event: \" + event);\n        }\n    }\n}\n// Output:\n// String event: hello\n// Integer event: 42\n```\n\n### EventListener subscription\n\n```java\npublic class Application {\n    public static void main(String[] args) {\n        EventBus eventBus = EventBus.create();\n        eventBus.subscribe(String.class, (event) -\u003e System.out.println(\"String event: \" + event));\n        eventBus.subscribe(Number.class, (event) -\u003e System.out.println(\"Integer event: \" + event));\n        eventBus.subscribe(Integer.class, (event) -\u003e System.out.println(\"Integer event: \" + event));\n        eventBus.emit(\"hello\");\n        eventBus.emit(42);\n    }\n}\n// Output:\n// String event: hello\n// Integer event: 42\n// Number event: 42\n```\n\n### Exception handling\n\n```java\npublic class Application {\n    public static void main(String[] args) {\n        EventBus eventBus = EventBus.builder()\n                .subscribe(String.class, (event) -\u003e { throw new RuntimeException(\"xxx\"); })\n                .subscribe(String.class, (event) -\u003e System.out.println(\"String event: \" + event))\n                .setExceptionHandler(ctx -\u003e System.out.println(\"Exception: \" + ctx.exception()))\n                .build();\n        eventBus.emit(\"hello\");\n    }\n}\n// Output:\n// Exception: java.lang.RuntimeException: xxx\n// String event: hello\n```\n\n### Handling unhandled events\n\n```java\npublic class Application {\n    public static void main(String[] args) {\n        EventBus eventBus = EventBus.builder()\n                .subscribe(String.class, (event) -\u003e System.out.println(\"String event: \" + event))\n                .subscribe(UnhandledEvent.class, (unhandled) -\u003e System.out.println(\"Unhandled event: \" + unhandled.event()))\n                .build();\n        eventBus.emit(42);\n    }\n}\n// Output:\n// Unhandled event: 42\n```","funding_links":["https://github.com/sponsors/coditory"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoditory%2Fquark-eventbus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoditory%2Fquark-eventbus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoditory%2Fquark-eventbus/lists"}