@Override
    public Message toMessage(Object o, MessageProperties messageProperties) throws MessageConversionException {
        if(o instanceof MyCustomEventApplicationEvent) {
            try {
                String data = converter.toJsonString(((MyCustomEventApplicationEvent) o).getMyCustomEvent());
                return new Message(data.getBytes("UTF-8"), messageProperties);
            } catch(IOException e) {
                throw new MessageConversionException("Unable to convert message: " + o, e);
            }
        } else {
            return delegate.toMessage(o, messageProperties);
        }
    }