/** * Returns the in message or throws an exception if there is no in message. */ protected NormalizedMessage getInMessage(MessageExchange exchange) throws NoInMessageAvailableException { NormalizedMessage message = exchange.getMessage("in"); if (message == null) { throw new NoInMessageAvailableException(exchange); } return message; }
/** * Returns the in message or throws an exception if there is no in message. */ protected NormalizedMessage getInMessage(MessageExchange exchange) throws NoInMessageAvailableException { NormalizedMessage message = exchange.getMessage("in"); if (message == null) { throw new NoInMessageAvailableException(exchange); } return message; }
public boolean matches(MessageExchange exchange) { try { NormalizedMessage in = exchange.getMessage("in"); Boolean match = (Boolean) evaluate(exchange, in); return Boolean.TRUE.equals(match); } catch (Exception e) { logger.warn("Could not evaluate xpath expression", e); return false; } }
/** * Returns the in message or throws an exception if there is no in message. */ protected NormalizedMessage getInMessage(MessageExchange exchange) throws NoInMessageAvailableException { NormalizedMessage message = exchange.getMessage("in"); if (message == null) { throw new NoInMessageAvailableException(exchange); } return message; }
private Long getSequenceNumber(MessageExchange exchange) { Object number = exchange.getMessage(IN).getProperty(sequenceNumberKey); if (number instanceof Long) { return (Long) number; } else { return Long.parseLong(number.toString()); } }
protected boolean onProviderExchangeDone(MessageExchange exchange) { return (exchange instanceof InOnly) || (exchange instanceof RobustInOnly && exchange.getFault() == null) || (exchange instanceof InOptionalOut && exchange.getFault() == null && exchange.getMessage("out") == null); }
private void processResponse(MessageExchange exchange, HttpServletRequest request, HttpServletResponse response) throws Exception { NormalizedMessage outMsg = exchange.getMessage("out"); if (outMsg != null) { Context ctx = (Context) request.getAttribute(Context.class.getName()); SoapMessage out = soapHelper.onReply(ctx, outMsg); SoapWriter writer = soapHelper.getSoapMarshaler().createWriter(out); response.setContentType(writer.getContentType()); writer.write(response.getOutputStream()); } }
protected final String getPayload(String messageName) { NormalizedMessage message = messageExchange.getMessage(messageName); assert message != null; try { return SourceHelper.toString(message.getContent()); } catch (TransformerException te) { throw new UncheckedException(te); } }
protected NormalizedMessage extract(MessageExchange me) throws ExecutionException { if (me.getStatus() == ExchangeStatus.ERROR) { throw new ExecutionException(me.getError()); } else if (me.getFault() != null) { throw new ExecutionException(new FaultException("Fault occured", me, me.getFault())); } else { return me.getMessage("out"); } } }
public MessageExchange makeJbiMessageExchange(Exchange camelExchange, MessageExchangeFactory exchangeFactory, String defaultMep) throws MessagingException, URISyntaxException { MessageExchange jbiExchange = createJbiMessageExchange(camelExchange, exchangeFactory, defaultMep); copyPropertiesFromCamelToJbi(camelExchange, jbiExchange); NormalizedMessage normalizedMessage = jbiExchange.getMessage("in"); if (normalizedMessage == null) { normalizedMessage = jbiExchange.createMessage(); jbiExchange.setMessage(normalizedMessage, "in"); } copyFromCamelToJbi(camelExchange.getIn(), normalizedMessage); return jbiExchange; }
protected void populateMessage(MessageExchange exchange, Map exchangeProperties, Map inMessageProperties, Object content) throws MessagingException { NormalizedMessage in = exchange.getMessage("in"); populateExchangeProperties(exchange, exchangeProperties); populateMessageProperties(in, inMessageProperties); getMarshaler().marshal(exchange, in, content); }
public static void transferTo(MessageExchange source, MessageExchange dest, String name) throws MessagingException { NormalizedMessage sourceMsg = source.getMessage(name); NormalizedMessage destMsg = (sourceMsg instanceof Fault) ? dest.createFault() : dest.createMessage(); transfer(sourceMsg, destMsg); dest.setMessage(destMsg, name); }
protected void populateMessage(MessageExchange exchange, Map exchangeProperties, Map inMessageProperties, Object content) throws MessagingException { NormalizedMessage in = exchange.getMessage("in"); populateExchangeProperties(exchange, exchangeProperties); populateMessageProperties(in, inMessageProperties); getMarshaler().marshal(exchange, in, content); }
public Exchange createExchange(MessageExchange exchange) { Exchange result = new DefaultExchange(context); result.setProperty(MESSAGE_EXCHANGE, exchange); result.setPattern(getExchangePattern(exchange)); if (exchange.getOperation() != null) { result.setProperty(OPERATION, exchange.getOperation()); } if (exchange.getMessage("in") != null) { copyFromJbiToCamel(exchange.getMessage("in"), result.getIn()); } copyPropertiesFromJbiToCamel(exchange, result); return result; }
private void writeFileHeader(OutputStream os, MessageExchange exchange) { MessageExchangeWriter writer = new MessageExchangeWriter(os); writer.writeMessageExchange(exchange); writer.println(); writer.println("-- Normalized message (in) --"); writer.writeNormalizedMessage(exchange.getMessage("in")); writer.flush(); }
public void onMessageExchange(MessageExchange exchange) throws MessagingException { NormalizedMessage inMessage = exchange.getMessage("in"); messageList.addMessage(inMessage); exchange.setStatus(ExchangeStatus.DONE); context.getDeliveryChannel().send(exchange); }
public static void transferTo(MessageExchange source, MessageExchange dest, String name) throws MessagingException { NormalizedMessage sourceMsg = source.getMessage(name); NormalizedMessage destMsg = (sourceMsg instanceof Fault) ? dest.createFault() : dest.createMessage(); transfer(sourceMsg, destMsg); dest.setMessage(destMsg, name); }
public void handleMessage(Message message) { MessageExchange me = message.get(MessageExchange.class); if (me == null) { me = message.getContent(MessageExchange.class); } NormalizedMessage nm = me.getMessage("in"); fromNMSAttachments(message, nm); fromNMSHeaders(message, nm); extractHeaderFromMessagePart(message); }
private void processMessage(MessageExchange sourceExchange) throws MessagingException, InterruptedException { NormalizedMessage source = sourceExchange.getMessage("in"); NormalizedMessage copy = getMessageCopier().transform(sourceExchange, source); MessageExchange targetExchange = createTargetExchange(copy, sourceExchange.getPattern()); // add target exchange to resequencer (blocking if capacity is reached) reseq.put(targetExchange); }
protected MessageExchange[] createParts(MessageExchange exchange) throws Exception { NormalizedMessage in = MessageUtil.copyIn(exchange); Source[] srcParts = split(in.getContent()); MessageExchange[] parts = new MessageExchange[srcParts.length]; for (int i = 0; i < srcParts.length; i++) { parts[i] = createPart(exchange.getPattern(), in, srcParts[i]); NormalizedMessage msg = parts[i].getMessage("in"); msg.setProperty(SPLITTER_COUNT, new Integer(srcParts.length)); msg.setProperty(SPLITTER_INDEX, new Integer(i)); msg.setProperty(SPLITTER_CORRID, exchange.getExchangeId()); } return parts; }