Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
388 views
in Technique[技术] by (71.8m points)

scala - zio sqs message attributes

i, I have consume method like:

private def consume(queueUrl: String) =
        SqsStream(
          queueUrl,
          SqsStreamSettings(
            stopWhenQueueEmpty = false,
            waitTimeSeconds = Some(3),
            visibilityTimeout = Some(sqsConfig.visibilityTimeout),
            autoDelete = false,
            messageAttributeNames = List("TEST", AWSTraceHeader.unwrap.toString)
          )
        ).mapError(AwsError.fromThrowable)

and I send message to the queue:

aws sqs send-message --endpoint-url "https://sqs.eu-west-2.amazonaws.com/666" --queue-url "https://sqs.eu-west-2.amazonaws.com/666/queue-name" --message-body '{ "event_type": "create", "user_id": "666" }' --message-attributes "AWSTraceHeader={StringValue=TestTenant,DataType=String}"

and message.attributes gives me an empty map.. what I do wrong ? thanks!

question from:https://stackoverflow.com/questions/66065264/zio-sqs-message-attributes

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I should use message.messageAttributes ;) dummy mistake.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...