from geowatchutil.channel.base import GeoWatchChannelError, GeoWatchChannelTopic
[docs]class GeoWatchChannelSNS(GeoWatchChannelTopic):
@classmethod
[docs] def encode(self, message):
return message
@classmethod
[docs] def decode(self, message):
raise GeoWatchChannelError("GeoWatch only supports sending to SNS. GeoWatch cannot get messages from SNS.")
[docs] def send_message(self, message):
self._client._client.publish(
TopicArn=self.topic,
Message=message)
[docs] def send_messages(self, messages):
for message in messages:
self._client._client.publish(
TopicArn=self.topic,
Message=message)
[docs] def get_messages_raw(self, count, block=True, timeout=5):
raise GeoWatchChannelError("GeoWatch only supports sending to SNS. GeoWatch cannot get messages from SNS.")
def __init__(self, client, topic, mode, num_procs=1):
super(GeoWatchChannelSNS, self).__init__(client, topic, mode, num_procs=num_procs)