Printing bodies of Byte messages received by the EMS server.
book
Article ID: KB0086504
calendar_today
Updated On:
Products
Versions
TIBCO Enterprise Message Service
-
Not Applicable
-
Description
Resolution: Description: =========== EMS does not print the bodies of Byte messages in the server log. You can use monitoring topics to obtain the bodies of Byte messages. If the body is actual text, you can convert it to string.
Resolution: ============ Example: Include the following in tibjmsTopicSubscriber.java (under <ems_home>/samples/java):
javax.jms.MapMessage message = (MapMessage)subscriber.receive(); byte[] mb = message.getBytes("message_bytes"); javax.jms.BytesMessage mm = (javax.jms.BytesMessage)com.tibco.tibjms.Tibjms.createFromBytes(mb); int l = (int)mm.getBodyLength(); byte[] body = new byte[l-1]; mm.readBytes(body);
If it is text:
System.out.println("Received message: "+ new String(body));