This sample shows how you can deploy server-client services utilizing UDP for communication. The setup underscores the utilization of lightweight, connectionless data exchange between these components within a networked context.
- Create a new Service component with following parameters
- Build Pack:
Dockerfile
- Dockerfile path:
docker-udp-service/Dockerfile.server
- Build Context:
docker-udp-service
- Build Pack:
- Deploy the component
- Navigate to the Overview page of the component and copy the endpoint address with the Project visibility.
-
Create a new Manual Task component with following parameters
- Build Pack:
Dockerfile
- Dockerfile path:
docker-udp-service/Dockerfile.client
- Build Context:
docker-udp-service
- Build Pack:
-
Navigate to the Configs & Secrets page of the component and add the following environment variables as the
ConfigMap
with a custom config name.SERVER_ADDRESS
:<server-address>
Use the address copied from the server component (Step 3) as the value for
SERVER_ADDRESS
environment variable. Example: udp-server-3192360657:5000 -
Deploy the component and run it by clicking the Run Once button.
Refer https://wso2.com/choreo/docs/devops-and-ci-cd/manage-configurations-and-secrets/ for more information on how to add configs and secrets to a component.
-
Start the server
go run ./server
-
Start the client
SERVER_ADDRESS=localhost:5050 go run ./client
Refer https://wso2.com/choreo/docs/develop-components/develop-services/develop-a-service/ for more information on how to develop and deploy a service component.