protected Message createMessage ( ConnectionContext context , BasicMessage basicMessage , Map < String , String > headers ) throws JMSException { if ( context == null ) { throw new IllegalArgumentException ( "The context is null" ) ; } if ( basicMessage == null ) { throw new IllegalArgumentException ( "The message is null" ) ; } Session session = context . getSession ( ) ; if ( session == null ) { throw new IllegalArgumentException ( "The context had a null session" ) ; } TextMessage msg = session . createTextMessage ( basicMessage . toJSON ( ) ) ; setHeaders ( basicMessage , headers , msg ) ; log . infof ( "Created text message [%s] with text [%s]" , msg , msg . getText ( ) ) ; return msg ; }
Creates a text message that can be send via a producer that contains the given BasicMessage s JSON encoded data .