Issue with DuplicateDetectionHistoryTimeWindow when trying to send message to service bus topic

Lisa Palathingal 6 Reputation points Microsoft Employee
2021-03-05T18:32:18.177+00:00

I have a C# code to send a message to the service bus topic as follows:

public class ServiceBusTopicsRepository : IServiceBusTopicsRepository
{
    private TopicClient _topicClient;

    public ServiceBusTopicsRepository(string connectionString, string entityPath)
    {
        _topicClient = new TopicClient(connectionString, entityPath);
    }

    public async Task AddMessageAsync(SyncJob job)
    {
        await _topicClient.SendAsync(CreateMessage(job));
    }

    private Message CreateMessage(SyncJob job)
    {
        var body = JsonSerializer.Serialize(job);
        var message = new Message
        {
            Body = Encoding.UTF8.GetBytes(body)
        };

        message.MessageId ="PK_RK";
        return message;
    }
}

On running the code, I see message is not being added to the topic.

MessageId is "PK_RK". DuplicateDetectionHistoryTimeWindow is 1 min

image

When I try to send message after 2 minutes, I see newly sent message is instantly ignored and dropped. Why is that?

Azure Service Bus
Azure Service Bus
An Azure service that provides cloud messaging as a service and hybrid integration.
594 questions
{count} votes

1 answer

Sort by: Most helpful
  1. MayankBargali-MSFT 70,011 Reputation points
    2021-03-15T04:29:53.603+00:00

    The issue is not reproduced with the official service bus SDKs. The scenario is working as expected. If anyone is facing the issue please tag me in so I can look into the source code, configuration, and if there is any issue with the backend.

    0 comments No comments