Пример #1
0
 public EventHubMessageSender(IMessageExchnage <TMsg> messageExchnage, IConverter <TMsg, object> dataConverter, Dictionary <string, object> settings)
 {
     _messageExchange = messageExchnage;
     _dataConverter   = dataConverter;
     _eventHubConfig  = new Dictionary <string, string>();
     _settings        = settings;
 }
Пример #2
0
        /// <summary>
        /// All the following fields are mandatory; the data type of all the fields are string type
        /// settings.ServiceBusNameSpace, settings.EventHubName, settings.EventHubConnectionString
        /// </summary>
        /// <param name="settings"></param>
        public void Initialize(Dictionary <string, object> settings)
        {
            string[] fieldNames = new string[] { "EventHubConfigFile", "MessageExchange", "TagToEventDataConverter" };

            //validates missing fields and throws ValidationException in case of errors. Let us not catch it here so as to avoid
            //passing it through multiple layers
            FieldValidator.CheckMissingFields(settings, fieldNames);
            string eventHubConfigFile = settings.GetValueOrNull("EventHubConfigFile") as string;

            _eventHubConfig  = ConfigUtility.ReadConfig <Dictionary <string, string> >(eventHubConfigFile);
            _messageExchange = settings.GetValueOrNull("MessageExchange") as IMessageExchnage <TMsg>;
            _dataConverter   = settings.GetValueOrNull("TagToEventDataConverter") as IConverter <TMsg, object>;
        }
Пример #3
0
 public EventHubMessageSender(IMessageExchnage <TMsg> messageExchnage)
 {
     _messageExchange = messageExchnage;
     _eventHubConfig  = new Dictionary <string, string>();
 }