{"id":19531394,"url":"https://github.com/schrodingdong/data-driven-microservices","last_synced_at":"2025-02-26T03:19:39.115Z","repository":{"id":171825522,"uuid":"648371365","full_name":"Schrodingdong/Data-Driven-Microservices","owner":"Schrodingdong","description":"Using a data-driven approach within a microservice architecture","archived":false,"fork":false,"pushed_at":"2023-06-08T03:24:24.000Z","size":244,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-01-05T21:28:18.935Z","etag":null,"topics":["apache-jena","data-driven","java","microservice","ontology","rabbitmq","rdf"],"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/Schrodingdong.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,"governance":null}},"created_at":"2023-06-01T20:20:39.000Z","updated_at":"2023-06-04T15:33:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"1ca14c5b-4dd7-4210-b699-0d466cf4647e","html_url":"https://github.com/Schrodingdong/Data-Driven-Microservices","commit_stats":{"total_commits":20,"total_committers":2,"mean_commits":10.0,"dds":0.09999999999999998,"last_synced_commit":"57025d6145974377cb81ce14c0b59d233d40aae4"},"previous_names":["schrodingdong/data-driven-microservices"],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Schrodingdong%2FData-Driven-Microservices","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Schrodingdong%2FData-Driven-Microservices/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Schrodingdong%2FData-Driven-Microservices/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Schrodingdong%2FData-Driven-Microservices/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Schrodingdong","download_url":"https://codeload.github.com/Schrodingdong/Data-Driven-Microservices/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240783730,"owners_count":19856886,"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":["apache-jena","data-driven","java","microservice","ontology","rabbitmq","rdf"],"created_at":"2024-11-11T01:42:43.321Z","updated_at":"2025-02-26T03:19:39.044Z","avatar_url":"https://github.com/Schrodingdong.png","language":"Java","readme":"# Ontological Discovery Service\n## Possible Urls\n- localhost:8080\n- localhost:8080/?products (get all of them)\n- localhost:8080/?customers\n- localhost:8080/?orders\n- localhost:8080/?productId=69 (get the product with the given id)\n- localhost:8080/?customerId=45\n- localhost:8080/?orderId=150\n\n## Possible Methods\n- GET\n- POST\n- PUT\n- DELETE\n\n## Possbile Bodies\n### Product\nFor saving a product : \n```json\n{\n    \"productName\": \"Product Name\",\n    \"productDescription\": \"Product Description\",\n    \"productPrice\": 69.69\n}\n```\nFor updating a product (example) :\n```json\n{\n  \"productId\": 1,\n  \"productName\": \"New product Name\"\n}\n```\n### Customer\nFor saving a customer :\n```json\n{\n    \"customerFirstname\": \"Customer First Name\",\n    \"customerLastname\": \"Customer Last Name\",\n    \"customerEmail\": \"Customer Email\"\n}\n```\nFor updating a customer (example) :\n```json\n{\n  \"customerId\": 1,\n  \"customerFirstname\": \"New Customer First Name\"\n}\n```\n### Order\nFor saving an order :\n```json\n{\n    \"customerId\": 1,\n    \"orderProducts\": [\n        {\n            \"productId\": 1,\n            \"quantity\": 53\n        },\n        {\n            \"productId\": 2,\n            \"quantity\": 12\n        }\n    ]\n}\n```\nFor updating an order :\n```json\n{\n    \"orderId\": 1,\n    \"orderProducts\": [\n        {\n            \"productId\": 1,\n            \"quantity\": 53\n        },\n        {\n            \"productId\": 2,\n            \"quantity\": 12\n        }\n    ]\n}\n```\n\n## Example combinations\nNOTE that the following examples are not exhaustive, they are just here to give you an idea of how the service works.\n\nThe URLs shall be listed in the application.yaml file, following this structure for each service ontologically discovered\n````\nserviceName :\n    Method :\n        GET:\n        - uri1 \n        ...\n        POST:\n        - uri1\n        ...\n        PUT:\n        - uri1\n        ...\n        DELETE:\n        - uri1\n        ...\n````\n### Example 1\nConsider the following request :\n````http request\nPOST http://localhost:8080/\nContent-Type: application/json\n\n{\n    \"productName\": \"Product Name\",\n    \"productDescription\": \"Product Description\",\n    \"productPrice\": 69.69\n}\n````\nThis SHOULD create a new product with the given information and will return the following response :\n````http request\nHTTP/1.1 200\nContent-Type: application/json\n\n{\n    \"productId\": 1,\n    \"productName\": \"Product Name\",\n    \"productDescription\": \"Product Description\",\n    \"productPrice\": 69.69\n}\n````\nWorkflow :\n- The request is received by the server\n- Get the path variable (here we have none) and the body (product)\n- **Ontological analysis of the body**\n  - compare with each ontology\n  - find the best match\n  - return the service name (in this case, it's the product service)\n- **Url generation**\n  - Analysis of the :\n    - Method (POST)\n    - Path variable (none)\n    - service name (product service)\n  - Generate the uri (/product/save)\n\n### Example 2\nConsider the following request :\n````http request\nPUT http://localhost:8080/\nContent-Type: application/json\n\n{\n    \"productId\": 1,\n    \"productName\": \"New product Name\"\n}\n````\nThis SHOULD update the product with the given information and will return the following response :\n````http request\nHTTP/1.1 200\nContent-Type: application/json\n\n{\n    \"productId\": 1,\n    \"productName\": \"New product Name\",\n    \"productDescription\": \"Product Description\",\n    \"productPrice\": 69.69\n}\n````\nWorkflow :\n- The request is received by the server\n- Get the path variable (here we have none) and the body (product)\n- **Ontological analysis of the body**\n    - compare with each ontology\n    - find the best match\n    - return the service name (in this case, it's the product service)\n- **Url generation**\n    - Analysis of the :\n        - Method (PUT)\n        - Path variable (none)\n        - service name (product service)\n    - generate the uri (/product/update)\n\n### Example 3\nConsider the following request :\n````http request\nGET http://localhost:8080/?productId=1\n````\nThis SHOULD return the product with the given id and will return the following response :\n````http request\nHTTP/1.1 200\nContent-Type: application/json\n\n{\n    \"productId\": 1,\n    \"productName\": \"product Name\",\n    \"productDescription\": \"Product Description\",\n    \"productPrice\": 69.69\n}\n````\nWorkflow :\n- The request is received by the server\n- Get the path variable (productId) and the body (none)\n- **Ontological analysis of the path variable**\n    - compare with each ontology\n    - find the best match\n    - return the service name (in this case, it's the product service)\n- **Url generation**\n    - Analysis of the :\n        - Method (GET)\n        - Path variable (productId)\n        - service name (product service)\n    - Replace the path variables with their correct value \n    - generate the uri (/product/get/1)\n\n## Messaging Service\nWe will be using RabbitMQ as our messaging service.\nto run it, you can use the following command :\n```shell script\ndocker run -it --rm --name rabbitmq -p 5672:5672 -p 15672:15672 rabbitmq:3.11-management\n```\nThe management interface is available at http://localhost:15672/ with the default credentials (guest/guest).\nThe connection from the services is automatic (as long as the Rabbit MQ port is the same as the one in the cmd)\n### Structure of the messaging system\nEach Business Service has its own queue, that are linked to one exchange. The consumer (OntoogyDiscovery) listens to all the queues and update the .rdf files it has.\n- Exchange : rdf.exchange\n- Queues :\n    - product.rdf.queue\n    - customer.rdf.queue\n    - order.rdf.queue\n- Routing keys :\n    - product.rdf.queue -\u003e product.rdf.key\n    - customer.rdf.queue -\u003e customer.rdf.key\n    - order.rdf.queue -\u003e order.rdf.key","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fschrodingdong%2Fdata-driven-microservices","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fschrodingdong%2Fdata-driven-microservices","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fschrodingdong%2Fdata-driven-microservices/lists"}