Phema.RabbitMq.Producers
3.0.0-preview3.0.5
This is a prerelease version of Phema.RabbitMq.Producers.
The owner has unlisted this package.
This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package Phema.RabbitMq.Producers --version 3.0.0-preview3.0.5
NuGet\Install-Package Phema.RabbitMq.Producers -Version 3.0.0-preview3.0.5
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.Producers" Version="3.0.0-preview3.0.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Phema.RabbitMq.Producers" Version="3.0.0-preview3.0.5" />
<PackageReference Include="Phema.RabbitMq.Producers" />
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.Producers --version 3.0.0-preview3.0.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Phema.RabbitMq.Producers, 3.0.0-preview3.0.5"
#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.Producers@3.0.0-preview3.0.5
#: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.Producers&version=3.0.0-preview3.0.5&prerelease
#tool nuget:?package=Phema.RabbitMq.Producers&version=3.0.0-preview3.0.5&prerelease
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
- Create
IRabbitMqConsumer<TPayload> - 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
IRabbitMQProdicer<TPayload>and useProduceorBatchProduce - 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 handling
Limitations
- Uses only
Microsoft.Extensions.DepencencyInjectionpackage - 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 😭
Tips
RoutingKeyisQueue.Nameby default- Do not use same group(connection) for consumers and producers
IRabbitMQConnectionFactory- singleton dependency inIServiceProviderper instance for custom connections- If queue or exchange is default or exists, binding goes withot declaration
- Used
ISerializerfromPhema.Serialization...search for nuget package to add
| 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 | netcoreapp3.0 is compatible. netcoreapp3.1 was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETCoreApp 3.0
- Phema.RabbitMQ.Core (>= 3.0.0-preview3.0.5)
- Phema.Serialization (>= 2.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 |
|---|