{"id":31564288,"url":"https://github.com/na-launch/developer-experience-workshop-module4-java","last_synced_at":"2026-04-17T09:32:27.047Z","repository":{"id":316476278,"uuid":"1059713687","full_name":"na-launch/developer-experience-workshop-module4-java","owner":"na-launch","description":"Developer Experience Workshop - Module 4 - Java","archived":false,"fork":false,"pushed_at":"2025-09-25T13:47:53.000Z","size":82,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-05T05:38:29.947Z","etag":null,"topics":["openshift","quarkus","serverless","workshop"],"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/na-launch.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":"2025-09-18T20:45:45.000Z","updated_at":"2025-09-25T13:49:47.000Z","dependencies_parsed_at":"2025-10-05T05:38:32.045Z","dependency_job_id":"a2e1bb19-467c-4dff-af91-05442c673dfe","html_url":"https://github.com/na-launch/developer-experience-workshop-module4-java","commit_stats":null,"previous_names":["na-launch/developer-experience-workshop-module4","na-launch/developer-experience-workshop-module4-java"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/na-launch/developer-experience-workshop-module4-java","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/na-launch%2Fdeveloper-experience-workshop-module4-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/na-launch%2Fdeveloper-experience-workshop-module4-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/na-launch%2Fdeveloper-experience-workshop-module4-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/na-launch%2Fdeveloper-experience-workshop-module4-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/na-launch","download_url":"https://codeload.github.com/na-launch/developer-experience-workshop-module4-java/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/na-launch%2Fdeveloper-experience-workshop-module4-java/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31923147,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-17T09:10:15.403Z","status":"ssl_error","status_checked_at":"2026-04-17T09:10:14.455Z","response_time":62,"last_error":"SSL_read: 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":["openshift","quarkus","serverless","workshop"],"created_at":"2025-10-05T05:30:11.377Z","updated_at":"2026-04-17T09:32:27.042Z","avatar_url":"https://github.com/na-launch.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🚀 Module 4: Creating and Deploying Your First Serverless Function\n\nTechnology Stack: \n\n- Quarkus\n- K-Native Eventing\n- Red Hat Serverless\n- Quarkus FUNQY\n- Kafka\n\n---\n\n## 🎯 **Scenario**\n\nCompany A is sending a payment transaction (credit card) to ACME. ACME has 4 business steps that need to happen for the transaction to be a success.\n\n1. Customer Profile Service System  |   To check if the customer is a valid customer\n2. Fraud Detection System           |   We need to verify the transaction is not fraudulent\n3. Payment Processing System        |   If the transaction is legitiate, we want to sent it to payments\n4. If the payment is successful \n      Ledger Service                |   We want to capture it as successful\n      Notification Service          |   And notify the customer.\n\nOur current system has a workflow engine, it is stateful. We want to move it to a process that can be distributed, stateless and fully event driven. \n\n---\n\n## 🧩 **Challenge**\n\n- Write your own FUNQY event\n- Annotate it in the correct part of your workflow\n- Wire it up to a K-Native event\n- Verify the result in Kafka\n\n---\n\n## 🔄 Transaction Flow Breakdown\n\n### **1. 🔹 Validate Customer** (validateTransaction)\n- Triggered by an external Knative CloudEvent (`defaultChain`), e.g., from a curl call.\n- Mocks a call to a Customer Profile Service (verifies customer account is active).\n- Marks transaction as **VALIDATED**.\n- Returns a CloudEvent of type `fraudCheck`.\n\n###### ✨ Example: Creating a CloudEvent | Default Chain\n\n```bash\nNS=$(oc project -q)\n\noc exec -it curler -n \"$NS\" -- curl -v \\\n  \"http://broker-ingress.knative-eventing.svc.cluster.local/${NS}/default\" \\\n  -H \"Ce-Id: txn-001\" \\\n  -H \"Ce-Specversion: 1.0\" \\\n  -H \"Ce-Type: defaultChain\" \\\n  -H \"Ce-Source: bash\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"transactionId\":\"txn-1001\",\"customerId\":\"42\",\"amount\":12500,\"currency\":\"JPY\"}'\n```\n\n---\n\n### **2. 🔸 Fraud Check (fraudCheck)**\n- Triggered by the `fraudCheck` function (annotation-based mapping).\n- Mocks a Fraud Detection System (rules + ML).\n- Business rule:\n  - If amount \u003e 10,000 → **FLAGGED** for manual review.\n  - Otherwise → **CLEARED**.\n  - Emits a CloudEvent of type `annotated` to trigger the processPayment step.\n\n###### ✨ Example: Creating a CloudEvent | Fraud Check\n\n```bash\nNS=$(oc project -q)\n\noc exec -it curler -n \"$NS\" -- curl -v \\\n  \"http://broker-ingress.knative-eventing.svc.cluster.local/${NS}/default\" \\\n  -H \"Ce-Id: txn-002\" \\\n  -H \"Ce-Specversion: 1.0\" \\\n  -H \"Ce-Type: fraudCheck\" \\\n  -H \"Ce-Source: bash\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"transactionId\":\"txn-1002\",\"customerId\":\"57\",\"amount\":5000,\"currency\":\"USD\"}'\n```\n\n---\n\n### **3. 🔹 Payment Processing (processPayment)**\n- Triggered by the `processPayment` function (annotation-based mapping).\n- Mocks:\n  - Core Banking API (debit customer account).\n  - Payment Gateway (Visa/MasterCard).\n- Marks transaction as **PROCESSED**.\n- Returns a CloudEvent of type `lastChainLink`.\n\n###### ✨ Example: Creating a CloudEvent | Payment Processing\n\n```bash\nNS=$(oc project -q)\n\noc exec -it curler -n \"$NS\" -- curl -v \\\n  \"http://broker-ingress.knative-eventing.svc.cluster.local/${NS}/default\" \\\n  -H \"Ce-Id: txn-003\" \\\n  -H \"Ce-Specversion: 1.0\" \\\n  -H \"Ce-Type: annotated\" \\\n  -H \"Ce-Source: bash\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"transactionId\":\"txn-1003\",\"customerId\":\"99\",\"amount\":2000,\"currency\":\"EUR\"}'\n```\n\n---\n\n### **4. 🔸 Settlement \u0026 Kafka Publish** (settleTransaction)\n- Triggered by `settleTransaction` function.\n- Mocks:\n  - Ledger Service (recording transaction).\n  - Notification Service (alerting customer).\n- Publishes the finalized transaction to Kafka using\n\n```bash\nNS=$(oc project -q)\n\noc exec -it curler -n \"$NS\" -- curl -v \\\n  \"http://broker-ingress.knative-eventing.svc.cluster.local/${NS}/default\" \\\n  -H \"Ce-Id: txn-004\" \\\n  -H \"Ce-Specversion: 1.0\" \\\n  -H \"Ce-Type: lastChainLink\" \\\n  -H \"Ce-Source: bash\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"transactionId\":\"txn-1004\",\"customerId\":\"88\",\"amount\":7500,\"currency\":\"GBP\",\"status\":\"PROCESSED\",\"message\":\"Payment successfully processed\"}'\n```\n\n---\n\n## ✅ Key Takeaways\n\n- You have created a FUNQY Event in Quarkus\n- You created a K-Native Event that can respond to triggers and trigger itself\n- See how quickly Quarkus can build Serverless Events\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fna-launch%2Fdeveloper-experience-workshop-module4-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fna-launch%2Fdeveloper-experience-workshop-module4-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fna-launch%2Fdeveloper-experience-workshop-module4-java/lists"}