Показать сообщение отдельно
Старый 30.09.2018, 15:14   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
dynamicsnavax: Send to Azure Service Bus in #MSDyn365FO
Источник: http://dynamicsnavax.blogspot.com/20...sdyn365fo.html
==============

Sending a message to Azure Service Bus is really simple in FinOps.

Below is the job I wrote to send a message to the service bus. It takes a connection string and a queue name for connecting. The message string and key value pair list can be supplied to the properties.



static str connectionString = 'Endpoint=sb://navaxservicebus.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=h5KwXSEFIHxxxxxxxxxxxxxxxxxx';
static str queueName = 'navaxqueue';

///
/// Runs the class with the specified arguments.
///
/// The specified arguments.
public static void main(Args _args)
{
if (connectionString && queueName)
{
Microsoft.ServiceBus.Messaging.QueueClient queueClient = Microsoft.ServiceBus.Messaging.QueueClient::CreateFromConnectionString(connectionString, queueName);
Microsoft.ServiceBus.Messaging.BrokeredMessage brokeredMessage = new Microsoft.ServiceBus.Messaging.BrokeredMessage("My Message");

var properties = brokeredMessage.Properties;

properties.Add("MyKey1", "MyValue1");
properties.Add("MyKey2", "MyValue2");

queueClient.Send(brokeredMessage);
}
}
Using Service Bus Explorer you can see the result.



At the moment Microsoft is working on event based triggers. One of the possible solutions they presented was writing to the service bus. Looking forward to it.

I took inspiration from one of the standard classes I noticed in in 8PU15. It subscribes to the insert/delete of a user record to send the user detail to a service bus. The big bonus is that service bus assembles are included on the machine. I won’t dive any deeper into this class in this blog post.





Источник: http://dynamicsnavax.blogspot.com/20...sdyn365fo.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.