Part 2: Fish Taco, Taqueria and Dapr

Tariku Tessema
2 min readOct 17, 2022

If you are wondering how fish tacos, taqueria and Dapr are related check out the part 1 of the article.

In this article, I will cover how I converted the Durable function application to Dapr apps. The first step to get started is to go through the setup steps.

Containerized applications for Dapr

The setup:

The following tools are required to get started with Dapr

1- Docker Desktop
2- Dapr cli
3- .NET 6.0 from the installer or Visual Studio 2022

More information on the setup on GitHub

Creating projects

The next step is to create new projects with the containers I have identified using Visual Studio 2022 together with the docker file for each project.

Updating solution for Dapr

1- Add components and configuration folders

2- Update the docker-compose file to include sidecars and shared configuration items

3- Start migrating business logic from durable function to respective projects

Implementation alternatives

Once the first few methods were converted, I was able to see that the way of interacting with data from the shared state is repetitive and can be generalized into a helper generics abstraction. I created the following lightweight generic state manager to get and set values from objects.

At this point, I could use dependency injection to inject the generic state manager and tie it to any given object as follows.

Even though injecting the generic state manager can provide the same level of data to various projects, it defeats the purpose of implementing Dapr as it will not be using gRPC. A better alternative is to use the generics binding in the service where it interacts with local business logic and when crossing service boundaries call Dapr’s `InvokeMethodAsync` method to make an HTTP call that will be routed through Dapr’s service discovery and use gRPC to make requests as follows.

Next steps

This is just the tip of the iceberg there are more functionalities to explore when new requirements arise with the extensible Dapr-based solution. The current state of the migrated code uses a local docker setup and works for development and testing; however, the solution needs to be configured to run Kubernetes and hosted on the cloud to be a true replacement for the durable function MVP application. Since the durable function works well for the current application it is very unlikely that I will pursue hosting options using Kubernetes in the cloud. I really enjoyed using Dapr and working through some implementation strategies. I look forward to working with the platform in the future.

You can get the complete code from this GitHub repo.

--

--

Tariku Tessema

Tariku is a tech enthusiast who works as a Software Engineer in Boston, MA.