Hi
I am using qpid-jms (qpid-jms-client-0.20.0-SNAPSHOT.jar) with the C++ qpid
broker version 0.34 from java.
I can successfully package and receive standard Message and TextMessage
types but when I try to use a ByteMessage or a MapMessage type I never
receive the message.
I have included two examples below. I can provide more information if
needed. I am hoping this is something simple that I am doing wrong.
Thanks.
-bill
THIS WORKS:
public void publishHostFinished( String hostName, String clientType,
boolean success, String result ) {
try {
TextMessage message = session.createTextMessage();
message.setBooleanProperty( "finished_state", success);
message.setStringProperty( "finished_result", result );
message.setStringProperty( "message_type", "FINISHED" );
publishHostTextMessage( message, hostName, clientType,
null );
}
catch( JMSException e ) {
log.error( "Error while publishing finished for {}
client {}: {}",
hostName, clientType, e.getLocalizedMessage() );
}
}
private void publishHostTextMessage( TextMessage message, String hostName,
String clientType, String body ) throws JMSException {
message.setStringProperty( "host", hostName );
message.setStringProperty( "client_type", clientType );
message.setText( body );
publisher.publish( message );
}
WHERE THIS WON'T:
// TEST MESSAGE
public void publishBufferedMessage( ) {
System.out.println( "****************** PUBLISH BUFFERD MESSAGE
*************************" );
Drive.Builder drive = Drive.newBuilder();
drive.setSerial( "123-456-789" );
drive.setComments( "This is drive: sda" );
drive.setId(123);
drive.setLabel( "DRIVE_LABEL" );
drive.build();
try {
BytesMessage message = session.createBytesMessage();
int messageSize = drive.build().getSerializedSize();
message.setStringProperty( "message_type", "DRIVE_DATA" );
message.setIntProperty( "message_encoded_size", messageSize );
/**
byte[] encodedMessage = new byte[messageSize];
encodedMessage = drive.build().toByteArray();
message.writeBytes( encodedMessage );
**/
publisher.publish( message );
}
catch( JMSException jmse ) {
System.out.println( "error while publishing buffered
message: " +
jmse.getLocalizedMessage() );
}
}
--
View this message in context:
http://qpid.2158936.n2.nabble.com/qpid-jms-with-C-Broker-Does-it-support-ByteMessage-types-from-java-tp7652144.html
Sent from the Apache Qpid developers mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]