1
0
mirror of synced 2024-06-26 14:27:38 +00:00

Renamed StaticQueue attribute to DurableQueue to match RabbitMQ terminology (breaking change)

Changed default delivery mode to persistent
This commit is contained in:
Mark van Renswoude 2017-02-12 19:15:56 +01:00
parent 120108bd41
commit eb017e7b63
4 changed files with 11 additions and 8 deletions

View File

@ -12,12 +12,12 @@ namespace Tapeti.Annotations
/// for deploy-time management of durable queues (shameless plug intended).
/// </remarks>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
public class StaticQueueAttribute : Attribute
public class DurableQueueAttribute : Attribute
{
public string Name { get; set; }
public StaticQueueAttribute(string name)
public DurableQueueAttribute(string name)
{
Name = name;
}

View File

@ -46,7 +46,7 @@
<Compile Include="MessageControllerAttribute.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RequestAttribute.cs" />
<Compile Include="StaticQueueAttribute.cs" />
<Compile Include="DurableQueueAttribute.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

View File

@ -137,9 +137,12 @@ namespace Tapeti.Connection
return taskQueue.Value.Add(async () =>
{
var messageProperties = properties ?? new BasicProperties();
if (messageProperties.Timestamp.UnixTime == 0)
if (!messageProperties.IsTimestampPresent())
messageProperties.Timestamp = new AmqpTimestamp(new DateTimeOffset(DateTime.UtcNow).ToUnixTimeSeconds());
if (!messageProperties.IsDeliveryModePresent())
messageProperties.DeliveryMode = 2; // Persistent
var body = messageSerializer.Serialize(message, messageProperties);
(await GetChannel())

View File

@ -291,16 +291,16 @@ namespace Tapeti
protected QueueInfo GetQueueInfo(MemberInfo member)
{
var dynamicQueueAttribute = member.GetCustomAttribute<DynamicQueueAttribute>();
var staticQueueAttribute = member.GetCustomAttribute<StaticQueueAttribute>();
var durableQueueAttribute = member.GetCustomAttribute<DurableQueueAttribute>();
if (dynamicQueueAttribute != null && staticQueueAttribute != null)
if (dynamicQueueAttribute != null && durableQueueAttribute != null)
throw new TopologyConfigurationException($"Cannot combine static and dynamic queue attributes on {member.Name}");
if (dynamicQueueAttribute != null)
return new QueueInfo { Dynamic = true };
if (staticQueueAttribute != null)
return new QueueInfo { Dynamic = false, Name = staticQueueAttribute.Name };
if (durableQueueAttribute != null)
return new QueueInfo { Dynamic = false, Name = durableQueueAttribute.Name };
return null;
}