public < T > Message build ( MessageBodyConverter < T > converter ) { if ( StringUtils . isBlank ( this . topic ) ) { throw new IllegalArgumentException ( "Blank topic" ) ; } if ( this . body == null && this . payload == null ) { throw new IllegalArgumentException ( "Empty payload" ) ; } byte [ ] payload = this . payload ; if ( payload == null && converter != null ) { try { payload = converter . toByteArray ( ( T ) this . body ) ; } catch ( MetaClientException e ) { throw new IllegalStateException ( "Convert message body failed." , e ) ; } } if ( payload == null ) { throw new IllegalArgumentException ( "Empty payload" ) ; } return new Message ( this . topic , payload , this . attribute ) ; }
Build message by message body converter .