Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var converter = ConfigurationUpdateEventConverter.Instance;
- ConfigurationUpdateEvent configEvent = new ConfigurationUpdateEvent
- {
- Key = message["guid"].ToString(), //uid or field that are updated
- ModuleId = "moduleId", //can be ignore for now
- ModuleVersion = "moduleVer", // can be ignore for now
- 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.
- };
- MessageBuilder messageBuilder = new MessageBuilder();
- converter.ConvertFromMessage(configEvent, messageBuilder);
- byte[] messageBytes = messageBuilder.GetMessageBytes();
- ConnectionFactory factory = new ConnectionFactory() { HostName = "vpms3demo.westeurope.cloudapp.azure.com", Port = 5672, UserName = "VPMS_Platform", Password = "VPMS_Platform" }; //{ HostName = hostname };
- using (var connection = factory.CreateConnection())
- using (var channel = connection.CreateModel())
- {
- channel.QueueDeclare(queue: "ConfigurationUpdateEvents", durable: false, exclusive: false, autoDelete: false, arguments: null);
- channel.BasicPublish(exchange: "", routingKey: "ConfigurationUpdateEvents", basicProperties: null, body: messageBytes);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement