jegesh / python-sqs-listener

A simple wrapper for boto3 for listening, and sending, to an AWS SQS queue
Other
154 stars 72 forks source link

Unable to parse message - JSON is not formatted properly #45

Closed nilsbuer closed 3 years ago

nilsbuer commented 3 years ago

Hi, I want to poll an SQS queue for new messages. I run the listener directly not as demaon.

I get the following error:

2020-11-13 10:03:26,975 - INFO - 1 messages received 2020-11-13 10:03:26,975 - WARNING - Unable to parse message - JSON is not formatted properly

I used your code from the example you provide:

` from sqs_listener import SqsListener

class MyListener(SqsListener): def handle_message(self, body, attributes, messages_attributes): print ("In handle_message")

listener = MyListener('Orders',error_queue='orders-dead-letter-queue',region_name='eu-central-1') listener.listen() `

Do you know what I am missing in my code? I read in one of your threads your comment "override in a subclass". Can you give an example for that?

nilsbuer commented 3 years ago

My Problem was that my message body did not have the correct JSON format An example for a working message example is message body: {"Name":"Peter"}