/** * Appends the JMS headers from the Camel {@link JmsMessage} */ public void appendJmsProperties(Message jmsMessage, Exchange exchange) throws JMSException { appendJmsProperties(jmsMessage, exchange, exchange.getIn()); }
protected Message createMessage(Exchange exchange) throws JMSException { if (exchange != null) { Message message = destination.getBinding().makeJmsMessage(exchange, session); return message; } else { return null; } }
/** * Creates the {@link org.apache.camel.component.jms.JmsBinding} to use. */ protected JmsBinding createBinding() { return new JmsBinding(this); }
DefaultExchangeHolder.unmarshal(exchange, holder); Map<String, Object> jmsHeaders = extractHeadersFromJms(message, exchange); exchange.getIn().getHeaders().putAll(jmsHeaders); return exchange.getIn().getBody(); } else if (message instanceof MapMessage) { LOG.trace("Extracting body as a MapMessage from JMS message: {}", message); return createMapFromMapMessage((MapMessage)message); } else if (message instanceof BytesMessage) { LOG.trace("Extracting body as a BytesMessage from JMS message: {}", message); return createByteArrayFromBytesMessage(exchange, (BytesMessage)message); } else if (message instanceof StreamMessage) { LOG.trace("Extracting body as a StreamMessage from JMS message: {}", message); StreamMessage streamMessage = (StreamMessage)message; return createInputStreamFromStreamMessage(exchange, streamMessage); } else { return null;
answer = createJmsMessage(cause, session); } else { ObjectHelper.notNull(camelMessage, "message"); answer = createJmsMessage(exchange, camelMessage, session, exchange.getContext()); appendJmsProperties(answer, exchange, camelMessage);
type = getJMSMessageTypeForBody(exchange, body, headers, session, context); Message answer = createJmsMessageForType(exchange, body, headers, session, context, type);
/** * Appends the JMS headers from the Camel {@link JmsMessage} */ public void appendJmsProperties(Message jmsMessage, Exchange exchange, org.apache.camel.Message in) throws JMSException { Set<Map.Entry<String, Object>> entries = in.getHeaders().entrySet(); for (Map.Entry<String, Object> entry : entries) { String headerName = entry.getKey(); Object headerValue = entry.getValue(); appendJmsProperty(jmsMessage, exchange, in, headerName, headerValue); } }
protected Message createJmsMessage(Exchange exchange, org.apache.camel.Message camelMessage, Session session, CamelContext context) throws JMSException { Message answer = createJmsMessage(exchange, camelMessage.getBody(), camelMessage.getHeaders(), session, context); // special for transferFault boolean isFault = camelMessage.isFault(); if (answer != null && isFault && endpoint != null && endpoint.isTransferFault()) { answer.setBooleanProperty(JmsConstants.JMS_TRANSFER_FAULT, true); } return answer; }
protected Message createMessage(Exchange exchange) throws JMSException { if (exchange != null) { Message message = destination.getBinding().makeJmsMessage(exchange, session); return message; } else { return null; } }
/** * Converts the inbound message exchange to an ActiveMQ JMS message * * @return the ActiveMQ message */ @Converter public ActiveMQMessage toMessage(Exchange exchange) throws JMSException { ActiveMQMessage message = createActiveMQMessage(exchange); getBinding().appendJmsProperties(message, exchange); return message; }
public JmsEndpoint(String endpointUri, String destinationName, boolean pubSubDomain) { this(UnsafeUriCharactersEncoder.encode(endpointUri), null, new JmsConfiguration(), destinationName, pubSubDomain); this.binding = new JmsBinding(this); if (pubSubDomain) { this.destinationType = "topic"; } else { this.destinationType = "queue"; } }
/** * Creates a JMS message from the Camel exchange and message * * @param exchange the current exchange * @param session the JMS session used to create the message * @return a newly created JMS Message instance containing the * @throws JMSException if the message could not be created */ public Message makeJmsMessage(Exchange exchange, Session session) throws JMSException { Message answer = makeJmsMessage(exchange, exchange.getIn(), session, null); if (answer != null && messageCreatedStrategy != null) { messageCreatedStrategy.onMessageCreated(answer, session, exchange, null); } return answer; }
/** * Converts the inbound message exchange to an ActiveMQ JMS message * * @return the ActiveMQ message */ @Converter public ActiveMQMessage toMessage(Exchange exchange) throws JMSException { ActiveMQMessage message = createActiveMQMessage(exchange); getBinding().appendJmsProperties(message, exchange); return message; }
public Message createMessage(Session session) throws JMSException { Message reply = endpoint.getBinding().makeJmsMessage(exchange, out, session, cause); final String correlationID = determineCorrelationId(message); reply.setJMSCorrelationID(correlationID); if (LOG.isDebugEnabled()) { LOG.debug("{} sending reply JMS message [correlationId:{}]: {}", endpoint, correlationID, reply); } return reply; } });
public Message createMessage(Session session) throws JMSException { Message reply = endpoint.getBinding().makeJmsMessage(exchange, out, session, cause); final String correlationID = determineCorrelationId(message); reply.setJMSCorrelationID(correlationID); if (LOG.isDebugEnabled()) { LOG.debug("{} sending reply JMS message [correlationId:{}]: {}", endpoint, correlationID, reply); } return reply; } });
public Message createMessage(Session session) throws JMSException { Message answer = endpoint.getBinding().makeJmsMessage(exchange, in, session, null); Destination replyTo = null; String replyToOverride = configuration.getReplyToOverride(); if (replyToOverride != null) { replyTo = resolveOrCreateDestination(replyToOverride, session); } else { // get the reply to destination to be used from the reply manager replyTo = replyManager.getReplyTo(); } if (replyTo == null) { throw new RuntimeExchangeException("Failed to resolve replyTo destination", exchange); } JmsMessageHelper.setJMSReplyTo(answer, replyTo); replyManager.setReplyToSelectorHeader(in, answer); String correlationId = determineCorrelationId(answer, provisionalCorrelationId); replyManager.registerReply(replyManager, exchange, callback, originalCorrelationId, correlationId, timeout); if (correlationProperty != null) { replyManager.setCorrelationProperty(correlationProperty); } if (LOG.isDebugEnabled()) { LOG.debug("Using {}: {}, JMSReplyTo destination: {}, with request timeout: {} ms.", new Object[]{correlationPropertyToUse, correlationId, replyTo, timeout}); } LOG.trace("Created javax.jms.Message: {}", answer); return answer; } };
public Message createMessage(Session session) throws JMSException { Message answer = endpoint.getBinding().makeJmsMessage(exchange, in, session, null);