Post Custom Message to Azure Service Bus Queue RRS feed

  • Question

  • Hi,

    I need to post a custom brokered message to Azure Service bus queue on create of a contact

    My DTO looks like 

    Plublic Class Contact


    public string name {get;set;}

    public string lastname {get;set;}


    I tried using the below code

    var messagingFactory = MessagingFactory.CreateFromConnectionString("XXXXXXXXXXXXXXXXXXX");
                var queueClient = messagingFactory.CreateQueueClient("crmoutbound");
                var message = new BrokeredMessage(new Contact() { Status = "test status", Reason = "test reason" });

    but since it is online even if i ILmerge its giving me security exception.

    Is there any other alternative?

    Thanks in advance

    Friday, November 18, 2016 6:58 AM

All replies

  • try this code:-

                    var connectionString = "Endpoint=sb://££££££££.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=££££££££££££££££££££££££££££££££££££=";
                    NamespaceManager namespaceManager = NamespaceManager.CreateFromConnectionString(connectionString);
                    var queueName = "d3sbpcqcrmpoc3";
                    var client = QueueClient.CreateFromConnectionString(connectionString, queueName);
                    var message = new BrokeredMessage("Abid The Great1111");
                    message.Label = "Faisal The Great1111";
                    message.MessageId = "123456ertrt1";
                    message.SessionId = "123456678921";
                    message.Properties.Add("rpa_firstname", "Faisal1");
                    message.Properties.Add("rpa_lastname", "Fiaz1");
                    message.Properties.Add("rpa_birthdate", "16/06/1979");
                    message.ContentType = "RPA Case1";

    Regards Faisal

    • Edited by Faisal Fiaz Wednesday, November 23, 2016 1:18 PM
    Wednesday, November 23, 2016 1:17 PM