
from moksha.api.hub import Consumer

class MokshaMessageMetricsConsumer(Consumer):
    """
    This consumer listens to all messages on the `moksha_message_metrics`
    topic, and relays the message to the message.body['topic'] topic.
    """
    topic = 'moksha_message_metrics'

    def consume(self, message):
        self.send_message(message['topic'], message['data'])


from moksha.api.hub import Consumer

class MokshaMessageMetricsConsumer(Consumer):
    """
    This consumer listens to all messages on the `moksha_message_metrics`
    topic, and relays the message to the message.body['topic'] topic.
    """
    topic = 'moksha_message_metrics'

    def consume(self, message):
        self.send_message(message['body']['topic'], message['body']['data'])

Fix the data format of our metrics consumer
Fix the data format of our metrics consumer

  
  from moksha.api.hub import Consumer
  
  class MokshaMessageMetricsConsumer(Consumer):
      """
      This consumer listens to all messages on the `moksha_message_metrics`
      topic, and relays the message to the message.body['topic'] topic.
      """
      topic = 'moksha_message_metrics'
  
      def consume(self, message):
-         self.send_message(message['topic'], message['data'])
+         self.send_message(message['body']['topic'], message['body']['data'])
  
Fix the data format of our metrics consumer
## Code Before:

from moksha.api.hub import Consumer

class MokshaMessageMetricsConsumer(Consumer):
    """
    This consumer listens to all messages on the `moksha_message_metrics`
    topic, and relays the message to the message.body['topic'] topic.
    """
    topic = 'moksha_message_metrics'

    def consume(self, message):
        self.send_message(message['topic'], message['data'])

## Instruction:
Fix the data format of our metrics consumer
## Code After:

from moksha.api.hub import Consumer

class MokshaMessageMetricsConsumer(Consumer):
    """
    This consumer listens to all messages on the `moksha_message_metrics`
    topic, and relays the message to the message.body['topic'] topic.
    """
    topic = 'moksha_message_metrics'

    def consume(self, message):
        self.send_message(message['body']['topic'], message['body']['data'])
