-
Notifications
You must be signed in to change notification settings - Fork 300
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6913 from Particular/add-rabbit-customization-docs
Add docs about NativeOutgoingMessageCustomization in RabbitMQ
- Loading branch information
Showing
5 changed files
with
45 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
Snippets/Rabbit/Rabbit_9.2/OutgoingNativeMessageCustomization.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using NServiceBus; | ||
|
||
class OutgoingNativeMessageCustomization | ||
{ | ||
OutgoingNativeMessageCustomization(EndpointConfiguration endpointConfiguration) | ||
{ | ||
#region rabbitmq-customize-outgoing-message | ||
|
||
var rabbitMqTransport = new RabbitMQTransport( | ||
routingTopology: RoutingTopology.Conventional(QueueType.Classic), | ||
connectionString: "host=localhost;username=rabbitmq;password=rabbitmq", | ||
enableDelayedDelivery: false | ||
); | ||
|
||
rabbitMqTransport.OutgoingNativeMessageCustomization = (operation, properties) => | ||
{ | ||
//Set values on IBasicProperties | ||
properties.ContentType = "application/my-type"; | ||
}; | ||
|
||
#endregion | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<PackageReference Include="NServiceBus.RabbitMQ" Version="9.2.*" /> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
...rts/rabbitmq/native-integration_outgoing-customization_rabbit_[9.2,).partial.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
### Access to the native RabbitMQ message details prior to sending | ||
|
||
When integrating with other software systems it might be necessary to customize the native RabbitMQ message immediately before sending it to the broker. This can be done by registering a callback that gets invoked for each message as a last step before handing the message to the RabbitMQ client SDK. | ||
|
||
snippet: rabbitmq-customize-outgoing-message |