Subscribe Event
The data collector provides API to let an event consumer subscribe to a certain list of events. A callback function must be provided so the DataCollector can notify and call the specified callback. The callback function should be non-blocking and return quickly.
Subscribe Event
| Subscribe Method Parameters |
Details |
| consumerWithName name: String |
Set the consumer name as an identifier for DataCollector |
| forEventTypes types: [TNEventType] |
Set the list of event types to subscribe to |
| withCallBack block: @escaping (_ occurredEvent: TNEvent)->() |
Set the callback function which should be implemented |
This method returns an error (TNDataCollectorResponse) in case of consumer name is empty (.emptyConsumerName), consumer with given name was already added for given types (.existedConsumerForType) or list of event types is empty (.emptyTypes). It returns .success in case of successful adding of subscriber.