How to manipulate SendMessageRequest to add MessageAttribute via Reflection when using SDK 2?

0

With Java SDK 1 when sending a message to AWS, we could add a custom MessageAttributeValue after the SendMessageRequest object has been made by calling the addMessageAttributeEntry(String Key, MessageAttributeValue attribute) on the SendMessageRequest object. This could have been done via Reflection.

But with Java SDK 2, the implementation of SendMessageRequest has changed and we cannot add a message attribute after the SendMessageRequest object has already been created. We have to create a new SendMessageRequest object, which we cannot. Because we are manipulating the object via Reflection. Also we cannot 'put' a new Entry into sendMessageRequest.messageAttributes() map because it's of type Unmodifiable.

已提问 2 年前23 查看次数