HashMap properties)
throws Exception
{
Destination reply = createTemporaryDestination();
MessageConsumer subscriber = createConsumer(reply);
BytesMessage jmsMessage = m_session.createBytesMessage();
jmsMessage.writeBytes(message);
jmsMessage.setJMSReplyTo(reply);
int deliveryMode = extractDeliveryMode(properties);
int priority = extractPriority(properties);
long timeToLive = extractTimeToLive(properties);
if(properties != null && !properties.isEmpty())
setProperties(properties, jmsMessage);
send(endpoint.getDestination(m_session), jmsMessage, deliveryMode,
priority, timeToLive);
BytesMessage response = null;
try {
response = (BytesMessage)subscriber.receive(timeout);
} catch (ClassCastException cce) {
throw new InvokeException
("Error: unexpected message type received - expected BytesMessage");
}
byte[] respBytes = null;
if(response != null)
{
byte[] buffer = new byte[8 * 1024];
ByteArrayOutputStream out = new ByteArrayOutputStream();
for(int bytesRead = response.readBytes(buffer);
bytesRead != -1; bytesRead = response.readBytes(buffer))
{
out.write(buffer, 0, bytesRead);
}
respBytes = out.toByteArray();
}