@ POST @ Consumes ( { MediaType . APPLICATION_OCTET_STREAM } ) public Response postMessageWithoutContentType ( @ PathParam ( "ccid" ) String ccid , byte [ ] serializedMessage ) throws IOException { ImmutableMessage message ; try { message = new ImmutableMessage ( serializedMessage ) ; } catch ( EncodingException | UnsuppportedVersionException e ) { log . error ( "Failed to deserialize SMRF message: {}" , e . getMessage ( ) ) ; throw new WebApplicationException ( e ) ; } try { String msgId = message . getId ( ) ; log . debug ( "******POST message {} to cluster controller: {}" , msgId , ccid ) ; log . trace ( "******POST message {} to cluster controller: {} extended info: \r\n {}" , ccid , message ) ; response . setCharacterEncoding ( "UTF-8" ) ; // the location that can be queried to get the message // status // TODO REST URL for message status? String path = longPollingDelegate . postMessage ( ccid , serializedMessage ) ; URI location = ui . getBaseUriBuilder ( ) . path ( path ) . build ( ) ; // return the message status location to the sender. return Response . created ( location ) . header ( "msgId" , msgId ) . build ( ) ; } catch ( WebApplicationException e ) { log . error ( "Invalid request from host {}" , request . getRemoteHost ( ) ) ; throw e ; } catch ( Exception e ) { log . error ( "POST message for cluster controller: error: {}" , e . getMessage ( ) ) ; throw new WebApplicationException ( e ) ; } }
Send a message to the given cluster controller like the above method postMessage