Iggy 0.0.7

There is a newer version of this package available.
See the version list below for details.
dotnet add package Iggy --version 0.0.7
                    
NuGet\Install-Package Iggy -Version 0.0.7
                    
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="Iggy" Version="0.0.7" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Iggy" Version="0.0.7" />
                    
Directory.Packages.props
<PackageReference Include="Iggy" />
                    
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 Iggy --version 0.0.7
                    
#r "nuget: Iggy, 0.0.7"
                    
#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 Iggy@0.0.7
                    
#: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=Iggy&version=0.0.7
                    
Install as a Cake Addin
#tool nuget:?package=Iggy&version=0.0.7
                    
Install as a Cake Tool

<div align="center">

.NET Nuget (with prereleases)

</div>

C# SDK for Iggy

Getting Started

The whole SDK revolves around IMessageStream interface to create an instance of it, use following code

var bus = MessageStreamFactory.CreateMessageStream(x =>
{
    x.Protocol = Protocol.Http;
    x.BaseAddress = "http://localhost:8080";
});

Currently supported transfer protocols

  • TCP
  • HTTP

Creating first stream

In order to create stream call CreateStreamAsync method

bus.CreateStreamAsync(new StreamRequest
{
    Name = "First Stream",
    StreamId = 1,
});

Every stream has a topic to which you can broadcast messages, to create a topic use CreateTopicAsync method

bus.CreateTopicAsync(streamId, new TopicRequest
{
    Name = "First Topic",
    PartitionsCount = 3,
    TopicId = 1
});

To send messages you can use SendMessagesAsync method.

var messages = new List<Message>();
await bus.SendMessagesAsync(streamId, topicId, new MessageSendRequest
{
    Messages = messages,
    Partitioning = Partitioning.PartitionId(partitionId)
});

The Message struct has two fields Id and Payload

struct Message
{
    public required Guid Id { get; init; }
    public required byte[] Payload { get; init; }
}

Polling messages is done with PollMessagesAsync

var messages = await bus.PollMessagesAsync(new MessageFetchRequest
{
    StreamId = streamId,
    TopicId = topicId,
    Consumer = Consumer.New(consumerId),
    Count = 1,
    PartitionId = partitionId,
    PollingStrategy = MessagePolling.Next,
    Value = 0,
    AutoCommit = true
});

With version 0.0.5 a new api for PollMessagesAsync and SendMessagesAsync has been added, that allows user to provide custom serializer/deserializer.

SendMessages:

Func<Product, byte[]> serialier = // provide your own serializer.
var messages = new List<Product>();
await bus.SendMessagesAsync<Product>(streamId, topicId, Partitioning.PartitionId(partitionId), messages, serializer);

PollMessages:

Func<byte[], Product> deserializer = // provide your own deserializer.
var messages = await bus.PollMessagesAsync<Product>(new MessageFetchRequest<Product>
{
    StreamId = streamId,
    TopicId = topicId,
    Consumer = Consumer.New(consumerId),
    Count = 1,
    PartitionId = partitionId,
    PollingStrategy = MessagePolling.Next,
    Value = 0,
    AutoCommit = true
}, deserializer);

In version 0.0.6 an optional encryptor/decryptor parameter to SendMessagesAsync and PollMessagesAsync has been added.

It is worth noting that every method will throw an InvalidResponseException when encountering an error.<br><br> If you register IMessageStream in a dependency injection container, you will have access to interfaces that encapsulate smaller parts of the system IStreamClient ITopicClient IMessageClient IOffsetClient IConsumerGroupClient IUtilsClient IPartitionClient

For more information about how Iggy works check its documentation

Producer / Consumer Sample

https://github.com/iggy-rs/iggy-dotnet-client/assets/112548209/3a89d2f5-d066-40d2-8b82-96c3e338007e

To run the samples, first get Iggy, Run the server with cargo r --bin server, then get the SDK, cd into Iggy_SDK and run following commands: dotnet run -c Release --project Iggy_Sample_Producer for producer, dotnet run -c Release --project Iggy_Sample_Consumer for consumer.

TODO

  • Add support for ASP.NET Core Dependency Injection
Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  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.
  • net7.0

    • No dependencies.

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
0.1.0 185 3/28/2024
0.0.189 157 1/22/2024 0.0.189 is deprecated.
0.0.20 154 3/19/2024
0.0.19 150 1/22/2024
0.0.18 162 11/11/2023
0.0.17 206 10/14/2023
0.0.16 185 10/3/2023
0.0.15 188 9/25/2023
0.0.14 177 9/25/2023
0.0.13 193 9/23/2023
0.0.12 192 9/21/2023
0.0.11 207 9/9/2023
0.0.10 201 9/3/2023
0.0.9 222 8/29/2023
0.0.8 224 8/22/2023
0.0.7 216 8/21/2023
0.0.6 229 8/17/2023
0.0.5 229 8/10/2023
0.0.4 254 8/5/2023
0.0.3 224 7/31/2023
0.0.2 238 7/27/2023
0.0.1 279 7/27/2023