Last active
October 24, 2020 17:17
-
-
Save subhendu-de/c084cf86b124237ad4fe74203393906e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void Main(string[] args) { | |
try { | |
string sbconnectionString = ConfigurationManager.AppSettings["Microsoft.ServiceBus.ConnectionString"]; | |
ServiceBusEnvironment.SystemConnectivity.Mode = ConnectivityMode.AutoDetect; | |
var namespaceManager = NamespaceManager.CreateFromConnectionString(sbconnectionString); | |
var src_queueName = "source_queue"; | |
var dest_queueName = "destination_queue"; | |
// var dest_queueName = "destination_queue/$deadletterqueue"; | |
QueueClient src_queue = MessagingFactory.CreateFromConnectionString(sbconnectionString).CreateQueueClient(src_queueName, ReceiveMode.ReceiveAndDelete); | |
QueueClient dest_queue = MessagingFactory.CreateFromConnectionString(sbconnectionString).CreateQueueClient(dest_queueName, ReceiveMode.ReceiveAndDelete); | |
while (true) { | |
var message = src_queue.Receive(TimeSpan.FromSeconds(5)); | |
if (message != null) { | |
// var clonemsg = message.Clone(); | |
// dest_queue.Send(clonemsg); | |
dest_queue.Send(message); | |
Console.WriteLine("Message Read successfully!"); | |
} | |
else { | |
Console.WriteLine("Polling, polling, polling..."); | |
} | |
} | |
} | |
catch(Exception ex) { | |
Console.WriteLine(ex.Message); | |
throw; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment