diff --git a/modules/core/channels.py b/modules/core/channels.py index 23b299be84018cfa39e6e1c76e2d014d2e1b7818..c7976a918a142f0fcd49cb48250d654d6a216183 100644 --- a/modules/core/channels.py +++ b/modules/core/channels.py @@ -131,6 +131,7 @@ class ChannelRouter(): Args: config (AuraConfig): The configuration + logger (Logger): The logger """ self.config = config self.logger = logger @@ -167,6 +168,24 @@ class ChannelRouter(): return self.active_channels[channel_type] + def type_of_channel(self, channel): + """ + Retrieves a `ChannelType` for the given `Channel`. + """ + if channel in ChannelType.QUEUE.channels: + return ChannelType.QUEUE + elif channel in ChannelType.FALLBACK_QUEUE.channels: + return ChannelType.FALLBACK_QUEUE + elif channel in ChannelType.HTTP.channels: + return ChannelType.HTTP + elif channel in ChannelType.HTTPS.channels: + return ChannelType.HTTPS + elif channel in ChannelType.LIVE.channels: + return ChannelType.LIVE + else: + return None + + def type_for_resource(self, resource_type): """ Retrieves a `ChannelType` for the given `ResourceType`.