openfaas / connector-sdk

SDK for connecting events to functions
MIT License
54 stars 25 forks source link

Add Topics function to TopicMap #13

Closed tessellator closed 5 years ago

tessellator commented 5 years ago

The kafka-connector project added a Topics function to TopicMap after the code was pulled into the connector-sdk project. I am currently working on migrating the Kafka connector onto the connector SDK and would like this function to be available as part of the SDK. I think the function would also be useful to other connectors.

However, I do think there is one problem with pulling the function in as-is. To access the current list of topics, a connector would use controller.TopicMap.Topics(). I would argue that this promotes inappropriate intimacy between the connector and the TopicMap, and that an additional function should be added to Controller to get the current list of topics, perhaps also named Topics. This was not an issue in the kafka-connector because it interacted with a TopicMap directly.

Do you think this is an appropriate change for the SDK?