public async Task StartListening(TriggerConfig triggerInput) { // Configure the callback options OnMessageOptions options = new OnMessageOptions(); options.AutoComplete = false; options.MaxConcurrentCalls = 10; // create the relevant client and the onMessage listener if (triggerInput.QueueName != null && triggerInput.QueueName.Length > 1) { queueReceiver = messagingFactory.CreateQueueClient(triggerInput.QueueName, ReceiveMode.PeekLock); queueReceiver.OnMessageAsync(async message => { await processMessage(message, logMessageStub); }, options); isListening = true; } else { subscriptionReceiver = messagingFactory.CreateSubscriptionClient(triggerInput.TopicName, triggerInput.SubscriptionName, ReceiveMode.PeekLock); subscriptionReceiver.OnMessageAsync(async message => { await processMessage(message, logMessageStub); }, options); isListening = true; } }
/** 通过组初始化 */ public void init(int groupType, int groupID) { _configDic = TriggerConfig.getGroupDic(_groupType = groupType, _groupID = groupID); //没有配置 if (_configDic == null) { return; } TriggerConfigData[] values; TriggerConfigData v; for (int i = (values = _configDic.getValues()).Length - 1; i >= 0; --i) { if ((v = values[i]) != null) { if (v.isOpen) { openTrigger(v.id); } } } onInit(); //刚初始化好 triggerEvent(TriggerEventType.OnInit); }
private Trigger CreateTrigger(TriggerConfig triggerConfigConfig) { Type triggerClass = Type.GetType(triggerConfigConfig.ClassName()); Trigger trigger = (Trigger)triggerClass.GetConstructor(Type.EmptyTypes).Invoke(new object[] {}); trigger.SetEnv(defaultEnvironment); trigger.SetCookies(triggerConfigConfig.CookiesList()); return(trigger); }
public TriggerService(ILog log, TriggerConfig config) { _log = log; _config = config; _requirement = config.MinReq; }