@Override public void onExchangeDone(Route route, Exchange exchange) { super.onExchangeDone(route, exchange); LOG.info("Exchange Done for route " + route.getId() + " exchange: " + exchange.getExchangeId() + " in: " + exchange.getIn().getBody(String.class)); try { stopRoute(route); } catch (Exception e) { throw new RuntimeExchangeException(e.getMessage(), exchange, e); } } }
String msg = e.getMessage();
uri = exchange.getContext().resolvePropertyPlaceholders(uri); } catch (Exception e) { throw new RuntimeExchangeException("Cannot resolve property placeholders with uri: " + uri, exchange, e);
uriString = exchange.getContext().resolvePropertyPlaceholders(uriString); } catch (Exception e) { throw new RuntimeExchangeException("Cannot resolve property placeholders with uri: " + uriString, exchange, e);
@Override public Object next() { if (nextParam == null) { throw new NoSuchElementException(); } // is it a SQL in parameter boolean in = false; if (nextParam.startsWith("in:")) { in = true; nextParam = nextParam.substring(3); } Object next = null; try { boolean hasNext = hasParameter(nextParam, exchange, body); if (hasNext) { next = lookupParameter(nextParam, exchange, body); if (in && next != null) { // if SQL IN we need to return an iterator that can iterate the parameter values next = createInParameterIterator(next); } } else { throw new RuntimeExchangeException(String.format(MISSING_PARAMETER_EXCEPTION, nextParam, query), exchange); } } finally { nextParam = parser.next(); } return next; }
uri = exchange.getContext().resolvePropertyPlaceholders(uri); } catch (Exception e) { throw new RuntimeExchangeException("Cannot resolve property placeholders with uri: " + uri, exchange, e);
uri = exchange.getContext().resolvePropertyPlaceholders(uri); } catch (Exception e) { throw new RuntimeExchangeException("Cannot resolve property placeholders with uri: " + uri, exchange, e);
uriString = exchange.getContext().resolvePropertyPlaceholders(uriString); } catch (Exception e) { throw new RuntimeExchangeException("Cannot resolve property placeholders with uri: " + uriString, exchange, e);
void notify(T event) { logger.debug("Consuming CDI event [{}] with {}", event, this); Exchange exchange = getEndpoint().createExchange(); // TODO: would that be possible to propagate the event metadata? exchange.getIn().setBody(event); // Avoid infinite loop of exchange events if (event instanceof AbstractExchangeEvent) { exchange.setProperty(Exchange.NOTIFY_EVENT, Boolean.TRUE); } try { getProcessor().process(exchange); } catch (Exception cause) { throw new RuntimeExchangeException("Error while processing CDI event", exchange, cause); } finally { if (event instanceof AbstractExchangeEvent) { exchange.setProperty(Exchange.NOTIFY_EVENT, Boolean.FALSE); } } } }
@Override protected String createMessageId() { if (jmsMessage == null) { LOG.trace("No javax.jms.Message set so generating a new message id"); return super.createMessageId(); } try { String id = getDestinationAsString(jmsMessage.getJMSDestination()); if (id != null) { id += jmsMessage.getJMSMessageID(); } else { id = jmsMessage.getJMSMessageID(); } return getSanitizedString(id); } catch (JMSException e) { throw new RuntimeExchangeException("Unable to retrieve JMSMessageID from JMS Message", getExchange(), e); } }
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; } };