cloops.microservices 1.0.10

There is a newer version of this package available.
See the version list below for details.
dotnet add package cloops.microservices --version 1.0.10
                    
NuGet\Install-Package cloops.microservices -Version 1.0.10
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="cloops.microservices" Version="1.0.10" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="cloops.microservices" Version="1.0.10" />
                    
Directory.Packages.props
<PackageReference Include="cloops.microservices" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add cloops.microservices --version 1.0.10
                    
#r "nuget: cloops.microservices, 1.0.10"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package cloops.microservices@1.0.10
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=cloops.microservices&version=1.0.10
                    
Install as a Cake Addin
#tool nuget:?package=cloops.microservices&version=1.0.10
                    
Install as a Cake Tool

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

# install the template (If you do not have it)
dotnet new install cloops.microservice.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 .\*controllers namespace 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 .\*services namespace 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 .\*BackgroundServices namespace and inherited from BackgroundService class are auto registered
    • HTTP services
      • Services with in-built HTTP client
      • Used to make REST API calls to other third party services
  • 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

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:4222 for faster within cluster operations.
  • 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>.nk to 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)
  • DEBUG
    • Turns on verbose logging and additional diagnostics when set to True. Defaults to False.
  • 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.
  • CNSTR
    • SQL connection string. No default.
  • ENABLE_NATS_CONSUMERS
    • Controls whether NATS consumers start with the service. Defaults to False.

๐Ÿงญ Additional Setup you might need to do

  1. Database deployment
  2. NATS JetStream streams, consumer creation
  3. 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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 91 1/11/2026
1.1.12 181 12/23/2025
1.1.11 143 12/23/2025
1.1.10 155 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 292 11/17/2025
1.0.11 292 11/17/2025
1.0.10 180 11/9/2025
1.0.9 218 11/9/2025
1.0.8 175 11/9/2025
Loading failed