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.
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.
// Install Phema.RabbitMq.Producers as a Cake Addin #addin nuget:?package=Phema.RabbitMq.Producers&version=3.0.0-preview3.0.5&prerelease // Install Phema.RabbitMq.Producers as a Cake Tool #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.Consumers
package, 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
Durable
extension - Declare exclusive queue with
Exclusive
extension - Declare queue without waiting with
NoWait
extension - Bind exchange to exchange with
BoundTo
extension - Declare lazy queue with
Lazy
extension - Set queue max message count with
MaxMessageCount
extension - Set queue max message size in bytes with
MaxMessageSize
extension - Set dead letter exchange with
DeadLetterTo
extension - Set queue ttl with
TimeToLive
extension - Set message ttl with
MessageTimeToLive
extension - Set queue max priority with
MaxPriority
extension - Explicitly delete queue with
Deleted
extension - Delete queue automatically with
AutoDelete
extension - Add custom arguments with
WithArgument
extension
Exchanges
- Declare durable exchange with
Durable
extension - Declare exchange without waiting with
NoWait
extension - Declare exchange as internal with
Internal
extension - Delete exchange automatically with
AutoDelete
extension - Explicitly delete exchange with
Deleted
extension - Bind exchange to exchange with
BoundTo
extension - Declare alternate exchange with
AlternateTo
extension - Add custom arguments with
WithArgument
extension - Declare exchange with
AddDirectExchange(...)
,AddFanoutExchange(...)
,AddHeadersExchange(...)
,AddTopicExchange(...)
extensions
Consumers
- Create
IRabbitMqConsumer<TPayload>
- Tag consumers using
Tagged
extension - Limit prefetch count with
Prefetch
extension - Scale consumers by using
Count
extension - Declare exclusive consume with
Exclusive
extension - Forbid to consume own producers with
NoLocal
extension - When no need to ack explicitly use
AutoAck
extension - Requeue messages on fail with
Requeue
extension - Set consumer priority with
Priority
extension - Add custom arguments with
WithArgument
extension - All consumers start in
IHostedService
- Use
IRabbitMQConsumerFactory
for custom message handling
Producers
- Inject
IRabbitMQProdicer<TPayload>
and useProduce
orBatchProduce
- Set routing key
RoutingKey
extension - Set mandatory with
Mandatory
extension - Set message priority with
Priority
extension - Set message ttl with
MessageTimeToLive
extension - Use channel transactional mode with
Transactional
extension - Use channel confirm mode with
WaitForConfirms
extension - Use message persistence with
Persistent
extension - Configure headers with
WithHeader
extension - Configure properties with
WithProperty
extension - Use
IRabbitMQProducerFactory
for custom message handling
Limitations
- Uses only
Microsoft.Extensions.DepencencyInjection
package - No dynamic topology declaration by design, but you can use
IRabbitMQConnectionFactory
for that - No
.Redeclared()
and.Purged()
because it breaks consistenty- Deploy
first_node
- Purge
queue
first_node
starts produce messages- Deploy
second_node
- Purge
queue
- No
first_node
messages survived
- Deploy
- There is a problem when one type of payload is used in different producers, so
IRabbitMQProducer<TPayload>
abstraction leak ðŸ˜
Tips
RoutingKey
isQueue.Name
by default- Do not use same group(connection) for consumers and producers
IRabbitMQConnectionFactory
- singleton dependency inIServiceProvider
per instance for custom connections- If queue or exchange is default or exists, binding goes withot declaration
- Used
ISerializer
fromPhema.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. |
.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 |
---|