Escendit.Orleans.Streaming.RabbitMQ
0.1.0-rc.83
See the version list below for details.
dotnet add package Escendit.Orleans.Streaming.RabbitMQ --version 0.1.0-rc.83
NuGet\Install-Package Escendit.Orleans.Streaming.RabbitMQ -Version 0.1.0-rc.83
<PackageReference Include="Escendit.Orleans.Streaming.RabbitMQ" Version="0.1.0-rc.83" />
paket add Escendit.Orleans.Streaming.RabbitMQ --version 0.1.0-rc.83
#r "nuget: Escendit.Orleans.Streaming.RabbitMQ, 0.1.0-rc.83"
// Install Escendit.Orleans.Streaming.RabbitMQ as a Cake Addin #addin nuget:?package=Escendit.Orleans.Streaming.RabbitMQ&version=0.1.0-rc.83&prerelease // Install Escendit.Orleans.Streaming.RabbitMQ as a Cake Tool #tool nuget:?package=Escendit.Orleans.Streaming.RabbitMQ&version=0.1.0-rc.83&prerelease
NuGet Package: Escendit.Orleans.Streaming.RabbitMQ
Escendit.Orleans.Streaming.RabbitMQ is a NuGet Package that integrates RabbitMQ with Orleans Streaming Provider.
The Library contains 2 different ways of streaming, first via Stream Protocol, and other via AMQP protocol.
The Library provides named connections to Rabbit MQ, which can be used for low-level integration events.
Installation
To install Escendit.Orleans.Streaming.RabbitMQ, run the following command in the Package Manager Console:
Install-Package Escendit.Orleans.Streaming.RabbitMQ
Usage
To use Escendit.Orleans.Streaming.RabbitMQ first register the stream provider
using the AddRabbitMqStreaming
method in the Orleans configuration:
SiloBuilder
var builder = new SiloBuilder()
.AddRabbitMqStreaming("ProviderName");
ClientBuilder
var builder = new ClientBuilder()
.AddRabbitMqStreaming("ProviderName");
Stream Protocol
To use Escendit.Orleans.Streaming.RabbitMQ with Stream Protocol,
first register the stream provider using the AddRabbitMqStreaming
method in the Orleans configuration,
and then call the WithStream
method to specify that the provider should use the Stream Protocol:
SiloBuilder
var hostBuilder = Host
.CreateDefaultBuilder()
.UseOrleans(builder =>
{
builder
.Configure<ClusterOptions>(options =>
{
options.ClusterId = "cluster-id";
options.ServiceId = "service-id";
})
.AddStreaming()
.AddRabbitMqStreaming("ProviderName")
.WithStream(options =>
{
options.Endpoints.Add(new RabbitEndpoint { HostName = "localhost", Port = 5552 });
options.UserName = "guest";
options.Password = "guest";
options.VirtualHost = "/";
});
});
ClientBuilder
var hostBuilder = Host
.CreateDefaultBuilder()
.UseOrleansClient(builder =>
{
builder
.Configure<ClusterOptions>(options =>
{
options.ClusterId = "cluster-id";
options.ServiceId = "service-id";
})
.AddStreaming()
.AddRabbitMqStreaming("ProviderName")
.WithStream(options =>
{
options.Endpoints.Add(new RabbitEndpoint { HostName = "localhost", Port = 5552 });
options.UserName = "guest";
options.Password = "guest";
options.VirtualHost = "/";
});
})
AMQP Protocol
To use Escendit.Orleans.Streaming.RabbitMQ with Stream Protocol,
first register the stream provider using the AddRabbitMqStreaming
method in the Orleans configuration,
and then call the WithQueue
method to specify that the provider should use the AMQP Protocol:
SiloBuilder
var hostBuilder = Host
.CreateDefaultBuilder()
.UseOrleans(builder =>
{
builder
.Configure<ClusterOptions>(options =>
{
options.ClusterId = "cluster-id";
options.ServiceId = "service-id";
})
.AddStreaming()
.AddRabbitMqStreaming("ProviderName")
.WithQueue(options =>
{
options.Endpoints.Add(new RabbitEndpoint { HostName = "localhost", Port = 5672 });
options.UserName = "guest";
options.Password = "guest";
options.VirtualHost = "/";
});
});
ClientBuilder
var hostBuilder = Host
.CreateDefaultBuilder()
.UseOrleansClient(builder =>
{
builder
.Configure<ClusterOptions>(options =>
{
options.ClusterId = "cluster-id";
options.ServiceId = "service-id";
})
.AddStreaming()
.AddRabbitMqStreaming("ProviderName")
.WithQueue(options =>
{
options.Endpoints.Add(new RabbitEndpoint { HostName = "localhost", Port = 5672 });
options.UserName = "guest";
options.Password = "guest";
options.VirtualHost = "/";
});
})
Low Level Registration
You can register the Rabbit MQ Classic Client, but the name must not conflict with the Orleans Streaming Provider.
SiloBuilder
var hostBuilder = Host
.CreateDefaultBuilder()
.UseOrleans(builder =>
{
builder
.Configure<ClusterOptions>(options =>
{
options.ClusterId = "cluster-id";
options.ServiceId = "service-id";
})
.ConfigureServices(services => services
.AddRabbitMq("ProviderName", options =>
{
options.Endpoints.Add(new RabbitEndpoint { HostName = "localhost", Port = 5672 });
options.UserName = "guest";
options.Password = "guest";
options.VirtualHost = "/";
})
.WithConnection());
});
ClientBuilder
var hostBuilder = Host
.CreateDefaultBuilder()
.UseOrleansClient(builder =>
{
builder
.Configure<ClusterOptions>(options =>
{
options.ClusterId = "cluster-id";
options.ServiceId = "service-id";
})
.ConfigureServices(services => services
.AddRabbitMq("ProviderName", options =>
{
options.Endpoints.Add(new RabbitEndpoint { HostName = "localhost", Port = 5672 });
options.UserName = "guest";
options.Password = "guest";
options.VirtualHost = "/";
})
.WithConnection());
})
Consume
Create a stream:
public class MyGrain : Grain, IMyGrain
{
private IAsyncStream<T> _stream;
public override async Task OnActivateAsync()
{
var streamProvider = this.GetStreamProvider("ProviderName");
_stream = _streamProvider.GetStream<int>(this.GetPrimaryKey(), "stream-namespace");
_stream.SubscribeAsync(ReceiveMessage);
await base.OnActivateAsync();
}
public async Task SendMessage()
{
// Send a message
await _stream.OnNextAsync(42);
}
public Task ReceiveMessage(Event @event)
{
// Receive a message.
}
}
Create a low-level connection:
public class MyService : GrainService
{
private readonly IConnection _connection;
public MyService(string name, IServiceProvider serviceProvider)
{
_connection = serviceProvider.GetRequiredServiceByName<IConnection>(name);
}
}
Contributing
If you'd like to contribute to Escendit.Orleans.Streaming.RabbitMQ, please fork the repository and make changes as you'd like. Pull requests are warmly welcome.
Product | Versions 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. |
-
net7.0
- Microsoft.Orleans.Sdk (>= 7.1.2)
- Microsoft.Orleans.Streaming (>= 7.1.2)
- RabbitMQ.Client (>= 6.5.0)
- RabbitMQ.Stream.Client (>= 1.4.1)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Escendit.Orleans.Streaming.RabbitMQ:
Package | Downloads |
---|---|
Escendit.Orleans.Streaming.RabbitMQ.AmqpProtocol
RabbitMQ Orleans AMQP Streaming Provider |
|
Escendit.Orleans.Streaming.RabbitMQ.StreamProtocol
RabbitMQ Orleans Stream Protocol Streaming Provider |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.2.1-rc.5 | 487 | 6/7/2024 |
0.2.1-rc.3 | 3,166 | 4/27/2024 |
0.1.1-rc.64 | 1,379 | 1/18/2024 |
0.1.1-rc.62 | 129 | 12/18/2023 |
0.1.1-rc.58 | 84 | 12/18/2023 |
0.1.1-rc.56 | 80 | 12/17/2023 |
0.1.1-rc.54 | 72 | 12/17/2023 |
0.1.1-rc.29 | 88 | 12/8/2023 |
0.1.1-rc.25 | 176 | 9/25/2023 |
0.1.1-rc.23 | 74 | 9/25/2023 |
0.1.1-rc.21 | 84 | 9/18/2023 |
0.1.1-rc.19 | 69 | 9/18/2023 |
0.1.1-rc.17 | 70 | 9/18/2023 |
0.1.1-rc.15 | 71 | 9/18/2023 |
0.1.1-rc.14 | 76 | 9/11/2023 |
0.1.1-rc.12 | 72 | 9/11/2023 |
0.1.1-rc.10 | 243 | 8/29/2023 |
0.1.1-rc.8 | 80 | 8/21/2023 |
0.1.1-rc.6 | 74 | 8/21/2023 |
0.1.1-rc.4 | 78 | 8/21/2023 |
0.1.1-rc.2 | 75 | 8/21/2023 |
0.1.0 | 1,226 | 8/10/2023 |
0.1.0-rc.108 | 79 | 8/10/2023 |
0.1.0-rc.106 | 80 | 8/10/2023 |
0.1.0-rc.104 | 80 | 8/10/2023 |
0.1.0-rc.102 | 105 | 7/31/2023 |
0.1.0-rc.100 | 155 | 7/22/2023 |
0.1.0-rc.94 | 86 | 7/10/2023 |
0.1.0-rc.91 | 71 | 7/10/2023 |
0.1.0-rc.87 | 85 | 7/1/2023 |
0.1.0-rc.86 | 83 | 7/1/2023 |
0.1.0-rc.85 | 82 | 7/1/2023 |
0.1.0-rc.84 | 80 | 7/1/2023 |
0.1.0-rc.83 | 80 | 7/1/2023 |
0.1.0-rc.82 | 126 | 6/11/2023 |
0.1.0-rc.80 | 81 | 6/11/2023 |
0.1.0-rc.72 | 81 | 6/10/2023 |
0.1.0-rc.54 | 113 | 5/17/2023 |