@ SuppressWarnings ( "unchecked" ) protected Result < JsonNode > writeDataWithResult ( final ObjectNode message , final ObjectMapper objectMapper ) { Result < JsonNode > result ; byte [ ] binaryResultMessage = null ; String textResultMessage = null ; // convert json into map try { if ( ThreadBinary . isBinary ( ) ) { binaryResultMessage = database . sendWriteMessageWithResult ( objectMapper . writeValueAsBytes ( message ) ) ; } else { textResultMessage = database . sendWriteMessageWithResult ( objectMapper . writeValueAsString ( message ) ) ; } } catch ( Exception e ) { logger . error ( "[writeDataWithResult] could not read from database" , e ) ; return new Result <> ( new Error ( Error . NO_DATABASE_REPLY , ExceptionConverter . toString ( e ) ) ) ; } try { if ( ThreadBinary . isBinary ( ) ) { result = jsonObjectMapper . getObjectMapper ( ) . readValue ( binaryResultMessage , Result . class ) ; } else { result = jsonObjectMapper . getObjectMapper ( ) . readValue ( textResultMessage , Result . class ) ; } } catch ( Exception e ) { if ( ThreadBinary . isBinary ( ) ) { logger . error ( "[writeDataWithResult] could not convert message to json: '{}'" , binaryResultMessage , e ) ; } else { logger . error ( "[writeDataWithResult] could not convert message to json: '{}'" , textResultMessage , e ) ; } return new Result <> ( new Error ( Error . MESSAGE_TO_JSON_FAILURE , ExceptionConverter . toString ( e ) ) ) ; } return result ; }
Sends a write message to a Neo4j cluster and returns the data server s answer .