"A message was already published on this channel with the same confirmation number"

rabbitmq
sagas

(Alireza) #1

I use NServicebus 7.x, I implement a scenario with saga and in one step I should try the same step about 5 times . I send message with DelayDelivery to that step, but after a period of time when delayed messages reaches the main queue I receive the error “A message was already published on this channel with the same confirmation number”
I use RabbitMq as Transport.
The program should process 100000 saga instance per hour.
The configuration is :

var config = new EndpointConfiguration(setting.Name);
config.SendFailedMessagesTo(setting.ErrorQueue);

var recoverability = config.Recoverability();
recoverability.Delayed(
delayed =>
{
      delayed.NumberOfRetries(0);
});

var timeoutManager = config.TimeoutManager();
timeoutManager.LimitMessageProcessingConcurrencyTo(50);

config.UseSerialization<NewtonsoftSerializer>();
config.LimitMessageProcessingConcurrencyTo(50);

var persistence = config.UsePersistence<SqlPersistence>();
var transport = config.UseTransport<RabbitMQTransport>();
transport.UseDirectRoutingTopology();
transport.ConnectionString(Configuration.GetConnectionString("RabbitMqConnectionString"););
transport.Transactions(TransportTransactionMode.ReceiveOnly);

config.EnableInstallers();

(Ramon Smits) #2

Do you have additional details like a stack trace containing all exception details?

You also have hidden a second question in there related to performance:

The program should process 100000 saga instance per hour."

Without knowing any system details this is hard to answer. Are you currently having performance issues?

You are specifically stating saga instances which means about 25 instances need to be updated every second continuously. To achieve this you must make sure that your storage and network performance are sufficient.


(Alireza) #3

The stack trace is:

2018-12-29 13:07:02.897 INFO NServiceBus.RecoverabilityExecutor Immediate Retry is going to retry message ‘0fc0b607-b176-44df-b116-067fd320b95b’ because of an exception:
System.Exception: Cannot publish a message with sequence number ‘8126’ on this channel. A message was already published on this channel with the same confirmation number.
at NServiceBus.Transport.RabbitMQ.ConfirmsAwareChannel.GetConfirmationTask()
at NServiceBus.Transport.RabbitMQ.ConfirmsAwareChannel.SendMessage(String address, OutgoingMessage message, IBasicProperties properties)
at NServiceBus.Transport.RabbitMQ.MessageDispatcher.SendMessage(UnicastTransportOperation transportOperation, ConfirmsAwareChannel channel)
at NServiceBus.Transport.RabbitMQ.MessageDispatcher.Dispatch(TransportOperations outgoingMessages, TransportTransaction transaction, ContextBag context)
at NServiceBus.ForkExtensions.Fork[TFromContext,TToContext,TForkContext](IForkConnector3 forkConnector, TForkContext context) at NServiceBus.TransportReceiveToPhysicalMessageProcessingConnector.Invoke(ITransportReceiveContext context, Func2 next)
at NServiceBus.MainPipelineExecutor.Invoke(MessageContext messageContext)
at NServiceBus.Transport.RabbitMQ.MessagePump.Process(BasicDeliverEventArgs message)

Also, there is no problem with storage and network. The thing that should be considered is that we run several consumer to handle saga instances.


(Brandon Ording) #4

If you look at your log files, are there any other errors logged before the first Cannot publish a message with sequence number entry?


(Ramon Smits) #5

@arezoomand have you resolved your issue?