cloops.microservices
1.0.12
See the version list below for details.
dotnet add package cloops.microservices --version 1.0.12
NuGet\Install-Package cloops.microservices -Version 1.0.12
<PackageReference Include="cloops.microservices" Version="1.0.12" />
<PackageVersion Include="cloops.microservices" Version="1.0.12" />
<PackageReference Include="cloops.microservices" />
paket add cloops.microservices --version 1.0.12
#r "nuget: cloops.microservices, 1.0.12"
#:package cloops.microservices@1.0.12
#addin nuget:?package=cloops.microservices&version=1.0.12
#tool nuget:?package=cloops.microservices&version=1.0.12
CLOOPS Microservices SDK
The official Connection Loops SDK for building high performance microservices designed to run on CCNP. This is an opinionated approach to building microservices.
๐ Overview
The goal here is to minimize the undifferentiated work and get started with a project quickly. Cloops Microservices SDK gives you all the bells and whistles so that you can develop your service quite effortlessly. Once the SDK is pulled in, it is just a one-liner setup to have full-fledged microservice up and running.
This SDK is supposed to be used when the primary way to communicate with your microservice is NATS. i.e. No REST interface
โก Benefits of using NATS over REST
- Lower latency
- Higher throughput
- No protocol bloat
- Can implement temporal decoupling quite easily
- No additional hops for load balancing
- Decentralized PKI based AuthN and AuthZ
- No network ports exposed
๐งฉ Installation
โจ New Projects (Recommended)
# install the template (If you do not have it)
dotnet new install cloops.microservice.template
# If you have the template, but want to make sure you get the latest one
dotnet new uninstall cloops.microservices.template
# Create a new project
dotnet new cloops.microservice -n <name_of_service>
๐ Existing Projects
Add cloops.nats package reference to your .csproj file. Please note we deliberately want all of our consumers to stay on latest version of the SDK.
<PackageReference Include="cloops.microservices" Version="*" />
Once added, just to dotnet restore to pull in the SDK.
Usage (Program.cs) -
using CLOOPS.microservices;
var app = new App();
await app.RunAsync();
Please note: since cloops microservices is quite opinionated, you might need to restructure project to make it work. Please read the features section for more information.
๐ ๏ธ Features
Out of the box implementations of -
- Observability
- Logging
- Metrics
- Tracing (WIP)
- Feature Flagging (WIP)
- Background jobs (WIP)
- Automated DI Setup
- Controllers
- Each function is a handler for a NATS subject.
- Controller is the starting point to process a request or published message.
- (All classes under
.\*controllersnamespace are auto registered)
- Services
- A service executes business logic.
- Typically controller executes one or more services as per what's needed to get the job done.
- All classes under
.\*servicesnamespace are auto registered
- Background Services
- A piece of code that runs in background (usually on a continuous schedule)
- e.g. a cleanup service that deletes some things every 2 hours.
- All classes under
.\*BackgroundServicesnamespace and inherited fromBackgroundServiceclass are auto registered
- HTTP services
- Services with in-built HTTP client
- Used to make REST API calls to other third party services
- Controllers
- AppSettings
- Util
- MSSQL Server Client (DB.cs) (async streaming supported)
- CLOOPS.NATS functionality
- Serialization and Deserialization
- Client
- Consumers
- Publishers
- KV and Distributed locking
๐ฑ Environment Variables used by SDK
๐ก NATS related environment variables
Below are the environment variables used by CLOOPS.NATS
NATS_URL- Specifies the NATS server URL. Defaults to
tls://nats.ccnp.cloops.in:4222. - For running on prod CCNP, make sure you set it to
tls://nats-headless.ccnp.cloops.in:4222for faster within cluster operations.
- Specifies the NATS server URL. Defaults to
NATS_CREDS- Inline content of the NATS credentials file used for authentication. No default.
NATS_SUBSCRIPTION_QUEUE_SIZE- This variable defines what should be the max limit of messages queued up for each subscription. Use this to control backpressure. Default: 20,000
NATS_CONSUMER_MAX_DOP- Defines maximum degree of parallelism for all consumers. These many messages can be processed in parallel from the message queue. Default: 128
- This puts upper limit on rps (request per second), not literally, but indirectly. (e.g. if your avg latency is 200ms then max_dop * 5 is your max throughput). Increase this in order to support higher rps. Consider giving higher core / memory count as well.
- (Caution) Minting Service related environment variables
- Highly confidential. Only use in trusted services running on trusted infrastructure.
- Used by minting service when you need your application to mint new NATS tokens.
NATS_ACCOUNT_SIGNING_SEED- Signing account seed
- How to get it
- On nats-box
- run
cd /data/nsc/nkeys/keys/A - run
find . -type f -name "*.nk" -o -name "*.seed" - run
cat <account-signing-public-key>.nkto get the account signing seed. (remember to pick public key of singing account not main account)
NATS_ACCOUNT_PUBLIC_KEY- Main account public key
- How to get it
- Run this on nats-box to get the account public key:
nsc list keys --account=<account-name>(remember to pick the main account not signing key)
- Run this on nats-box to get the account public key:
๐งช Microservice operation related environment variables
DEBUG- Turns on verbose logging and additional diagnostics when set to
True. Defaults toFalse.
- Turns on verbose logging and additional diagnostics when set to
CCNPOTELENDPOINT- OTEL collector endpoint for exporting telemetry to CCNP. No default.
CCNPOTELHEADERS- Additional OTEL headers required when sending telemetry to CCNP. No default.
CLUSTER- Target cluster where the service runs. Defaults to
ccnp.
- Target cluster where the service runs. Defaults to
CNSTR- SQL connection string. No default.
ENABLE_NATS_CONSUMERS- Controls whether NATS consumers start with the service. Defaults to
False.
- Controls whether NATS consumers start with the service. Defaults to
๐งญ Additional Setup you might need to do
- Database deployment
- NATS JetStream streams, consumer creation
- Doppler project creation
Please reach out to platform team for help on these.
โ FAQ
๐ค How do I use a different version of CLOOPS.NATS?
CLOOPS.Microservices ships with latest version of CLOOPS.NATS. So all you have to do is just rebuild your service to bump up the CLOOPS.NATS version.
With that said, you can override exact version in your project if you need to. Please see below code. If you keep version as "*", whenever your project gets built, it will pull in latest CLOOPS.NATS version.
<PackageReference Include="cloops.microservices" Version="*" />
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net9.0
- cloops.nats (>= 1.0.42)
- cloops.nats.schema (>= 1.0.0)
- cronos (>= 0.11.1)
- Microsoft.Data.SqlClient (>= 6.1.1)
- Microsoft.Extensions.Hosting (>= 9.0.0)
- Microsoft.Extensions.Http (>= 9.0.0)
- Microsoft.Extensions.Logging.Console (>= 9.0.0)
- OpenTelemetry (>= 1.12.0)
- OpenTelemetry.Api (>= 1.12.0)
- OpenTelemetry.Exporter.OpenTelemetryProtocol (>= 1.12.0)
- OpenTelemetry.Extensions.Hosting (>= 1.12.0)
- OpenTelemetry.Instrumentation.Http (>= 1.12.0)
- OpenTelemetry.Instrumentation.Runtime (>= 1.12.0)
- OpenTelemetry.Instrumentation.SqlClient (>= 1.12.0-beta.2)
- Serilog (>= 4.3.0)
- Serilog.Enrichers.Thread (>= 4.0.0)
- Serilog.Extensions.Hosting (>= 9.0.0)
- Serilog.Formatting.Compact (>= 3.0.0)
- Serilog.Sinks.Console (>= 6.0.0)
- System.Linq.Async (>= 6.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.1.13 | 89 | 1/11/2026 |
| 1.1.12 | 181 | 12/23/2025 |
| 1.1.11 | 143 | 12/23/2025 |
| 1.1.10 | 154 | 12/23/2025 |
| 1.1.9 | 124 | 12/21/2025 |
| 1.1.8 | 276 | 12/16/2025 |
| 1.1.7 | 237 | 12/16/2025 |
| 1.1.6 | 234 | 12/16/2025 |
| 1.1.5 | 237 | 12/16/2025 |
| 1.1.4 | 254 | 12/16/2025 |
| 1.1.3 | 241 | 12/16/2025 |
| 1.1.2 | 240 | 12/16/2025 |
| 1.1.1 | 236 | 12/16/2025 |
| 1.0.14 | 250 | 12/15/2025 |
| 1.0.13 | 238 | 12/15/2025 |
| 1.0.12 | 291 | 11/17/2025 |
| 1.0.11 | 292 | 11/17/2025 |
| 1.0.10 | 180 | 11/9/2025 |
| 1.0.9 | 217 | 11/9/2025 |
| 1.0.8 | 175 | 11/9/2025 |