I am exploring options to move to sql server transport from MSMQ. (using NSB 7.3.0
). So bear with me on my questions. Couldn’t find anything else other than manual unsubscribe.
Autosubscribe is enabled and active.
public interface RequisitionSubmitted : IEvent
{
Guid OrderId { get; set; }
}
public interface OrderSubmitted : RequisitionSubmitted {}
public interface TransferSubmitted : RequisitionSubmitted {}
Sender: endpointInstance.Publish<OrderSubmitted>(evt => evt.OrderId = orderSubmitted.OrderId);
V1 of the handler
public class OrderSubmittedHandler : IHandleMessages<OrderSubmitted>
{
public Task Handle(OrderSubmitted message, IMessageHandlerContext context)
{
var orderAccepted = new OrderAccepted { OrderId = message.OrderId };
return context.Reply(orderAccepted);
}
}
V2 of the handler
public class OrderSubmittedHandler : IHandleMessages<RequisitionSubmitted>
{
public Task Handle(RequisitionSubmitted message, IMessageHandlerContext context)
{
var orderAccepted = new OrderAccepted { OrderId = message.OrderId };
return context.Reply(orderAccepted);
}
}
My issue is after V2 is deployed subscription table will have 2 entries. Hence, OrderSubmittedHandler will be invoked twice for an event
#Subscription Table
QueueAddress Endpoint Topic
Samples.Sql.Receiver@[receiver]@[NsbSamplesSql] Samples.Sql.Receiver OrderSubmitted
Samples.Sql.Receiver@[receiver]@[NsbSamplesSql] Samples.Sql.Receiver RequisitionSubmitted
Any recommendation on how to clean up the subcription table? Is there a built-in functionality or do we have to clean up subscriptions before the endpoint is up and running?