{"id":21430159,"url":"https://github.com/cuba-platform/global-events-addon","last_synced_at":"2025-07-14T11:31:15.064Z","repository":{"id":44660760,"uuid":"133009633","full_name":"cuba-platform/global-events-addon","owner":"cuba-platform","description":"Global Events add-on enables receiving Spring's application events on any application block of the distributed system","archived":false,"fork":false,"pushed_at":"2024-12-25T14:04:46.000Z","size":228,"stargazers_count":9,"open_issues_count":3,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-08T07:21:13.470Z","etag":null,"topics":["cuba-component","cuba-platform","eventbus","websocket"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cuba-platform.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-05-11T08:06:49.000Z","updated_at":"2021-11-27T08:43:54.000Z","dependencies_parsed_at":"2022-09-25T00:01:55.826Z","dependency_job_id":null,"html_url":"https://github.com/cuba-platform/global-events-addon","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/cuba-platform/global-events-addon","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cuba-platform%2Fglobal-events-addon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cuba-platform%2Fglobal-events-addon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cuba-platform%2Fglobal-events-addon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cuba-platform%2Fglobal-events-addon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cuba-platform","download_url":"https://codeload.github.com/cuba-platform/global-events-addon/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cuba-platform%2Fglobal-events-addon/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265285269,"owners_count":23740492,"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":["cuba-component","cuba-platform","eventbus","websocket"],"created_at":"2024-11-22T22:21:06.060Z","updated_at":"2025-07-14T11:31:14.750Z","avatar_url":"https://github.com/cuba-platform.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Global Events Add-on\n\n## Overview\n\nThe standard CUBA [Events](https://doc.cuba-platform.com/manual-latest/events.html) interface allows you to publish events that can be received by subscribers within the same application block. So there are no built-in facilities for notifying clients from middleware or propagating events in the cluster.\n\nThe Global Events add-on enables receiving Spring's application events on any application block of the distributed system. In the simplest configuration with `core` and `web` blocks running in a single JVM, it allows you to send events from `core` to `web` to notify UI screens or managed beans. In a cluster environment, an event published inside a block, will be received on all other connected parts of the system: on all middleware blocks and on the clients: `web` and `portal`.\n\nIn case of the client is deployed in the same JVM as middleware and `cuba.useLocalServiceInvocation` application property is set to `true`, it registers a callback in the `LocalRegistry` class located in the `shared-lib` module which is accessible to both middleware and the client.\n\nIn a distributed environment, clients open WebSocket connections to the middleware blocks, and middleware exchange events in a usual way using the cluster communication mechanism.\n\n![Global Events](etc/global-events.png)\n\n## Installation\n\nThe add-on can be added to your project in one of the ways described below. Installation from the Marketplace is the simplest way. The last version of the add-on compatible with the used version of the platform will be installed.\nAlso, you can install the add-on by coordinates choosing the required version of the add-on from the table.\n\nIn case you want to install the add-on by manual editing or by building from sources see the complete add-ons installation guide in [CUBA Platform documentation](https://doc.cuba-platform.com/manual-latest/manual.html#app_components_usage).\n\n### From the Marketplace\n\n1. Open your application in CUBA Studio. Check the latest version of CUBA Studio on the [CUBA Platform site](https://www.cuba-platform.com/download/previous-studio/).\n2. Go to *CUBA -\u003e Marketplace* in the main menu.\n\n ![marketplace](img/marketplace.png)\n\n3. Find the *Global Events* add-on there.\n\n ![addons](img/addons.png)\n\n4. Click *Install* and apply the changes.\nThe add-on corresponding to the used platform version will be installed.\n\n### By Coordinates\n\n1. Open your application in CUBA Studio. Check the latest version of CUBA Studio on the [CUBA Platform site](https://www.cuba-platform.com/download/previous-studio/).\n2. Go to *CUBA -\u003e Marketplace* in the main menu.\n3. Click the icon in the upper-right corner.\n\n ![by-coordinates](img/by-coordinates.png)\n\n4. Paste the add-on coordinates in the corresponding field as follows:\n\n`com.haulmont.addon.globalevents:cubaglevt-global:\u003cadd-on version\u003e`\n\n where `\u003cadd-on version\u003e` is compatible with the used version of the CUBA platform.\n\n | Platform Version | Add-on Version |\n|------------------|----------------|\n| 7.2.x            | 0.6.1         |\n| 7.1.x            | 0.5.1          |\n| 7.0.x            | 0.4.2          |\n| 6.10.x           | 0.3.1          |\n| 6.9.x            | 0.2.1          |\n| 6.8.x            | 0.1.2          |\n\n5. Click *Install* and apply the changes. The add-on will be installed to your project.\n\n## Usage\n\nYour global event classes must be inherited from `com.haulmont.addon.globalevents.GlobalApplicationEvent`, for example:\n\n```java\npackage com.company.sample;\n\nimport com.haulmont.addon.globalevents.GlobalApplicationEvent;\n\npublic class MyGlobalEvent extends GlobalApplicationEvent {\n\n    private String payload;\n\n    public MyGlobalEvent(Object source, String payload) {\n        super(source);\n        this.payload = payload;\n    }\n\n    public String getPayload() {\n        return payload;\n    }\n}\n```\n\nMake sure all fields of the event class are serializable! Also, do not ever use the `source` field to store and transfer any data, as it is transient and will not be preserved when the event is sent to another application block.\n\nIf you want to send event to Generic UI screens of connected `web` blocks, add the `GlobalUiEvent` marker interface to the event class:\n\n```java\npackage com.company.sample;\n\nimport com.haulmont.addon.globalevents.GlobalApplicationEvent;\nimport com.haulmont.addon.globalevents.GlobalUiEvent;\n\npublic class MyUiNotificationEvent extends GlobalApplicationEvent implements GlobalUiEvent {\n\n    private String message;\n\n    public MyUiNotificationEvent(Object source, String message) {\n        super(source);\n        this.message = message;\n    }\n\n    public String getMessage() {\n        return message;\n    }\n}\n```\n\nSend global events using the standard `Events.publish()` method, and they will be received by subscribers running on all blocks of your distributed application.\n\nIn the distributed deployment, it is recommended to suppress DEBUG log messages from `WebSocketDispatcherServlet` by adding the following line to `logback.xml`:\n\n    \u003clogger name=\"com.haulmont.addon.globalevents.core.WebSocketDispatcherServlet\" level=\"INFO\"/\u003e\n\n## Features\n\n1. Events are delivered to other blocks asynchronously, including the local deployment.\n\n2. Ordering is accurate only within a block.\n\n3. Delivery in a distributed deployment is guaranteed \"at most once\", i.e. there is no retransmit, etc.\n\n4. In the distributed deployment, web client opens WebSocket connection to middleware on the first browser connection. So if some `web` bean is subscribed to a global event, it will start to receive notifications only after at least one user connects to it.  \n\n## Testing\n\nThe [global-events-demo](https://github.com/cuba-platform/global-events-demo) project contains usage examples and automatic system tests.\n\n## Known Issues\n\n* If messages are not received and you see in the logs the message like this: `The decoded text message was too big for the output buffer and the endpoint does not support partial messages`, see [this topic](https://www.cuba-platform.com/discuss/t/unable-to-receive-globalevent-separate-tomcat-for-app-war-app-core-war/7149) for the solution.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcuba-platform%2Fglobal-events-addon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcuba-platform%2Fglobal-events-addon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcuba-platform%2Fglobal-events-addon/lists"}