Skip to content

Commit

Permalink
Update components readme to use new "integrations" terminology
Browse files Browse the repository at this point in the history
  • Loading branch information
DamianEdwards committed Sep 4, 2024
1 parent 4e4bcec commit 7bcd78c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 22 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Come learn all about [.NET Aspire](https://learn.microsoft.com/dotnet/aspire/),

- **Orchestration**: Built-in orchestration with a simple, yet powerful, workflow engine.Use C# and familiar APIs without a line of YAML. Easily add popular cloud services, connect them to your projects, and run locally with a single click.
- **Service Discovery**: Automatic injection the right connection strings or network configurations and service discovery information to simplify the developer experience.
- **Components**: Built-in components for common cloud services like databases, queues, and storage. Integrated with logging, health checks, telemetry, and more.
- **Integrations**: Built-in integrations for common cloud services like databases, queues, and storage. Configured for logging, health checks, telemetry, and more.
- **Dashboard**: See live OpenTelemetry data with no configuration required. Launched by default on run, .NET Aspire's developer dashboard shows logs, environment variables, distributed traces, metrics and more to quickly verify app behavior.
- **Deployment**: manages injecting the right connection strings or network configurations and service discovery information to simplify the developer experience.
- **So Much More**: .NET Aspire is packed full of features that developers will love and help you be more productive.
Expand Down Expand Up @@ -48,7 +48,7 @@ This .NET Aspire workshop is part of the [Let's Learn .NET](https://aka.ms/letsl
1. [Service Defaults](./workshop/2-servicedefaults.md)
1. [Developer Dashboard & Orchestration](./workshop/3-dashboard-apphost.md)
1. [Service Discovery](./workshop/4-servicediscovery.md)
1. [Components](./workshop/5-components.md)
1. [Integrations](./workshop/5-integrations.md)
1. [Deployment](./workshop/6-deployment.md)

A full slide deck is available for this workshop [here](./workshop/AspireWorkshop.pptx).
Expand Down
39 changes: 19 additions & 20 deletions workshop/5-components.md → workshop/5-integrations.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
# .NET Aspire Components
# .NET Aspire Integrations

.NET Aspire components are a curated suite of NuGet packages specifically selected to facilitate the integration of cloud-native applications with prominent services and platforms, including but not limited to Redis and PostgreSQL. Each component furnishes essential cloud-native functionalities through either automatic provisioning or standardized configuration patterns. .NET Aspire components can be used without an app host (orchestrator) project, but they're designed to work best with the .NET Aspire app host.
.NET Aspire integrations are a curated suite of NuGet packages specifically selected to facilitate the integration of cloud-native applications with prominent services and platforms, including but not limited to Redis and PostgreSQL. Each integration furnishes essential cloud-native functionalities through either automatic provisioning or standardized configuration patterns.

.NET Aspire components should not be confused with .NET Aspire hosting packages, as they serve different purposes. Hosting packages are used to model and configure various resources in a .NET Aspire app, while components are used to map configuration to various client libraries.
.NET Aspire integrations come in two distinct flavors: **hosting integrations**, and **client integrations**. Hosting integrations are used to model and configure various resources in a .NET Aspire app, while client integrations are used to map configuration to various client libraries.

There is an ever growing list [.NET Aspire Components](https://learn.microsoft.com/dotnet/aspire/fundamentals/components-overview?tabs=dotnet-cli#available-components) created and shipped by Microsoft and the community. .NET Aspire is flexible and anyone can create their own component to integrate with their own services.
There is an ever growing list [.NET Aspire integrations](https://learn.microsoft.com/dotnet/aspire/fundamentals/integrations-overview?tabs=dotnet-cli#available-integrations) created and shipped by Microsoft and the community. .NET Aspire is flexible and anyone can create their own package to integrate with their own services.

Let's improve our application by adding an integration to it. We will add a integration that will help us to connect to a Redis cache to improve our API performance.

Let's improve our application by adding a component to it. We will add a component that will help us to connect to a Redis cache to improve our API performance.
## Add Redis Integration to App Host

## Add Redis Component to App Host

There are two types of caching that we could integrate into our application including:

- **Output caching**: A configurable, extensible caching method for storing entire HTTP responses for future requests.
- **Distributed caching**: A cache shared by multiple app servers that allows you to cache specific pieces of data. A distributed cache is typically maintained as an external service to the app servers that access it and can improve the performance and scalability of an ASP.NET Core app.

We will integrate the _Output caching_ component to our app host. This component will help us to cache the response of our API in Redis cache.

To add the Redis component to our app host, we need to install the `Aspire.Hosting.Redis` NuGet package. This package provides the necessary components to configure the service in the App Host. Redis is provided through a container image in this workshop, and when we start the .NET Aspire App Host, it will automatically download the Redis container image and start the Redis server.
To add the Redis hosting integration to our App Host, we need to install the `Aspire.Hosting.Redis` NuGet package. This package provides the necessary pirces to configure the service in the App Host. Redis is provided through a container image in this workshop, and when we start the .NET Aspire App Host, it will automatically download the Redis container image and start the Redis server.

With the NuGet installed we can configure it.

Expand All @@ -36,7 +28,7 @@ With the NuGet installed we can configure it.
.WithReference(cache);
```

1. Additionally, we could configure [Redis Commander](https://joeferner.github.io/redis-commander/), a Redis management tool. As part of the `Aspire.Hosting.Redis` package, Redis Commander is available in the same component. To add Redis Commander, add the following code under to the newly added Redis configuration.
1. Additionally, we could configure [Redis Commander](https://joeferner.github.io/redis-commander/), a Redis management tool. As part of the `Aspire.Hosting.Redis` package, Redis Commander is available in the same integration. To add Redis Commander, add the following code under to the newly added Redis configuration.

```csharp
var cache = builder.AddRedis("cache")
Expand All @@ -58,6 +50,13 @@ We haven't made any changes to the `Api` or `MyWeatherHub` projects, but we can

## Integrate Output Caching in API

There are two types of caching that we could integrate into our ASP.NET Core applications:

- **Output caching**: A configurable, extensible caching method for storing entire HTTP responses for future requests.
- **Distributed caching**: A cache shared by multiple app servers that allows you to cache specific pieces of data. A distributed cache is typically maintained as an external service to the app servers that access it and can improve the performance and scalability of an ASP.NET Core app.

We will add the _Output caching_ Redis client integration to our Api project. This integration will help us to cache the response of our API in Redis cache.

1. Install the `Aspire.StackExchange.Redis.OutputCaching` NuGet package in the `Api` project to get access to the Redis APIs.
1. Open the `Program.cs` file in the `Api` project.
1. Add the following code under the `var builder = WebApplication.CreateBuilder(args);` at the top of the file:
Expand Down Expand Up @@ -99,7 +98,7 @@ We haven't made any changes to the `Api` or `MyWeatherHub` projects, but we can

## Custom Redis Containers

.NET Aspire components are flexible and customizable. By default, the Redis component uses a Redis container image from Docker Hub. However, you can use your own Redis container image by providing the image name and tag after the `AddRedis` method. For example, if you have a custom Redis container image such as [Garnet](https://github.com/microsoft/garnet), you can provide the image name and tag in the App Host as follows:
.NET Aspire integrations are flexible and customizable. By default, the Redis integration uses a Redis container image from Docker Hub. However, you can use your own Redis container image by providing the image name and tag after the `AddRedis` method. For example, if you have a custom Redis container image such as [Garnet](https://github.com/microsoft/garnet), you can provide the image name and tag in the App Host as follows:

```csharp
var cache = builder.AddRedis("cache")
Expand All @@ -117,8 +116,8 @@ var cache = builder.AddRedis("cache")


## Summary
In this section, we added a Redis component to the App Host and integrated output caching in the API. We saw how the response was cached in the Redis cache and how the second request was much faster than the first one. We also saw how to use Redis Commander to manage the Redis cache.
In this section, we added a Redis hosting integration to the App Host and Redis output caching client integration in the API. We saw how the response was cached in the Redis cache and how the second request was much faster than the first one. We also saw how to use Redis Commander to manage the Redis cache.

There are many more components available that you can use to integrate with your services. You can find the list of available components [in the .NET Aspire documentation](https://learn.microsoft.com/dotnet/aspire/fundamentals/components-overview?tabs=dotnet-cli#available-components).
There are many more Aspire integrations available that you can use to integrate with your services. You can find the list of available integrations [in the .NET Aspire documentation](https://learn.microsoft.com/dotnet/aspire/fundamentals/integrations-overview?tabs=dotnet-cli#available-integrations).

A natural next step would be to integrate a database or leverage Azure Redis Cache as a hosted solution. Components for these and more are available on NuGet.
A natural next step would be to integrate a database or leverage Azure Redis Cache as a hosted solution. Integrations for these and more are [available on NuGet](https://www.nuget.org/packages?q=owner%3Aaspire+tags%3Aintegration).

0 comments on commit 7bcd78c

Please sign in to comment.