static Message buildMessage ( PublisherConfiguration publisherConfiguration , Object event ) { Message message = new Message ( publisherConfiguration . basicProperties ) . exchange ( publisherConfiguration . exchange ) . routingKey ( publisherConfiguration . routingKey ) ; if ( publisherConfiguration . persistent ) { message . persistent ( ) ; } if ( event instanceof ContainsData ) { message . body ( ( ( ContainsData ) event ) . getData ( ) ) ; } else if ( event instanceof ContainsContent ) { message . body ( ( ( ContainsContent ) event ) . getContent ( ) ) ; } else if ( event instanceof ContainsId ) { message . body ( ( ( ContainsId ) event ) . getId ( ) ) ; } return message ; }
Builds a message based on a CDI event and its publisher configuration .