public bool Send(IMessage message) { IProducer producer; if (!producerContainer.ContainsKey(message.Headers[BuiltinKeys.Topic])) { MessagingAccessPoint accessPoint = MessagingAccessPointFactory.getMessagingAccessPoint(); Dictionary <string, string> properties = new Dictionary <string, string>(); if (message.Headers.TryGetValue(BuiltinKeys.Exchange, out string exchange)) { properties.Add(BuiltinKeys.Exchange, exchange); } if (message.Headers.TryGetValue(BuiltinKeys.Topic, out string topic)) { properties.Add(BuiltinKeys.Topic, topic); } producer = accessPoint.createProducer(properties); producer.startup(); producerContainer.TryAdd(message.Headers[BuiltinKeys.Topic], producer); } else { producer = producerContainer[message.Headers[BuiltinKeys.Topic]]; } return(producer.Send(message)); }
public bool Send(IMessage message) { IProducer producer; if (!producerContainer.ContainsKey(message.Headers[BuiltinKeys.Topic])) { MessagingAccessPoint accessPoint = MessagingAccessPointFactory.getMessagingAccessPoint(configuration.GetConnectionString("MTConnectionString")); producer = accessPoint.createProducer(message.Headers); producer.startup(); producerContainer.TryAdd(message.Headers[BuiltinKeys.Topic], producer); } else { producer = producerContainer[message.Headers[BuiltinKeys.Topic]]; } return(producer.Send(message)); }