Skip to content

Getting a FabricElementAlreadyExistsException on ServiceRemotingMessageHeaders.AddHeader() #280

@wouterroos

Description

@wouterroos

Hi,

I have the following implementation of IServiceRemotingClient to add a header to the IServiceRemotingRequestMessage instance:

public class SetOperationContextServiceRemotingClient : IServiceRemotingClient
{
    //other IServiceRemotingClient members ommitted for brevity

    public Task<IServiceRemotingResponseMessage> RequestResponseAsync(IServiceRemotingRequestMessage requestRequestMessage)
    {
        var message = //build message
        
        requestRequestMessage.GetHeader().AddHeader("MyMessageHeader", Encoding.ASCII.GetBytes(message));
        return InnerClient.RequestResponseAsync(requestRequestMessage);
    }
}    

This works perfectly in all our tests and local cluster but recently we occasionally get a FabricElementAlreadyExistsException which states: 'Header with name 'MyMessageHeader' already exists'. This issue seems to occur when the call to the service fails due to some reason so my guess is that a retry mechanism is at work here. Is this correct, and if so, should I implement IServiceRemotingClient.RequestResponseAsync() to be idempotent to prevent this issue?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions