Hello All,
I have a scenario to pick all the available Files (Invoice files) from Azure service bus queue and process the file inside D365 FO.
As of now with the code below I am able to pick 1 file(First file)
For Example if the Queue has 5 Invoice files, my code should pick 5 invoice files together and process it.
.Net code to read message: class name /AzureQueueLibrary/
public class ReceiveAzureQueue
{
QueueClient queueClient;
BrokeredMessage message;
public void connect(string connectionString)
{
queueClient = QueueClient.CreateFromConnectionString(connectionString, ReceiveMode.PeekLock);
}
public Stream readMessage()
{
message = queueClient.Receive();
var stream = message.GetBody<Stream>();
return (stream);
}
public void completeMessage()
{
queueClient.Complete(message.LockToken);
}
public void close()
{
queueClient.Close();
}
}
D365 Code to process the file:AzureQueueLibrary.ReceiveAzureQueue ReceiveAzureQueue = new AzureQueueLibrary.ReceiveAzureQueue();
ReceiveAzureQueue.connect(connectionString);
var stream = ReceiveAzureQueue.readMessage();
Above readMessage() picks only first file now. How to check the count of files and get all the files into D365 and process the same.
Let me know if any sample code/reference available
Regards,
Monika