-
-
Notifications
You must be signed in to change notification settings - Fork 313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify not adding type header in SqsTemplate sent messages #659
Comments
May I try this one? Seems to be good to start! |
Sounds good @levys17! Let me know if there's anything you'd like to discuss. |
Hii, @tomazfernandes! Considering that AbstractMessagingMessageConverter is responsible to set headers ( typeHeader included), what do you thing about implement this method in this class? public void sendMessageWithoutTypeHeader() {
this.payloadTypeHeaderFunction = message -> null;
} @Test
void shouldSendAndReceiveRecordMessageWithoutPayloadInfoHeader() {
SqsTemplate template = SqsTemplate.builder().sqsAsyncClient(this.asyncClient)
.configureDefaultConverter(converter -> converter.sendMessageWithoutTypeHeader())
.build();
SampleRecord testRecord = new SampleRecord("Hello world!",
"From shouldSendAndReceiveRecordMessageWithoutPayloadInfoHeader!");
SendResult<SampleRecord> result = template.send(RECORD_WITHOUT_TYPE_HEADER_QUEUE_NAME, testRecord);
assertThat(result).isNotNull();
Optional<Message<SampleRecord>> receivedMessage = template
.receive(from -> from.queue(RECORD_WITHOUT_TYPE_HEADER_QUEUE_NAME), SampleRecord.class);
assertThat(receivedMessage).isPresent().get().extracting(Message::getPayload).isEqualTo(testRecord);
} Should I keep going implementing this way or perhaps there is a better way? |
Hey @levys17, sorry for the delay!
This makes sense. I had thought of setting it in the Regarding the method name, how about Let me know your thoughts, thanks! |
No problem, @tomazfernandes! Thanks for answer! I'll open a PR soon. Thanks! |
@tomazfernandes looks like a good candidate for 3.1.1? |
Yup, definitely! |
…#1066) --------- Co-authored-by: Maciej Walkowiak <walkowiak.maciej@yahoo.com>
Fixed in #1066 |
Currently in order to not add type information to messages sent with the
SqsTemplate
it's necessary to do something like this:We could make it more user-friendly and perhaps have a
TemplateOptions.doNotAddTypeInformationToSentMessages()
method or something similar.The text was updated successfully, but these errors were encountered: