Renamed StaticQueue attribute to DurableQueue to match RabbitMQ terminology (breaking change)
Changed default delivery mode to persistent
This commit is contained in:
parent
120108bd41
commit
eb017e7b63
@ -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;
|
||||
}
|
@ -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.
|
||||
|
@ -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())
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user