Franz.Common.Messaging.MassTransit 1.2.64

dotnet add package Franz.Common.Messaging.MassTransit --version 1.2.64                
NuGet\Install-Package Franz.Common.Messaging.MassTransit -Version 1.2.64                
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="Franz.Common.Messaging.MassTransit" Version="1.2.64" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Franz.Common.Messaging.MassTransit --version 1.2.64                
#r "nuget: Franz.Common.Messaging.MassTransit, 1.2.64"                
#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.
// Install Franz.Common.Messaging.MassTransit as a Cake Addin
#addin nuget:?package=Franz.Common.Messaging.MassTransit&version=1.2.64

// Install Franz.Common.Messaging.MassTransit as a Cake Tool
#tool nuget:?package=Franz.Common.Messaging.MassTransit&version=1.2.64                

Franz.Common.Messaging.MassTransit

A library within the Franz Framework that integrates MassTransit with messaging workflows. This package simplifies the setup and management of Kafka-based messaging using MassTransit, providing tools for producers, consumers, and client registrations.


Features

  • MassTransit Integration:
    • Extends MassTransit functionality to Kafka-based workflows.
  • Kafka Messaging:
    • Interfaces for Kafka producers (IKafkaProducer) and consumers (IKafkaConsumer).
  • Messaging Client:
    • IMessagingClient for abstracting and managing messaging operations.
  • Service Registration:
    • ServiceRegistration to streamline the setup of Kafka producers and consumers.

Version Information

  • Current Version: 1.2.64
  • Part of the private Franz Framework ecosystem.

Dependencies

This package relies on:

  • MassTransit (8.3.4): Provides in-process messaging and event-driven architecture tools.
  • MassTransit.Kafka (8.3.4): Adds Kafka transport support for MassTransit.

Installation

From Private Azure Feed

Since this package is hosted privately, configure your NuGet client:

dotnet nuget add source "https://your-private-feed-url" \
  --name "AzurePrivateFeed" \
  --username "YourAzureUsername" \
  --password "YourAzurePassword" \
  --store-password-in-clear-text

Install the package:

dotnet add package Franz.Common.Messaging.MassTransit --Version 1.2.64

Usage

1. Register Kafka Messaging with MassTransit

Use ServiceRegistration to set up Kafka producers and consumers:

using Franz.Common.Messaging.MassTransit.Extensions;

services.AddMassTransitKafkaMessaging(cfg =>
{
    cfg.Host("localhost:9092", h =>
    {
        h.Username = "your-username";
        h.Password = "your-password";
    });
});

2. Implement Kafka Producers and Consumers

Define Kafka producer and consumer interfaces:

using Franz.Common.Messaging.MassTransit.Contracts;

public interface IOrderCreatedProducer : IKafkaProducer<OrderCreatedEvent> { }
public interface IOrderCreatedConsumer : IKafkaConsumer<OrderCreatedEvent> { }

Implement the producer and consumer logic:

using Franz.Common.Messaging.MassTransit.Clients;

public class OrderCreatedProducer : KafkaProducer<OrderCreatedEvent>, IOrderCreatedProducer
{
    public OrderCreatedProducer(IMessagingClient client) : base(client) { }
}

public class OrderCreatedConsumer : KafkaConsumer<OrderCreatedEvent>, IOrderCreatedConsumer
{
    public OrderCreatedConsumer(IMessagingClient client) : base(client) { }
}

3. Use Messaging Clients

Leverage IMessagingClient to abstract messaging operations:

using Franz.Common.Messaging.MassTransit.Clients;

public class MessagingService
{
    private readonly IMessagingClient _messagingClient;

    public MessagingService(IMessagingClient messagingClient)
    {
        _messagingClient = messagingClient;
    }

    public async Task PublishMessageAsync<T>(T message) where T : class
    {
        await _messagingClient.PublishAsync(message);
    }
}

Integration with Franz Framework

The Franz.Common.Messaging.MassTransit package integrates seamlessly with:

  • MassTransit: Enables robust event-driven messaging workflows.
  • MassTransit.Kafka: Adds Kafka transport support for MassTransit.
  • Franz Framework: Extends Kafka messaging capabilities across distributed systems.

Contributing

This package is part of a private framework. Contributions are limited to the internal development team. If you have access, follow these steps:

  1. Clone the repository. @ https://github.com/bestacio89/Franz.Common/
  2. Create a feature branch.
  3. Submit a pull request for review.

License

This library is licensed under the MIT License. See the LICENSE file for more details.


Changelog

Version 1.2.64

  • Added IKafkaProducer and IKafkaConsumer interfaces for Kafka operations.
  • Integrated IMessagingClient for abstracted messaging operations.
  • Provided ServiceRegistration for streamlined Kafka setup with MassTransit.
  • Full compatibility with MassTransit and MassTransit.Kafka.
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. 
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.2.64 4 1/29/2025
1.2.63 56 1/27/2025
1.2.62 25 1/8/2025