{"id":20649917,"url":"https://github.com/micartey/jation","last_synced_at":"2026-02-18T05:01:53.906Z","repository":{"id":111901172,"uuid":"385685417","full_name":"micartey/jation","owner":"micartey","description":"Advanced high performance, distributed Java event system","archived":false,"fork":false,"pushed_at":"2025-12-18T10:19:44.000Z","size":156,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-21T17:25:59.050Z","etag":null,"topics":["annotation","asm","distributed","event","event-driven","event-system","eventmanager","java","reflection"],"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/micartey.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":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-07-13T17:32:13.000Z","updated_at":"2025-12-18T10:19:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"c2648a5d-3d81-4378-9115-230b695f822c","html_url":"https://github.com/micartey/jation","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/micartey/jation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micartey%2Fjation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micartey%2Fjation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micartey%2Fjation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micartey%2Fjation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/micartey","download_url":"https://codeload.github.com/micartey/jation/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micartey%2Fjation/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29569853,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-18T04:18:28.490Z","status":"ssl_error","status_checked_at":"2026-02-18T04:13:49.018Z","response_time":162,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["annotation","asm","distributed","event","event-driven","event-system","eventmanager","java","reflection"],"created_at":"2024-11-16T17:17:04.349Z","updated_at":"2026-02-18T05:01:53.901Z","avatar_url":"https://github.com/micartey.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jation\n\n\u003cdiv align=\"center\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Written_In-Java%2021-fd5c63?style=for-the-badge\u0026logo=openjdk\" alt=\"Java\" /\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Build%20Tool-Gradle-50C878?style=for-the-badge\u0026logo=gradle\" alt=\"Gradle\" /\u003e\n\u003c/div\u003e\n\n\n- [Event Observers](#event-observers)\n- [Subscribe classes](#subscribe-classes)\n- [Reflection pattern](#reflection-pattern)\n- [Consumer Pattern](#consumer-pattern)\n- [Create Events](#create-events)\n- [Publish Events](#publish-events)\n- [Distributed Events](#distributed-events)\n\n\n### 📚 Introduction\n\njation is a java event system which uses the build in java reflection api to automatically invoke methods with parameters.\nThe most interesting feature however, is the addition of network adapters which provide the possibility to distribute events between JVMs and machines.\n\n```groovy\nmaven {\n    url \"https://artifacts.micartey.dev/public\"\n}\n\n// ...\n\nimplementation \"me.micartey:jation:2.4.1\"\n```\n\n### Event Observers\n\nIt is recommended to use the default observer for central parts.\n\n```java\nJationObserver observer = JationObserver.DEFAULT_OBSERVER;\n```\n\nAnd use specific observers for any sub-queues that your project might need.\n\n```java\nJationObserver observer = new JationObserver(); // Alternatively you can pass a custom executor for async events\n```\n\n### Subscribe classes\n\nTo subscribe classes you need to call the `subscribe` method and pass the object instances to the varargs parameter.\n\n```java\nobserver.subscribe(\n   new TestClass(),\n   new OtherTestClass()\n);\n```\n\n### Reflection pattern\n\nTo *observe* methods you need to annotate them with `@Observe`. \u003cbr\u003e\nThe `@Async` annotation is optional and can invoke the method in their own virtual threads.\n\n```java\n@Async\n@Observe\npublic void onEvent(MyTestEvent event, @Null String additive) {\n\n}\n```\n\nEvents can be published with additional parameters. \nIn case your method uses them and there is a possibility, that the parameter is not always defined, you need to annotate the parameter with `@Null`.\n\n### Consumer Pattern\n\nReflection is slow. Some benchmarks indicate it is more than twice as slow as normal method invocations.\nThis is likely the result of the runtime being unable to perform any optimizations.\n\nTherefore, it is recommended to use the consumer pattern for performance critical projects.\n\n```java\nobserver.on(TestEvent.class, (event) -\u003e {\n    // Access the event\n});\n```\n\nThe consumer pattern has a major disadvantage apart from scalability: Additional parameters can't be passed on.\n\n\n### Create Events\n\nTo create an event you need to implement the `JationEvent` interface. The interface has a generic type parameter which is the event itself.\n\n```java\npublic class TestEvent implements JationEvent\u003cTestEvent\u003e {\n\n}\n```\n\n### Publish Events\n\nTo publish an event you need to call the `publish` method and pass the event instance to the first parameter and the additional parameters to the varargs parameter.\n\n```java\n// Publish the event to all subscribed classes\nnew TestEvent().publish(observer, \"additional information\", 5);\n\n\n// Publish the event to all subscribed classes asynchronously\nnew TestEvent().publishAsync(observer);\n```\n\n### Distributed Events\n\n\u003e [!NOTE]  \n\u003e Both events and additional data that might be shared with that event, must implement the Java `Serializable` interface\n\nEvents can be distributed and executed on another JVM.\nIt also supports additional arguments.\nFor the feature to be enabled, you need to add a network adapter.\n\n```java\nobserver.addAdapter(\n        new UdpNetworkAdapter(LISTEN_PORT, TARGET_PORTS) // ports can also be the same\n                .useLoopbackInterface()                 // To send events to the same machine\n                .useBroadcastInterface()                // To send events through the same subnet\n);\n```\n\nFor distributed events, you need to add the `Distribution` annotation.\nYou can choose between `AT_LEAST_ONCE` or `EXACTLY_ONCE`.\nThe difference between these guarantees is the amount of machines/instances that possibly receive the events.\nPlease check the [Protocol](./PROTOCOL.md) for further details.\n\n```java\n@AllArgsConstructor\n@Distribution(Distribution.Guarantee.AT_LEAST_ONCE)\npublic class TestEvent implements JationEvent\u003cTestEvent\u003e, Serializable {\n    \n    public String someData;\n    \n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicartey%2Fjation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmicartey%2Fjation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicartey%2Fjation/lists"}