Advertisement
Guest User

Untitled

a guest
Mar 14th, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.11 KB | None | 0 0
  1.  var converter = ConfigurationUpdateEventConverter.Instance;
  2.                 ConfigurationUpdateEvent configEvent = new ConfigurationUpdateEvent
  3.                 {
  4.                     Key = message["guid"].ToString(), //uid or field that are updated
  5.                     ModuleId = "moduleId", //can be ignore for now
  6.                     ModuleVersion = "moduleVer", // can be ignore for now
  7.                     Value = JsonConvert.SerializeObject(message) // "{'guid':'801fbb8f-4bcd-94df-771b-74c731b6f9cb','name':'WF3','label':'label 3','workFlow':null,'isActive':true,'mediaSsc':{'server':{'guid':'','name':'localhost'},'storage':'shared','channel':'smb'},'metadataSsc':{'server':{'guid':'','name':''},'storage':'','channel':''},'isMetaEnabled':false,'fileTypesTowatch':'','monitorDeletion':false,'startWorkflow':'','xsltData':'','serverGuid':''},{'guid':'9a4a8551-9c01-b519-de93-516fe56c8c65','name':'WF1','label':'label','workFlow':null,'isActive':true,'mediaSsc':{'server':{'guid':'','name':'localhost'},'storage':'shared','channel':'smb'},'metadataSsc':{'server':{'guid':'','name':''},'storage':'','channel':''},'isMetaEnabled':false,'fileTypesTowatch':'','monitorDeletion':false,'startWorkflow':'','xsltData':'','serverGuid':'new server'},{'guid':'4ba03e6c-b7d3-e16e-f408-2c930a1d3484','name':'WF 5','label':'label','workFlow':null,'isActive':true,'mediaSsc':{'server':{'guid':'','name':'localhost'},'storage':'shared','channel':'smb'},'metadataSsc':{'server':{'guid':'','name':''},'storage':'','channel':''},'isMetaEnabled':false,'fileTypesTowatch':'','monitorDeletion':false,'startWorkflow':'','xsltData':'','serverGuid':'7fc25436-33cb-6a97-d7c6-ef8b50b82605'},{'guid':'74a7caa6-8c20-2a2b-7742-db6b4b97e5c5','name':'WF 7','label':'label 3','workFlow':null,'isActive':true,'mediaSsc':{'server':{'Guid':'','Name':''},'storage':'','channel':'smb'},'metadataSsc':{'server':{'Guid':'','Name':''},'storage':'','channel':''},'isMetaEnabled':false,'fileTypesTowatch':'','monitorDeletion':false,'startWorkflow':'','xsltData':'','mediaServerGuid':'5ce58004-d7b7-fc8f-8703-d73d652283ad','mediaStorageGuid':'00000000-0000-0000-0000-000000000000'}" // value of this config, however we now get latest config directly with the provided key of this message.
  8.                 };
  9.                 MessageBuilder messageBuilder = new MessageBuilder();
  10.                 converter.ConvertFromMessage(configEvent, messageBuilder);
  11.                 byte[] messageBytes = messageBuilder.GetMessageBytes();
  12.  
  13.                 ConnectionFactory factory = new ConnectionFactory() { HostName = "vpms3demo.westeurope.cloudapp.azure.com", Port = 5672, UserName = "VPMS_Platform", Password = "VPMS_Platform" }; //{ HostName = hostname };
  14.                 using (var connection = factory.CreateConnection())
  15.                 using (var channel = connection.CreateModel())
  16.                 {
  17.                     channel.QueueDeclare(queue: "ConfigurationUpdateEvents", durable: false, exclusive: false, autoDelete: false, arguments: null);
  18.                     channel.BasicPublish(exchange: "", routingKey: "ConfigurationUpdateEvents", basicProperties: null, body: messageBytes);
  19.                 }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement