Skip to content

Commit

Permalink
#39: Change arrival to rxmqarrival to distinquish lib data
Browse files Browse the repository at this point in the history
  • Loading branch information
toka-p committed Jan 9, 2023
1 parent 63346b5 commit 7fbc01e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ await publisher.SendAsync(new TestMessageForTopic
.Timeout(TimeSpan.FromSeconds(10))
.FirstAsync();

Assert.Null(receivedMessage.Arrival);
Assert.Null(receivedMessage.RxMqArrival);
}
[Fact]
public async void WhenSettingTrue_MessagesContainArrivalTimeStamp()
Expand All @@ -163,7 +163,9 @@ await publisher.SendAsync(new TestMessageForTopic
.Timeout(TimeSpan.FromSeconds(10))
.FirstAsync();

Assert.NotNull(receivedMessage.Arrival);
var yesterday = DateTimeOffset.UtcNow.AddDays(-1).ToUnixTimeMilliseconds();
Assert.NotNull(receivedMessage.RxMqArrival);
Assert.True(receivedMessage.RxMqArrival > yesterday);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System;
using Protacon.RxMq.Abstractions;
using Newtonsoft.Json;
using Protacon.RxMq.Abstractions.DefaultMessageRouting;

namespace Protacon.RxMq.AzureServiceBus.Tests.Messages
Expand All @@ -10,6 +10,8 @@ public class TestMessageForTopic: ITopicItem
public string Something { get; set; }
public string TenantId { get; set; }
public string TopicName => "v1.testtopic";
public long? Arrival { get; set; }

[JsonProperty("rxmqarrival")]
public long? RxMqArrival { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ private static T AsObject(string body, long arrival, bool addArrival = false)
throw new InvalidOperationException("Library expects data wrapped as { data: { ... } }");

if (addArrival) {
parsed["data"]["arrival"] = arrival;
parsed["data"]["rxmqarrival"] = arrival;
}

return parsed["data"].ToObject<T>();
Expand Down

0 comments on commit 7fbc01e

Please sign in to comment.