Below is the code i am using to create message
var NserviceBusTestendpointConfiguration = new EndpointConfiguration(endpointName: "NserviceBusTest");
NserviceBusTestendpointConfiguration.SendFailedMessagesTo("NserviceBusTestErrors");
NserviceBusTestendpointConfiguration.UseSerialization<XmlSerializer>();
NserviceBusTestendpointConfiguration.EnableInstallers();
NserviceBusTestendpointConfiguration.UseTransport<MsmqTransport>();
NserviceBusTestendpointConfiguration.UsePersistence<MsmqPersistence>();
NserviceBusTestendpointConfiguration.DisableFeature<TimeoutManager>();
NserviceBusTestendpointInstance = await Endpoint.Start(NserviceBusTestendpointConfiguration).ConfigureAwait(false);
try
{
NServiceBusInfo gInfo = new NServiceBusInfo(Guid.NewGuid());
//gInfo.JSonValue = strFitBitData;
gInfo.RequestDateTime = DateTime.Now;
await endpointInstance.SendLocal(gInfo)
.ConfigureAwait(false); // Send the object to process
}
catch (Exception ex)
{
ExceptionlessClient.Default.CreateException(ex);
}
finally
{
await NserviceBusTestendpointInstance.Stop().ConfigureAwait(false);
}
and below is the code for processing the message
class ProcessMessage : IHandleMessages<NServiceBusInfo>
{
static Random random = new Random();
public Task Handle(NServiceBusInfo message, IMessageHandlerContext context)
{
throw new Exception("Oops");
return Task.FromResult(0);
}
}
I am explicitly throwing exception here but the retry mechanism is not working, the message stays in the same queue ? Can someone throw light if there is anything wrong with the configuration.