protected void processInOnly(MessageExchange exchange, NormalizedMessage in) throws Exception { throw new UnsupportedOperationException("Unsupported MEP: " + exchange.getPattern()); }
protected void processInOut(MessageExchange exchange, NormalizedMessage in, NormalizedMessage out) throws Exception { throw new UnsupportedOperationException("Unsupported MEP: " + exchange.getPattern()); }
public void onJbiMessageExchange(MessageExchange jbiMex) throws MessagingException { if (!jbiMex.getPattern().equals(MessageExchangePattern.IN_ONLY) && !jbiMex.getPattern().equals(MessageExchangePattern.IN_OUT)) { __log.error("JBI MessageExchange " + jbiMex.getExchangeId() + " is of an unsupported pattern " + jbiMex.getPattern()); return; } if (jbiMex.getStatus() == ExchangeStatus.ACTIVE) { if (jbiMex.getPattern().equals(MessageExchangePattern.IN_OUT)) { inOutDone((InOut) jbiMex); outResponse((InOut) jbiMex); } jbiMex.setStatus(ExchangeStatus.DONE); _ode.getChannel().send(jbiMex); } else if (jbiMex.getStatus() == ExchangeStatus.ERROR) { inOutDone((InOut) jbiMex); outFailure((InOut) jbiMex); } else if (jbiMex.getStatus() == ExchangeStatus.DONE) { _outstandingExchanges.remove(jbiMex.getExchangeId()); } else { __log.error("Unexpected status " + jbiMex.getStatus() + " for JBI message exchange: " + jbiMex.getExchangeId()); } }
sb.append("[\n"); sb.append(" id: ").append(exchange.getExchangeId()).append('\n'); sb.append(" mep: ").append(exchange.getPattern()).append('\n'); sb.append(" status: ").append(exchange.getStatus()).append('\n'); sb.append(" role: ").append(exchange.getRole() == MessageExchange.Role.CONSUMER ? "consumer" : "provider").append('\n');
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; }
private void writeMessageExchange(MessageExchange exchange) { println("-- Exchange " + exchange.getExchangeId() + " --"); writeProperty("endpoint", exchange.getEndpoint()); writeProperty("MEP", exchange.getPattern()); for (Object key : exchange.getPropertyNames()) { writeProperty(key, exchange.getProperty(key.toString())); } }
@Override public Message pollResponseFromProvider() { try { MessageExchange msgExchange = ((MockDeliveryChannel) this.component.getContext() .getDeliveryChannel()).dequeueResponseToClient(); assert !MEPConstants.IN_ONLY_PATTERN.equals(msgExchange.getPattern()) : "Polling response from provider while processing an in only exchange is meaningless."; return new WrappedResponseFromProviderMessage(msgExchange); } catch (MessagingException e) { throw new UncheckedException("Impossible to poll response to consumer message", e); } }
concrete, concrete.getPattern());
concrete, concrete.getPattern());
public void process(MessageExchange exchange) throws Exception { if (exchange.getStatus() == ExchangeStatus.DONE) { return; } else if (exchange.getStatus() == ExchangeStatus.ERROR) { return; } Message msg = createMessageFromExchange(session, exchange); if (exchange instanceof InOnly || exchange instanceof RobustInOnly) { synchronized (producer) { producer.send(msg); } exchange.setStatus(ExchangeStatus.DONE); channel.send(exchange); } else if (exchange instanceof InOut) { msg.setJMSCorrelationID(exchange.getExchangeId()); msg.setJMSReplyTo(replyToDestination); store.store(exchange.getExchangeId(), exchange); try { synchronized (producer) { producer.send(msg); } } catch (Exception e) { store.load(exchange.getExchangeId()); throw e; } } else { throw new IllegalStateException(exchange.getPattern() + " not implemented"); } }
@SuppressWarnings("null") public TransportedMessageExchange(final MessageExchange exchange) { this.exchangeId = exchange.getExchangeId(); this.status = toStatus(exchange.getStatus()); this.operation = exchange.getOperation(); this.pattern = exchange.getPattern(); this.error = exchange.getError(); this.fault = exchange.getFault(); this.in = exchange.getMessage(Exchange.IN_MESSAGE_NAME); this.out = exchange.getMessage(Exchange.OUT_MESSAGE_NAME); @SuppressWarnings({ "unchecked", "cast" }) final Set<String> propertyNames = (Set<String>) exchange.getPropertyNames(); for (String name : propertyNames) { final Object property = exchange.getProperty(name); if (property instanceof Serializable) { this.properties.put(name, (Serializable) property); } else { // TODO log?!?! } } }
} else { NormalizedMessage in = MessageUtil.copyIn(exchange); MessageExchange me = getExchangeFactory().createExchange(exchange.getPattern()); target.configureTarget(me, getContext()); MessageUtil.transferToIn(in, me);
public void handleMessage(Message message) { NormalizedMessage nm = message.getContent(NormalizedMessage.class); message.setContent(Source.class, nm.getContent()); fromNMSAttachments(message, nm); fromNMSHeaders(message, nm); if (!server) { MessageExchange me = message.getContent(MessageExchange.class); Binding binding = message.get(Binding.class); Operation operation = binding.getOperation(me.getOperation()); if (operation != null) { if (!areMepsEquals(me.getPattern(), operation.getMep())) { throw new Fault("Received incorrect exchange mep. Received " + me.getPattern() + " but expected " + operation.getMep() + " for operation " + operation.getName()); } message.put(Operation.class, operation); message.put(org.apache.servicemix.soap.api.model.Message.class, server ? operation.getOutput() : operation.getInput()); } } }
protected void processSync(MessageExchange exchange) throws Exception { if (!(exchange instanceof InOnly) && !(exchange instanceof RobustInOnly)) { fail(exchange, new UnsupportedOperationException("Use an InOnly or RobustInOnly MEP")); return; } NormalizedMessage in = MessageUtil.copyIn(exchange); for (int i = 0; i < recipients.length; i++) { MessageExchange me = getExchangeFactory().createExchange(exchange.getPattern()); recipients[i].configureTarget(me, getContext()); in.setProperty(RECIPIENT_LIST_COUNT, new Integer(recipients.length)); in.setProperty(RECIPIENT_LIST_INDEX, new Integer(i)); in.setProperty(RECIPIENT_LIST_CORRID, exchange.getExchangeId()); MessageUtil.transferToIn(in, me); sendSync(me); if (me.getStatus() == ExchangeStatus.ERROR && reportErrors) { fail(exchange, me.getError()); return; } else if (me.getFault() != null && reportErrors) { MessageUtil.transferFaultToFault(me, exchange); sendSync(exchange); done(me); return; } } done(exchange); }
tme.setProperty(correlationConsumer, exchange.getExchangeId()); tme.setProperty(TRANSFORMER, Boolean.TRUE); tme.setProperty(CONSUMER_MEP, exchange.getPattern());
protected void processSync(MessageExchange exchange) throws Exception { if (!(exchange instanceof InOnly) && !(exchange instanceof RobustInOnly)) { fail(exchange, new UnsupportedOperationException("Use an InOnly or RobustInOnly MEP")); } else { NormalizedMessage in = MessageUtil.copyIn(exchange); MessageExchange me = getExchangeFactory().createExchange(exchange.getPattern()); target.configureTarget(me, getContext()); MessageUtil.transferToIn(in, me); if (filter.matches(me)) { sendSync(me); if (me.getStatus() == ExchangeStatus.ERROR && reportErrors) { fail(exchange, me.getError()); } else if (me.getStatus() == ExchangeStatus.DONE) { done(exchange); } else if (me.getFault() != null && reportErrors) { Fault fault = MessageUtil.copyFault(me); done(me); MessageUtil.transferToFault(fault, exchange); sendSync(exchange); } } else { done(exchange); } } }
protected void processSync(MessageExchange exchange) throws Exception { if (null == target.getOperation()) { //not specify operation for the target, so save the src one by default target.setOperation(exchange.getOperation()); } // Create exchange for target MessageExchange tme = getExchangeFactory().createExchange(exchange.getPattern()); target.configureTarget(tme, getContext()); sendSyncToListenerAndTarget(exchange, tme, inListener, "in", false); if (tme.getStatus() == ExchangeStatus.DONE) { done(exchange); } else if (tme.getStatus() == ExchangeStatus.ERROR) { fail(exchange, tme.getError()); } else if (tme.getFault() != null) { sendSyncToListenerAndTarget(tme, exchange, faultListener, "fault", isCopyProperties()); done(tme); } else if (tme.getMessage("out") != null) { sendSyncToListenerAndTarget(tme, exchange, outListener, "out", isCopyProperties()); done(tme); } else { done(tme); throw new IllegalStateException("Exchange status is " + ExchangeStatus.ACTIVE + " but has no Out nor Fault message"); } }
protected void processSync(MessageExchange exchange) throws Exception { MessageExchange tme = getExchangeFactory().createExchange(exchange.getPattern());
private void processFault(MessageExchange exchange, InOut tme) throws Exception { MessageExchange me = getExchangeFactory().createExchange(exchange.getPattern()); (faultsTarget != null ? faultsTarget : target).configureTarget(me, getContext()); MessageUtil.transferToIn(tme.getFault(), me);