Ajsalemo / dapr-pub-sub-examples

Various examples of using Dapr with the pubsub building block across runtimes.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

dapr-pub-sub-examples

Various examples of using Dapr with the pubsub building block across runtimes.

NOTE: These example(s) and the below instructions use Event Hub - however, other pubsub providers can be input as desired.

Running locally

  1. Install some type of Kubernetes cluster. An easy method is to just enable Kubernetes in Docker Desktop
  2. Each language folder has a local-k8s sub folder. This contains a pubsub.yaml, deployment.yaml and service.yaml file.
    • Prior to deployment, update the pubsub.yaml with the required values needed
  3. Build the image with the Dockerfile in the language folder being used. If the image name is not the same name in deployment.yaml, then update deployment.yaml
  4. Deploy the project with kubectl apply -f local-k8s/

Using Container Apps

  1. Create a Container App and Container App environment
  2. Push the image built from the language Dockerfile to an Azure Container Registry
  3. Create a pubsub dapr component, with the following:
  • image
  • Add in the same metaData thats in the local-k8s folders in the examples
  • connectionString: EventHub connection string
  • storageAccountName: Storage account name
  • storageAccountKey: Storage account key
  • storageContainerName: Storage ontainer name
  • consumerID: Name of the consumer ID, if not defined, it uses the appId
  • Add the component to the application by specifying it in scopes
  1. Enable dapr on the Container App
  2. Ensure ingress is set to the appropriate port for the language example being used

About

Various examples of using Dapr with the pubsub building block across runtimes.


Languages

Language:PHP 70.5%Language:Blade 15.4%Language:C# 4.0%Language:Java 2.8%Language:JavaScript 2.4%Language:Dockerfile 2.0%Language:Go 2.0%Language:Python 0.7%Language:Shell 0.1%