version::

spring-boot-starter-parent - version: 2.1.8.RELEASE
spring-boot-starter-websocket - as above

issue: Client receives extra/un-necessary message(a["\n"] or empty line) for each message sent from external broker via brokerrelay

Comment From: rstoyanchev

Are you sure about this conclusion? AbstractMessageChannel is a very generic component that skips the send if an interceptor returns null from preSend and this is not in any way related the STOMP broker is in use. The a["\n"] messages that you're seeing with the external broker are probably heartbeat messages.

Comment From: seenimurugan

@rstoyanchev I double checked and the issue is with the message itself not with the preSend method i guess. If I send a simple string as payload in the convertAndSend method then it does not produce this noise. But if I use any object as string(using Jackson or gson converter) as payload then it sends the additional line. Please find the below link to test this issue. Git hub url

Also the noise is not a["\n"] in my sample application but it is empty message. But with my original application the payload is very big so it sends a["\n"] as additional message with every message.

Comment From: seenimurugan

Screenshot 2019-09-26 at 11 43 45

Comment From: rstoyanchev

Thanks for providing the sample.

ActiveMQ appears to be sending extra new lines at the end of STOMP frames, i.e. after the terminating \0 byte (NULL octet). I don't know what the logic of when it does that but it is allowed by the spec, from section 2.1:

The NULL octet can be optionally followed by multiple EOLs.

The current logic does skip empty new lines at the start of a frame but if they arrive in the same chunk as the message, it ends up (incorrectly) interpreting that as a heartbeat.