}
private void writeBuffer(byte[] buf,int offset, int length) throws IOException{
try {
BytesMessage message = new ActiveMQBytesMessage();
message.writeBytes(buf,offset,length);
producer.send(message);
}catch(JMSException jmsEx){
IOException ioEx = new IOException(jmsEx.getMessage());
throw ioEx;
}