Phema.RabbitMq
3.0.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Phema.RabbitMq --version 3.0.0
NuGet\Install-Package Phema.RabbitMq -Version 3.0.0
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="Phema.RabbitMq" Version="3.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Phema.RabbitMq" Version="3.0.0" />
<PackageReference Include="Phema.RabbitMq" />
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 Phema.RabbitMq --version 3.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Phema.RabbitMq, 3.0.0"
#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 Phema.RabbitMq@3.0.0
#: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=Phema.RabbitMq&version=3.0.0
#tool nuget:?package=Phema.RabbitMq&version=3.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Phema.RabbitMQ
This is an attempt to create a simple way for safe and predictable application deploy with a versioned release-specific topology in a distributed systems
Concepts
- Release immutability
- The topology for each release must be strictly defined and not changed during its existence
- There is no such thing as:
- Canceling consumers
- Removing queues and exchanges
- Change bindings
- There is no such thing as:
- The topology for each release must be strictly defined and not changed during its existence
- Declarativeness and simplicity
- All parts are defined by describing their state
- Intuitive, RabbitMQ-close fluent interfaces
- Built-in modular serialization library, so working with objects, not bytes
- Modularity and flexibility
- If no customers is needed, just do not add
Phema.RabbitMQ.Consumerspackage, etc. - Each group has its own connection. Managing groups you manage connections
- If no customers is needed, just do not add
Installation
$> dotnet add package {{ PackageName }}
Packages
Phema.RabbitMQ.Core- Core factories, options and extensionsPhema.RabbitMQ.Exchanges- Exchanges,.AddExchangeGroup()extensionPhema.RabbitMQ.Queues- Queues,.AddQueueGroup()extensionPhema.RabbitMQ.Producers- Producers,.AddProducerGroup()extensionPhema.RabbitMQ.Consumers- Consumers,.AddConsumerGroup()extensionPhema.RabbitMQ- Meta package
Usage
// Search for Phema.Serialization packages
services.AddNewtonsoftJsonSerializer();
// Consumers
services.AddRabbitMQ("InstanceName", "amqp://connection.string")
.AddQueueGroup(group =>
group.AddQueue("QueueName")
.Durable())
.AddConsumerGroup(group =>
group.AddConsumer<Payload, PayloadConsumer>("QueueName")
.Count(2));
// Producers
services.AddRabbitMQ("InstanceName", factory => ...)
.AddExchangeGroup(group =>
group.AddDirectExchange("ExchangeName")
.Durable())
.AddProducerGroup(group =>
group.AddProducer<Payload>("ExchangeName", "QueueName")
.Persistent());
Supported
- Consumers and producers priority
- Queue and message time to live
- Max message count and size limitations
- Lazy, durable and exclusive queues
- Batch produce
- Declaring app id
- Durable, internal, dead letter, bound and alternate exchanges
- Reject-publish when queue is full
- Deleted declarative operation
- Default, confirm and transactional channel modes
- NoWait operations
- Message persistency
- Group-connections
Queues
- Declare durable queue with
Durableextension - Declare exclusive queue with
Exclusiveextension - Declare queue without waiting with
NoWaitextension - Bind exchange to exchange with
BoundToextension - Declare lazy queue with
Lazyextension - Set queue max message count with
MaxMessageCountextension - Set queue max message size in bytes with
MaxMessageSizeextension - Set dead letter exchange with
DeadLetterToextension - Set queue ttl with
TimeToLiveextension - Set message ttl with
MessageTimeToLiveextension - Set queue max priority with
MaxPriorityextension - Explicitly delete queue with
Deletedextension - Delete queue automatically with
AutoDeleteextension - Add custom arguments with
WithArgumentextension
Exchanges
- Declare durable exchange with
Durableextension - Declare exchange without waiting with
NoWaitextension - Declare exchange as internal with
Internalextension - Delete exchange automatically with
AutoDeleteextension - Explicitly delete exchange with
Deletedextension - Bind exchange to exchange with
BoundToextension - Declare alternate exchange with
AlternateToextension - Add custom arguments with
WithArgumentextension - Declare exchange with
AddDirectExchange(...),AddFanoutExchange(...),AddHeadersExchange(...),AddTopicExchange(...)extensions
Consumers
- Declare scoped
IRabbitMqConsumer<TPayload>withConsumemethod - Tag consumers using
Taggedextension - Limit prefetch count with
Prefetchextension - Scale consumers by using
Countextension - Declare exclusive consume with
Exclusiveextension - Forbid to consume own producers with
NoLocalextension - When no need to ack explicitly use
AutoAckextension - Requeue messages on fail with
Requeueextension - Set consumer priority with
Priorityextension - Add custom arguments with
WithArgumentextension - All consumers start in
IHostedService - Use
IRabbitMQConsumerFactoryfor custom message handling
Producers
- Inject scoped
IRabbitMQProdicer<TPayload>and useProduceorBatchProducemethods - Set routing key
RoutingKeyextension - Set mandatory with
Mandatoryextension - Set message priority with
Priorityextension - Set message ttl with
MessageTimeToLiveextension - Use channel transactional mode with
Transactionalextension - Use channel confirm mode with
WaitForConfirmsextension - Use message persistence with
Persistentextension - Configure headers with
WithHeaderextension - Configure properties with
WithPropertyextension - Use
IRabbitMQProducerFactoryfor custom message producing
Limitations
- Depends on
Microsoft.Extensions.DepencencyInjectionandPhema.Serializationpackage - No dynamic topology declaration by design, but you can use
IRabbitMQConnectionFactoryfor that ¯_(ツ)_/¯ - No
.Redeclared()and.Purged()because it breaks consistenty- Deploy
first_node - Purge
queue first_nodestarts produce messages- Deploy
second_node - Purge
queue - No
first_nodemessages survived
- Deploy
- There is a problem when one type of payload is used in different producers, so
IRabbitMQProducer<TPayload>abstraction leak 😭 - No
correlation-id's - No
message-id's - No
BasicReturnand other events for now
Tips
RoutingKeyisQueueName/ExchangeNameby default- Do not use same group(connection) for consumers and producers because of tcp backpressure
IRabbitMQConnectionFactory- singleton dependency inIServiceProviderper instance for custom connections- If queue or exchange is default or exists, binding goes withot declaration
- Use
BatchProduceinstead ofProducewith loop - Do not declare channel as
TransactionalandWaitForConfirms
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- Phema.RabbitMQ.Consumers (>= 3.0.0)
- Phema.RabbitMQ.Exchanges (>= 3.0.0)
- Phema.RabbitMQ.Producers (>= 3.0.0)
- Phema.RabbitMQ.Queues (>= 3.0.0)
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 |
|---|---|---|
| 3.1.8 | 1,613 | 10/12/2019 |
| 3.1.7 | 1,397 | 10/12/2019 |
| 3.1.6 | 1,399 | 10/12/2019 |
| 3.1.5 | 1,477 | 9/25/2019 |
| 3.1.4 | 470 | 9/3/2019 |
| 3.1.3 | 465 | 9/1/2019 |
| 3.1.2 | 460 | 8/31/2019 |
| 3.1.1 | 480 | 8/31/2019 |
| 3.1.0 | 448 | 8/30/2019 |
| 3.0.0 | 1,416 | 7/24/2019 |
| 3.0.0-preview3.0.5 | 473 | 4/1/2019 |
| 3.0.0-preview3.0.4 | 440 | 3/28/2019 |