I'm adding a message to my Azure service bus queue and returning its Guid to save in a db, but for some reason I either modified something or it never worked correctly in the first place. Question - can I have multiple message id's with the same id the different queues but on the same bus? I have 5 queues on the same bus and each queue might have a message with an message id of ex. 100
var sequenceToCancel = await queueClient.ScheduleMessageAsync(message, endTime);
doesn't return anything!
And the whole stack trace kinda just poops out without finishing anything above in the code stack!
The message is put into the service bus queue but the method doesn't return! I tried putting a try catch around it but that didn't do anything and no exception gets thrown up the stack in the controller. The whole stack all the way up to the controller just kinda poops out! So no code after this method in the controller gets run.
What would cause this and how can I check to see if there are any errors anywhere?
Here is the full method.
public async Task < long > CreatePostEventEmailMessage(int eventId, DateTime eventDateTime, YogaSpaceDuration duration, DateTime utcEventDateTime) {
string serviceBusConnectionString = System.Configuration.ConfigurationManager.AppSettings["ServiceBusConnectionString"];
string queueName = System.Configuration.ConfigurationManager.AppSettings["PostEventEmailQueueName"];
var queueClient = QueueClient.CreateFromConnectionString(serviceBusConnectionString, queueName);
int length = Convert.ToInt32(EnumHelper.GetDisplayName(duration).Split(' ')[0]); // end of class
var endTime = DateTime.SpecifyKind(utcEventDateTime.AddMinutes(length).AddMinutes(1), DateTimeKind.Utc);
BrokeredMessage message = new BrokeredMessage(eventId.ToString());
message.MessageId = eventId.ToString();
message.ScheduledEnqueueTimeUtc = endTime;
var sequenceToCancel = await queueClient.ScheduleMessageAsync(message, new DateTimeOffset(endTime));
await queueClient.CloseAsync(); // this line never gets hit
return sequenceToCancel; // this line never gets hit
}
FYI - funny thing is just above this method I have another method that does the same thing on another queue and it works fine! So I'm looking to see if something has a misspelled name or is configured incorrectly, but what's frsutrating is if that is the case I would think that I would see an exception or the message wouldn't be placed on the queue?