List of usage examples for javax.jms Message getJMSCorrelationID
String getJMSCorrelationID() throws JMSException;
From source file:org.mule.transport.jms.JmsMessageUtils.java
public static Message copyJMSProperties(Message from, Message to, JmsConnector connector) throws JMSException { if (connector.supportsProperty(JmsConstants.JMS_CORRELATION_ID)) { to.setJMSCorrelationID(from.getJMSCorrelationID()); }/*www .ja va2 s . c o m*/ if (connector.supportsProperty(JmsConstants.JMS_DELIVERY_MODE)) { to.setJMSDeliveryMode(from.getJMSDeliveryMode()); } if (connector.supportsProperty(JmsConstants.JMS_DESTINATION)) { to.setJMSDestination(from.getJMSDestination()); } if (connector.supportsProperty(JmsConstants.JMS_EXPIRATION)) { to.setJMSExpiration(from.getJMSExpiration()); } if (connector.supportsProperty(JmsConstants.JMS_MESSAGE_ID)) { to.setJMSMessageID(from.getJMSMessageID()); } if (connector.supportsProperty(JmsConstants.JMS_PRIORITY)) { to.setJMSPriority(from.getJMSPriority()); } if (connector.supportsProperty(JmsConstants.JMS_REDELIVERED)) { to.setJMSRedelivered(from.getJMSRedelivered()); } if (connector.supportsProperty(JmsConstants.JMS_REPLY_TO)) { to.setJMSReplyTo(from.getJMSReplyTo()); } if (connector.supportsProperty(JmsConstants.JMS_TIMESTAMP)) { to.setJMSTimestamp(from.getJMSTimestamp()); } if (connector.supportsProperty(JmsConstants.JMS_TYPE)) { to.setJMSType(from.getJMSType()); } return to; }
From source file:org.jbpm.bpel.integration.jms.RequestListener.java
public static String messageToString(Message message) throws JMSException { StringBuffer result = new StringBuffer(); // ID & destination result.append("id=").append(message.getJMSMessageID()).append(", destination=") .append(message.getJMSDestination()); // replyTo & correlationID Destination replyTo = message.getJMSReplyTo(); if (replyTo != null) { result.append(", replyTo=").append(replyTo).append(", correlationId=") .append(message.getJMSCorrelationID()); }/*from w w w . j a v a 2 s . co m*/ // properties Enumeration propertyNames = message.getPropertyNames(); while (propertyNames.hasMoreElements()) { String propertyName = (String) propertyNames.nextElement(); result.append(", ").append(propertyName).append('=').append(message.getObjectProperty(propertyName)); } return result.toString(); }
From source file:com.egt.core.aplicacion.Bitacora.java
public static void traceMessage(Class clase, String metodo, Message message) throws JMSException { logTrace(Utils.getTraceMessageFormat(getCallingMethodStackTraceElementTrack(clase, metodo, 4), new Object[] { message.getJMSType(), message.getJMSMessageID(), message.getJMSCorrelationID(), message.getJMSRedelivered() })); }
From source file:org.apache.axis2.transport.jms.JMSUtils.java
/** * Extract transport level headers for JMS from the given message into a Map * * @param message the JMS message/* ww w. j av a 2s. c o m*/ * @return a Map of the transport headers */ public static Map<String, Object> getTransportHeaders(Message message) { // create a Map to hold transport headers Map<String, Object> map = new HashMap<String, Object>(); // correlation ID try { if (message.getJMSCorrelationID() != null) { map.put(JMSConstants.JMS_COORELATION_ID, message.getJMSCorrelationID()); } } catch (JMSException ignore) { } // set the delivery mode as persistent or not try { map.put(JMSConstants.JMS_DELIVERY_MODE, Integer.toString(message.getJMSDeliveryMode())); } catch (JMSException ignore) { } // destination name try { if (message.getJMSDestination() != null) { Destination dest = message.getJMSDestination(); map.put(JMSConstants.JMS_DESTINATION, dest instanceof Queue ? ((Queue) dest).getQueueName() : ((Topic) dest).getTopicName()); } } catch (JMSException ignore) { } // expiration try { map.put(JMSConstants.JMS_EXPIRATION, Long.toString(message.getJMSExpiration())); } catch (JMSException ignore) { } // if a JMS message ID is found try { if (message.getJMSMessageID() != null) { map.put(JMSConstants.JMS_MESSAGE_ID, message.getJMSMessageID()); } } catch (JMSException ignore) { } // priority try { map.put(JMSConstants.JMS_PRIORITY, Long.toString(message.getJMSPriority())); } catch (JMSException ignore) { } // redelivered try { map.put(JMSConstants.JMS_REDELIVERED, Boolean.toString(message.getJMSRedelivered())); } catch (JMSException ignore) { } // replyto destination name try { if (message.getJMSReplyTo() != null) { Destination dest = message.getJMSReplyTo(); map.put(JMSConstants.JMS_REPLY_TO, dest instanceof Queue ? ((Queue) dest).getQueueName() : ((Topic) dest).getTopicName()); } } catch (JMSException ignore) { } // priority try { map.put(JMSConstants.JMS_TIMESTAMP, Long.toString(message.getJMSTimestamp())); } catch (JMSException ignore) { } // message type try { if (message.getJMSType() != null) { map.put(JMSConstants.JMS_TYPE, message.getJMSType()); } } catch (JMSException ignore) { } // any other transport properties / headers Enumeration<?> e = null; try { e = message.getPropertyNames(); } catch (JMSException ignore) { } if (e != null) { while (e.hasMoreElements()) { String headerName = (String) e.nextElement(); try { map.put(headerName, message.getStringProperty(headerName)); continue; } catch (JMSException ignore) { } try { map.put(headerName, message.getBooleanProperty(headerName)); continue; } catch (JMSException ignore) { } try { map.put(headerName, message.getIntProperty(headerName)); continue; } catch (JMSException ignore) { } try { map.put(headerName, message.getLongProperty(headerName)); continue; } catch (JMSException ignore) { } try { map.put(headerName, message.getDoubleProperty(headerName)); continue; } catch (JMSException ignore) { } try { map.put(headerName, message.getFloatProperty(headerName)); } catch (JMSException ignore) { } } } return map; }
From source file:org.apache.synapse.transport.jms.JMSUtils.java
/** * Extract transport level headers for JMS from the given message into a Map * * @param message the JMS message/*from ww w .ja va2 s . c o m*/ * @return a Map of the transport headers */ public static Map getTransportHeaders(Message message) { // create a Map to hold transport headers Map map = new HashMap(); // correlation ID try { if (message.getJMSCorrelationID() != null) { map.put(JMSConstants.JMS_COORELATION_ID, message.getJMSCorrelationID()); } } catch (JMSException ignore) { } // set the delivery mode as persistent or not try { map.put(JMSConstants.JMS_DELIVERY_MODE, Integer.toString(message.getJMSDeliveryMode())); } catch (JMSException ignore) { } // destination name try { if (message.getJMSDestination() != null) { Destination dest = message.getJMSDestination(); map.put(JMSConstants.JMS_DESTINATION, dest instanceof Queue ? ((Queue) dest).getQueueName() : ((Topic) dest).getTopicName()); } } catch (JMSException ignore) { } // expiration try { map.put(JMSConstants.JMS_EXPIRATION, Long.toString(message.getJMSExpiration())); } catch (JMSException ignore) { } // if a JMS message ID is found try { if (message.getJMSMessageID() != null) { map.put(JMSConstants.JMS_MESSAGE_ID, message.getJMSMessageID()); } } catch (JMSException ignore) { } // priority try { map.put(JMSConstants.JMS_PRIORITY, Long.toString(message.getJMSPriority())); } catch (JMSException ignore) { } // redelivered try { map.put(JMSConstants.JMS_REDELIVERED, Boolean.toString(message.getJMSRedelivered())); } catch (JMSException ignore) { } // replyto destination name try { if (message.getJMSReplyTo() != null) { Destination dest = message.getJMSReplyTo(); map.put(JMSConstants.JMS_REPLY_TO, dest instanceof Queue ? ((Queue) dest).getQueueName() : ((Topic) dest).getTopicName()); } } catch (JMSException ignore) { } // priority try { map.put(JMSConstants.JMS_TIMESTAMP, Long.toString(message.getJMSTimestamp())); } catch (JMSException ignore) { } // message type try { if (message.getJMSType() != null) { map.put(JMSConstants.JMS_TYPE, message.getJMSType()); } } catch (JMSException ignore) { } // any other transport properties / headers Enumeration e = null; try { e = message.getPropertyNames(); } catch (JMSException ignore) { } if (e != null) { while (e.hasMoreElements()) { String headerName = (String) e.nextElement(); try { map.put(headerName, message.getStringProperty(headerName)); continue; } catch (JMSException ignore) { } try { map.put(headerName, Boolean.valueOf(message.getBooleanProperty(headerName))); continue; } catch (JMSException ignore) { } try { map.put(headerName, new Integer(message.getIntProperty(headerName))); continue; } catch (JMSException ignore) { } try { map.put(headerName, new Long(message.getLongProperty(headerName))); continue; } catch (JMSException ignore) { } try { map.put(headerName, new Double(message.getDoubleProperty(headerName))); continue; } catch (JMSException ignore) { } try { map.put(headerName, new Float(message.getFloatProperty(headerName))); continue; } catch (JMSException ignore) { } } } return map; }
From source file:com.adaptris.core.jms.MessageIdCorrelationIdSource.java
@Override public void processCorrelationId(Message src, AdaptrisMessage dest) throws JMSException { String id = src.getJMSCorrelationID(); if (!StringUtils.isEmpty(id)) { dest.setUniqueId(id);/*from w w w . j av a 2s.c om*/ } else { log.debug("No JMSCorrelationID; not modifying unique-id"); } }
From source file:org.dataminx.dts.ws.jms.DtsWsMessageConverter.java
/** * {@inheritDoc}/*from w w w . j a v a 2 s. com*/ */ @Override public Object fromMessage(final Message message) throws JMSException, MessageConversionException { final String jobResourceKey = message.getJMSCorrelationID(); LOG.info("A new JMS message has been received: " + jobResourceKey); final Object payload = extractMessagePayload(message); LOG.debug(String.format("Finished reading message payload of type: '%s'", payload.getClass().getName())); // convert the payload into a JobEventUpdateRequest object final Object jobEventUpdateRequest = mTransformer.transformPayload(payload); LOG.debug("transformed message payload: " + jobEventUpdateRequest); return jobEventUpdateRequest; }
From source file:com.adaptris.core.jms.MetadataCorrelationIdSource.java
public void processCorrelationId(Message src, AdaptrisMessage dest) throws JMSException { try {/* w w w. jav a2s . co m*/ Args.notBlank(getMetadataKey(), "metadata-key"); String id = src.getJMSCorrelationID(); if (isEmpty(id)) { log.warn("No Correlation Id available"); } else { dest.addMetadata(getMetadataKey(), id); log.debug("Set metadata key [{}] to [{}]", getMetadataKey(), id); } } catch (IllegalArgumentException e) { // do nothing as it's probably because getMtadataKey() was null. } }
From source file:org.logicblaze.lingo.jms.impl.MultiplexingRequestor.java
/** * Processes inbound responses from requests *//*w w w . j a v a 2s. c o m*/ public void onMessage(Message message) { try { String correlationID = message.getJMSCorrelationID(); // lets notify the monitor for this response Object handler = requestMap.get(correlationID); if (handler == null) { log.warn("Response received for unknown correlationID: " + correlationID + " request: " + message); } else if (handler instanceof ReplyHandler) { ReplyHandler replyHandler = (ReplyHandler) handler; boolean complete = replyHandler.handle(message); if (complete) { requestMap.remove(correlationID); } } } catch (JMSException e) { throw new FailedToProcessResponse(message, e); } }