Spring JMSListener - How should it handle empty payloads?

I took M. Deinum's suggestion (as it seemed quick and clean) and simply made the parameter type javax.jms.Message then converted the incoming message into a string. So my Listener now looks like

@JmsListener
public void processOrder(Message message) throws JMSException {
     String convertedMessage = ((TextMessage) message).getText();
     :
     :
}

This may throw a JMSException, but I'm not too concerned with that as now when my implemented ErrorHandler class is called, I'll now know why and can do something more specific to handle a failed conversion. This does exactly what I need it to.

Edit: And in response to Jonh K's suggestion, the listener did not like having byte[] as a parameter. It basically wanted a converter to convert from byte array to string. Opted out of implementing my own custom converter.


@JmsListener(destination = "stompmessage")
public void receiveStomp(byte[] data, @Headers Map<Object, Object> allHeaders) {
   System.out.println("Stomp message: "+ new String(data));
}

Version for spring in 2019-2020