Redrive Docs
Docs: Contracts

Contracts

Install your MassTransit message types from NuGet and publish them by type.

Contracts is part of Pro. A contract package is the NuGet package that holds your MassTransit message types. Once it’s installed, Redrive can show each type’s schema, publish a message as that type, and link messages and exchanges to their contract.

The Contracts screen has three tabs: Packages, Types and Feeds.

Install a package

  1. Open Contracts and click Install package.
  2. On the Feed side, pick a feed and search for the package. A feed without a search service returns nothing, so Redrive offers the text you typed as an exact package id.
  3. Pick a version. The latest stable version is picked by default.
  4. Click Install.

To install a package that isn’t on a feed, switch to Upload and drop a .nupkg file. It installs straight away.

The result lists how many types loaded, and any that couldn’t load with the reason.

Installing loads the package’s code into the Redrive process. Install only packages you trust. nuget.org is public and anyone can publish there, so the dialog warns you to check the package id when you install from it.

Which types load

Redrive reads the package’s lib folder for the framework closest to net10.0. Every public class, record and interface in it becomes a type, except abstract classes, open generics and delegates. You don’t need any attribute.

Each type publishes to its MassTransit exchange: Namespace:TypeName by default, or the name from [EntityName]. The Types tab tags types that are interfaces, set a custom URN with [MessageUrn], or implement CorrelatedBy<Guid>.

Redrive restores the package’s dependencies from your enabled feeds, at the lowest version each one allows. It skips MassTransit*, System.*, Microsoft.* and NETStandard.Library, which come from Redrive itself. A dependency it can’t find makes the types that need it unavailable: the Types tab tags them Unavailable with the missing package, and the Packages tab counts them.

Turning nuget.org off can make types unavailable. Dependencies only restore from enabled feeds, so a package whose dependencies live on nuget.org needs that feed on.

Packages

Each row shows the package, version, source feed (or Uploaded), install date and type count. Click a row to see its types.

Check for updates asks each package’s feed once and shows any newer version in the Updates column. Redrive never checks on its own. Click a newer version, or choose Change version… in the row’s ⋯ menu, to move to it. Uninstall… removes the package and its types.

Types

The Types tab lists every installed type, with a filter by name or URN and a package picker. Select a type to see its exchange, URN, package and properties with their types. Open in Publish opens Publishing in MassTransit mode with the type picked and its payload filled in.

When a peeked message’s type is installed, its MassTransit tag in the viewer opens the type here. An exchange whose name matches an installed type gets a Contract tag on its page.

Feeds

Redrive starts with nuget.org (https://api.nuget.org/v3/index.json) as an enabled feed. Click Add feed for a private one:

Field What it’s for
Name The name shown in the Install dialog and the Source column.
URL A NuGet v3 service index, such as https://pkgs.example.com/v3/index.json, or a local folder path.
Username For feeds that need a login.
Password or token The password or access token that goes with the username.
Enabled Whether Install and dependency restore use the feed.

Test looks up a package to check the feed answers, and shows “Feed reachable” and “Search” chips or the problem. When you enter a server’s base address and {url}/v3/index.json answers, the dialog offers to use that instead.

Deleting a feed keeps its packages installed, but you can no longer change their version.

Manage contracts from a file

For Docker and infrastructure as code, put a contracts.json in the data directory. Redrive reads it at startup and makes the feeds and packages match it:

{
  "feeds": [
    {
      "name": "internal",
      "url": "https://pkgs.example.com/v3/index.json",
      "username": "svc-redrive",
      "passwordEnv": "FEED_TOKEN"
    }
  ],
  "packages": [
    { "id": "Acme.Orders.Contracts", "version": "2.4.0", "feed": "internal" }
  ]
}
  • Feeds match by URL and packages by id. Anything the file doesn’t declare is removed, the default nuget.org feed included.
  • passwordEnv names an environment variable to read the password from. You can also give password directly.
  • A package without feed installs from the first declared feed.

While the file exists, the Contracts screen shows a From contracts.json tag and you can’t change feeds or packages from the app. A package that fails to install shows its error under its name.

Who can install

Without sign-in, anyone using Redrive can install packages and edit feeds. With sign-in on, only admins can; operators and viewers see only the Types tab. See Users & sign-in.