{"id":20009551,"url":"https://github.com/ruromero/cloudevents-player","last_synced_at":"2025-09-10T02:45:44.252Z","repository":{"id":37751845,"uuid":"216849797","full_name":"ruromero/cloudevents-player","owner":"ruromero","description":"Cloudevents Player tool","archived":false,"fork":false,"pushed_at":"2025-06-25T10:11:57.000Z","size":4210,"stargazers_count":42,"open_issues_count":46,"forks_count":15,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-25T11:24:22.408Z","etag":null,"topics":["cloudevents","java","knative","kubernetes"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ruromero.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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,"zenodo":null},"funding":{"ko_fi":"ruromero"}},"created_at":"2019-10-22T15:39:02.000Z","updated_at":"2025-05-20T14:01:51.000Z","dependencies_parsed_at":"2024-02-12T04:27:07.924Z","dependency_job_id":"f36d8383-332e-4684-abf8-2efcfaf3729b","html_url":"https://github.com/ruromero/cloudevents-player","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/ruromero/cloudevents-player","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruromero%2Fcloudevents-player","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruromero%2Fcloudevents-player/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruromero%2Fcloudevents-player/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruromero%2Fcloudevents-player/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ruromero","download_url":"https://codeload.github.com/ruromero/cloudevents-player/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruromero%2Fcloudevents-player/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271378680,"owners_count":24749192,"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","status":"online","status_checked_at":"2025-08-20T02:00:09.606Z","response_time":69,"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":["cloudevents","java","knative","kubernetes"],"created_at":"2024-11-13T07:16:24.383Z","updated_at":"2025-08-20T20:32:48.407Z","avatar_url":"https://github.com/ruromero.png","language":"Java","funding_links":["https://ko-fi.com/ruromero"],"categories":[],"sub_categories":[],"readme":"# CloudEvents Player\n\n![Build](https://img.shields.io/github/actions/workflow/status/ruromero/cloudevents-player/build.yaml)\n[![amd64](https://img.shields.io/badge/container-amd64-blue)](https://quay.io/repository/ruben/cloudevents-player?tab=tags)\n[![arm64](https://img.shields.io/badge/container-arm64-blue)](https://quay.io/repository/ruben/cloudevents-player?tab=tags)\n\n- [Running the container image](#running-the-container-image)\n- [Running the binary](#running-the-binary)\n- [Running on Kubernetes](#running-on-kubernetes)\n  * [Requirements](#requirements)\n  * [Create the broker](#create-the-broker)\n  * [Create the Knative Service](#create-the-knative-service)\n  * [Bind the service with the broker](#bind-the-service-with-the-broker)\n  * [Create the Knative trigger](#create-the-knative-trigger)\n  * [Manual deployment](#manual-deployment)\n- [Build](#build)\n  * [JVM Build](#jvm-build)\n  * [Quarkus dev mode](#quarkus-dev-mode)\n  * [Native build](#native-build)\n  * [Skip frontend build](#skip-frontend-build)\n  * [Build the container image](#build-the-container-image)\n- [Configuration](#configuration)\n  * [Player Mode](#player-mode)\n  * [Broker URI](#broker-uri)\n  * [Broker Name and Namespace](#broker-name-and-namespace)\n  * [CORS](#cors)\n\nIt is an application that can send and receive [CloudEvents](https://cloudevents.io/). Its purpose is to be deployed on a\n[Knative Eventing](https://knative.dev/docs/eventing/) environment so that users can monitor received events in the Activity section and\nalso send events of the desired type to see if it is being forwarded back to the application through\nthe broker.\n\nIt supports both [Structured](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/bindings/http-protocol-binding.md#32-structured-content-mode)\nand [Binary](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/bindings/http-protocol-binding.md#31-binary-content-mode) content mode.\n\nThe application has a web interface in which you can define the events you want to send to the broker:\n\n![create event](docs/images/create_event.png)\n\nOn the right-hand side all the emitted and received events will be listed. In the image below there are two received \nand one emitted event.\n\n![activity](docs/images/activity.png)\n\nAnd you will also be able to display the payload of the event.\n\n![event](docs/images/event.png)\n\n## Running the container image\n\nYou can expect to have built container images in `arm64` and `amd64` architectures in `quay.io/ruben/cloudevents-player:v1.3`\n\n_Podman_\n\n```bash\npodman run -p 8080:8080 -e PLAYER_MODE=LOCAL --rm quay.io/ruben/cloudevents-player:v1.3\n```\n\n_Docker_\n```bash\ndocker run -p 8080:8080 -e PLAYER_MODE=LOCAL --rm quay.io/ruben/cloudevents-player:v1.3\n```\n\n## Running the binary\n\nFirst you will have to build the application. See the [Build](#build) section for more details. Then you can\nstart the application locally with the following command.\n\n```bash\nPLAYER_MODE=LOCAL ./target/cloudevents-player-1.3-SNAPSHOT-runner\n```\n\n## Running on Kubernetes\n\n### Requirements\n\n- Knative serving\n- Knative eventing\n- `kubectl`\n- `kn`\n\n### Create the broker\n\nLet's use the `kn` CLI to create an InMemoryChannel-backed Broker.\n\n```bash\n$ kn broker create example-broker\nBroker 'example-broker' successfully created in namespace 'eventing-demo'.\n```\n\nLet's confirm the Broker is created and ready.\n\n```bash\n$ kn broker list                 \nNAME             URL                                                                                AGE   CONDITIONS   READY   REASON\nexample-broker   http://broker-ingress.knative-eventing.svc.cluster.local/eventing-demo/example-broker   20s   6 OK / 6     True   \n```\n\n### Create the Knative Service\n\nIf you have the `kn` cli available you can just create the broker with the CLI\n\n```bash\n$ kn service create cloudevents-player \\\n--image quay.io/ruben/cloudevents-player:latest\n\nCreating service 'cloudevents-player' in namespace 'eventing-demo':\n\n  0.224s Configuration \"cloudevents-player\" is waiting for a Revision to become ready.\n  6.043s ...\n  6.044s Ingress has not yet been reconciled.\n  6.045s Waiting for load balancer to be ready\n  6.248s Ready to serve.\n\nService 'cloudevents-player' created to latest revision 'cloudevents-player-00001' is available at URL:\nhttps://cloudevents-player-eventing-demo.apps.example.com\n```\n\n### Bind the service with the broker\n\nIt is possible to connect the Cloudevents Player with the broker in different ways.\n\n1. Create a SinkBinding. This is the easiest one and works for any type of broker. It injects the `K_SINK` environment variable\ninto the Knative Service. The service is rolled out and starts using it for sending events.\n\n```bash\nkn source binding create ce-player-binding --subject \"Service:serving.knative.dev/v1:cloudevents-player\" --sink broker:example-broker\n```\n\n2. Define the `BROKER_NAME` and `BROKER_NAMESPACE` environment variables to the Deployment, through the Service spec. The `BROKER_URI`\nis calculated from these values as `http://broker-ingress.knative-eventing.svc.cluster.local/{broker_namespace}/{broker_name}`. This\noption is only compatible with the In-Memory Broker.\n\n```bash\n## The BROKER_NAMESPACE env var is only required if the broker is in a different namespace\n\nkn service update --env BROKER_NAME=example-broker --env BROKER_NAMESPACE=other-ns cloudevents-player\n```\n\n3. Define the `BROKER_URI`. As a last resort you can manually define the `BROKER_URI` of the Broker. This will take precedence over any\nother variable.\n\n```bash\nkn service update --env BROKER_URI=http://other-ingress.other-ns.svc.cluster.local/foo/bar cloudevents-player\n```\n\nTry out the Service URL, you will be able to send events but your events will not be consumed by any\nservice.\n\n```bash\n$ CLOUDEVENTS_URL=$(kn service describe cloudevents-player -o url)\n$ curl -vk $CLOUDEVENTS_URL \\\n        -H \"Content-Type: application/json\" \\\n        -H \"Ce-Id: 123456789\" \\\n        -H \"Ce-Specversion: 1.0\" \\\n        -H \"Ce-Type: some-type\" \\\n        -H \"Ce-Source: command-line\" \\\n        -d '{\"msg\":\"Hello CloudEvents!\"}'\n```\n\n### Create the Knative trigger\n\nIn order for the Cloudevents Player to subscribe to events from the broker you need to create a `trigger`\n\n```bash\nkn trigger create cloudevents-trigger --sink cloudevents-player  --broker example-broker                                             \n```\n\n### Manual deployment\n\nAs an alternative, you can deploy the application manually by using the [knative.yaml](deploy/knative.yaml) file\n\n```shell script\n$ kubectl apply -n myproject -f deploy/knative.yaml\nservice.serving.knative.dev/cloudevents-player created\ntrigger.eventing.knative.dev/cloudevents-player created\nsinkbinding.sources.knative.dev/ce-player-binding created\nbroker.eventing.knative.dev/example-broker created\n```\n\nThe following resources are created:\n\n* InMemory Broker: The Broker that will receive and forward the events\n* Knative Service: Pointing to the image and mounting the volume from the configMap\n* SinkBinding: Binding the Knative service to the Broker\n* Trigger: To subscribe to any message in the Broker\n\n## Build\n\nIt is a Quarkus application with a React frontend. In order to build the application use any of the\nfollowing alternatives:\n\n### JVM Build\n\nBuild\n\n```shell script\nmvn clean package\n```\n\nRun\n\n```shell script\n$ java -Dplayer.mode=LOCAL -jar target/quarkus-app/quarkus-run.jar\n...\n2022-06-24 18:39:07,794 INFO  [io.und.websockets] (main) UT026003: Adding annotated server endpoint class com.redhat.syseng.tools.cloudevents.resources.MessagesSocket for path /socket\n2022-06-24 18:39:08,130 INFO  [io.qua.sma.ope.run.OpenApiRecorder] (main) Default CORS properties will be used, please use 'quarkus.http.cors' properties instead\n2022-06-24 18:39:08,216 INFO  [io.quarkus] (main) cloudevents-player 1.3-SNAPSHOT on JVM (powered by Quarkus 2.16.1.Final) started in 0.879s. Listening on: http://0.0.0.0:8080\n2022-06-24 18:39:08,217 INFO  [io.quarkus] (main) Profile prod activated. \n2022-06-24 18:39:08,217 INFO  [io.quarkus] (main) Installed features: [cdi, hibernate-validator, kubernetes-client, rest-client, resteasy-reactive, resteasy-reactive-jackson, smallrye-context-propagation, smallrye-openapi, vertx, websockets, websockets-client] \n```\n\n### Quarkus dev mode\n\n```shell script\n$ mvn quarkus:dev -Dplayer.mode=LOCAL\n...\nListening for transport dt_socket at address: 5005\n...\n[INFO] --- quarkus-maven-plugin:1.0.1.Final:dev (default-cli) @ cloudevents-player ---\nListening for transport dt_socket at address: 5005\n2022-06-24 18:51:43,172 INFO  [io.und.websockets] (Quarkus Main Thread) UT026003: Adding annotated server endpoint class com.redhat.syseng.tools.cloudevents.resources.MessagesSocket for path /socket\n\n2022-06-24 18:51:43,229 WARN  [org.jbo.res.res.i18n] (Quarkus Main Thread) RESTEASY002155: Provider class io.cloudevents.http.restful.ws.CloudEventsProvider is already registered.  2nd registration is being ignored.\n2022-06-24 18:51:43,513 INFO  [io.quarkus] (Quarkus Main Thread) cloudevents-player 1.3-SNAPSHOT on JVM (powered by Quarkus 2.16.1.Final) started in 2.543s. Listening on: http://localhost:8080\n2022-06-24 18:51:43,514 INFO  [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated.\n2022-06-24 18:51:43,515 INFO  [io.quarkus] (Quarkus Main Thread) Installed features: [cdi, hibernate-validator, kubernetes-client, rest-client-reactive, rest-client-reactive-jackson, resteasy-reactive, resteasy-reactive-jackson, smallrye-context-propagation, smallrye-openapi, swagger-ui, vertx, websockets, websockets-client]\n```\n\n### Native build\n\nBuild\n\n```shell script\nmvn clean install -Pnative\n```\n\nRun\n\n```shell script\n$ ./target/cloudevents-player-1.3-SNAPSHOT-runner -Dplayer.mode=LOCAL\n...\n2022-06-24 18:48:11,565 INFO  [io.quarkus] (main) cloudevents-player 1.3-SNAPSHOT native (powered by Quarkus 2.16.1.Final) started in 0.022s. Listening on: http://0.0.0.0:8080\n2022-06-24 18:48:11,565 INFO  [io.quarkus] (main) Profile prod activated. \n2022-06-24 18:48:11,565 INFO  [io.quarkus] (main) Installed features: [cdi, hibernate-validator, kubernetes-client, rest-client-reactive, rest-client-reactive-jackson, resteasy-reactive, resteasy-reactive-jackson, smallrye-context-propagation, smallrye-openapi, swagger-ui, vertx, websockets, websockets-client]\n2022-06-24 18:48:17,028 INFO  [com.git.rur.clo.ser.MessageService] (ForkJoinPool.commonPool-worker-3) Player mode LOCAL - broker: http://localhost:8080/\n```\n\n### Skip frontend build\n\nThe `skipFrontend` profile will not run npm commands. Useful when you are just changing Java code.\n\n```{bash}\nmvn clean package -PskipFrontend\n```\n\n### Build the container image\n\n```shell script\nmvn clean package -Dcontainer -Dquarkus.native.container-build=true\n```\n\n## Configuration\n\nThe Cloudevents Player can be configured by:\n\n - System properties. Usually in lower case and separated by dots e.g. `player.mode` \n - Environment variables. In upper case and separated by underscores e.g. `PLAYER_MODE`\n\nThese are the configuration options provided in the Cloudevents Player.\n\n- `PLAYER_MODE`\n- `BROKER_URI`\n- `BROKER_NAME`\n- `BROKER_NAMESPACE`\n\nIn the `KNATIVE` mode it will also look for the `K_SINK` environment variable injected after\ndefining a `SinkBinding`.\n\nFor more configuration options refer to the [Quarkus documentation](https://quarkus.io/guides/all-config)\n\n### Player Mode\n\nCloudevents Player comes with 2 modes defined in the `PLAYER_MODE` environment variable:\n\n- `LOCAL`: Received events are forwarded to the loopback broker. This mode is just for development and testing \n- `KNATIVE` (default): The application will get the current namespace it is running in and will use the `BROKER_NAME`\n environment variable to decide which broker to connect to (`default` is the default broker).\n\n```bash\n# Local Mode\n# system property\n./target/cloudevents-player-1.3-SNAPSHOT-runner -Dplayer.mode=LOCAL\n\n# environment variable\nPLAYER_MODE=LOCAL ./target/cloudevents-player-1.3-SNAPSHOT-runner\n\n# Knative Mode\n# system property\n./target/cloudevents-player-1.3-SNAPSHOT-runner -Dplayer.mode=KNATIVE\n\n# environment variable\nPLAYER_MODE=KNATIVE ./target/cloudevents-player-1.3-SNAPSHOT-runner\n```\n\n### Broker URI\n\nSets the `BROKER_URI` where the messages will be sent to. It will always be `localhost:8080` for `LOCAL` mode.\nOverrides the name and namespace properties.\n\n```bash\n# with a system property\n./target/cloudevents-player-1.3-SNAPSHOT-runner -Dbroker.uri=http://some-broker:1234\n\n# or using an environment variable\nBROKER_URI=http://some-broker:1234 ./target/cloudevents-player-1.3-SNAPSHOT-runner\n```\n\n### Broker Name and Namespace\n\nDefine the broker name and namespace to guess the broker URI. The default broker name is `default` and the default\nnamespace will be the current namespace.\n\n```bash\n# system property\n./target/cloudevents-player-1.3-SNAPSHOT-runner -Dbroker.name=example -Dbroker.namespace=other\n...\n2022-06-24 19:08:53,681 INFO  [com.git.rur.clo.ser.MessageService] (ForkJoinPool.commonPool-worker-3) Player mode KNATIVE - broker: http://broker-ingress.knative-eventing.svc.cluster.local/other/example\n\n# environment variable\nBROKER_NAME=example BROKER_NAMESPACE=other ./target/cloudevents-player-1.3-SNAPSHOT-runner\n...\n2022-06-24 19:08:53,681 INFO  [com.git.rur.clo.ser.MessageService] (ForkJoinPool.commonPool-worker-3) Player mode KNATIVE - broker: http://broker-ingress.knative-eventing.svc.cluster.local/other/example\n```\n\n### CORS\n\nBy default the cloudevents player will allow all origins but it is possible to defined the allowed origins with the following environment variable:\n\n```\n  - name: QUARKUS_HTTP_CORS_ORIGINS\n    value: https://cloudevents-player-myns.apps.example.com\n```\n\nSee the [Quarkus CORS documentation](https://quarkus.io/guides/http-reference#cors-filter) for more configuration parameters.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fruromero%2Fcloudevents-player","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fruromero%2Fcloudevents-player","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fruromero%2Fcloudevents-player/lists"}