List of usage examples for javax.jms BytesMessage getPropertyNames
Enumeration getPropertyNames() throws JMSException;
From source file:org.exist.replication.jms.obsolete.FileSystemListener.java
private eXistMessage convertMessage(BytesMessage bm) { eXistMessage em = new eXistMessage(); try {//from w ww . j av a2s .c o m Enumeration e = bm.getPropertyNames(); while (e.hasMoreElements()) { Object next = e.nextElement(); if (next instanceof String) { em.getMetadata().put((String) next, bm.getObjectProperty((String) next)); } } String value = bm.getStringProperty(eXistMessage.EXIST_RESOURCE_TYPE); eXistMessage.ResourceType resourceType = eXistMessage.ResourceType.valueOf(value); em.setResourceType(resourceType); value = bm.getStringProperty(eXistMessage.EXIST_RESOURCE_OPERATION); eXistMessage.ResourceOperation changeType = eXistMessage.ResourceOperation.valueOf(value); em.setResourceOperation(changeType); value = bm.getStringProperty(eXistMessage.EXIST_SOURCE_PATH); em.setResourcePath(value); value = bm.getStringProperty(eXistMessage.EXIST_DESTINATION_PATH); em.setDestinationPath(value); long size = bm.getBodyLength(); LOG.debug("actual length=" + size); // This is potentially memory intensive byte[] payload = new byte[(int) size]; bm.readBytes(payload); em.setPayload(payload); } catch (JMSException ex) { LOG.error(ex); } return em; }