public MessageExchange createExchange(URI pattern, String id) throws javax.jbi.messaging.MessagingException { MessageExchange me; me = createExchangeFactory().createExchange(pattern); ((MessageExchangeProxy)me).getMessageExchange().setExchangeId(id); return (me); }
public MessageExchange createExchange(HttpServletRequest request, ComponentContext context) throws Exception { MessageExchange me = context.getDeliveryChannel().createExchangeFactory().createExchange(getDefaultMep()); NormalizedMessage in = me.createMessage(); in.setContent(new StreamSource(getRequestEncodingStream(request.getHeader(HttpHeaders.CONTENT_ENCODING), request.getInputStream()))); me.setMessage(in, "in"); return me; }
protected MessageExchange createTargetExchange(NormalizedMessage message, URI exchangePattern) throws MessagingException { MessageExchange targetExchange = getExchangeFactory().createExchange(exchangePattern); target.configureTarget(targetExchange, getContext()); MessageUtil.transferToIn(message, targetExchange); return targetExchange; }
/** * Return a <code>MessageExchangeDecorator</code> for Consumer, as * <code>InOnlyExchange, InOutExchange,...</code> * * @see javax.jbi.messaging.MessageExchangeFactory#createExchange(java.net.URI) * @param pattern * the pattern * @return * the message exchange * @throws MessagingException * impossible to create the message exchange */ public MessageExchange createExchange(final URI pattern) throws MessagingException { // Create the concrete message exchange MessageExchange meC = this.concreteMef.createExchange(pattern); // Convert into fake message exchange MessageExchange meF = Convert. convertConcreteMessageExchangeToFakeMessageExchange(meC, null); ((org.objectweb.petals.tools.rmi.common.serializable. MessageExchange) meF).setRole(meC.getRole()); // Store the messages this.messages.put(meF.getExchangeId(), meC); return meF; }
protected MessageExchange createPart(URI pattern, NormalizedMessage srcMessage, Source content) throws Exception { MessageExchange me = getExchangeFactory().createExchange(pattern); NormalizedMessage in = me.createMessage(); in.setContent(content); me.setMessage(in, "in"); if (forwardAttachments) { Set names = srcMessage.getAttachmentNames(); for (Iterator iter = names.iterator(); iter.hasNext();) { String name = (String) iter.next(); in.addAttachment(name, srcMessage.getAttachment(name)); } } if (forwardProperties) { Set names = srcMessage.getPropertyNames(); for (Iterator iter = names.iterator(); iter.hasNext();) { String name = (String) iter.next(); in.setProperty(name, srcMessage.getProperty(name)); } } return me; }
/** * TODO find an endpoint for this parameteters. Return a * <code>MessageExchangeDecorator</code> for Consumer * * @see javax.jbi.messaging.MessageExchangeFactory#createExchange(javax.xml.namespace.QName, * javax.xml.namespace.QName) * @param serviceName * the service name * @param operationName * the operationName * @return * the message exchange * @throws MessagingException * impossible to create the message exchange */ public MessageExchange createExchange( final QName serviceName, final QName operationName) throws MessagingException { // Create the concrete message exchange MessageExchange meC = this.concreteMef.createExchange(serviceName, operationName); // Convert into fake message exchange MessageExchange meF = Convert. convertConcreteMessageExchangeToFakeMessageExchange(meC, null); ((org.objectweb.petals.tools.rmi.common.serializable. MessageExchange) meF).setRole(meC.getRole()); // Store the messages this.messages.put(meF.getExchangeId(), meC); return meF; }
public MessageExchange createExchange(HttpServletRequest request, ComponentContext context) throws Exception { MessageExchange me = context.getDeliveryChannel().createExchangeFactory().createExchange(getDefaultMep()); NormalizedMessage in = me.createMessage(); in.setContent(marshal(request.getInputStream())); me.setMessage(in, "in"); return me; }
/** * Create the JBI exchange */ private MessageExchange createExchange(Message message) throws JBIException { URI mep; Operation operation = message.get(Operation.class); if (operation != null) { mep = operation.getMep(); } else { mep = (URI) message.get(OPERATION_MEP); } if (mep == null) { throw new NullPointerException("MEP not found"); } MessageExchangeFactory mef = message.get(MessageExchangeFactory.class); if (mef == null) { DeliveryChannel dv = message.get(DeliveryChannel.class); if (dv == null) { ComponentContext cc = message.get(ComponentContext.class); if (cc == null) { throw new NullPointerException("MessageExchangeFactory or DeliveryChannel or ComponentContext not found"); } dv = cc.getDeliveryChannel(); } mef = dv.createExchangeFactory(); } return mef.createExchange(mep); }
public MessageExchange createExchange(JmsContext jmsContext, ComponentContext jbiContext) throws Exception { Context ctx = (Context) jmsContext; MessageExchange exchange = jbiContext.getDeliveryChannel().createExchangeFactory().createExchange(mep); NormalizedMessage inMessage = exchange.createMessage(); populateMessage(ctx.message, inMessage); if (isCopyProperties()) { copyPropertiesFromJMS(ctx.message, inMessage); } exchange.setMessage(inMessage, "in"); return exchange; }
protected MessageExchange createJbiMessageExchange(Exchange camelExchange, MessageExchangeFactory exchangeFactory, String defaultMep) throws MessagingException, URISyntaxException { // option 1 -- use the MEP that was configured on the endpoint URI ExchangePattern mep = ExchangePattern.fromWsdlUri(defaultMep); if (mep == null) { // option 2 -- use the MEP from the Camel Exchange mep = camelExchange.getPattern(); } MessageExchange answer = null; if (mep != null) { if (mep == ExchangePattern.InOnly) { answer = exchangeFactory.createInOnlyExchange(); } else if (mep == ExchangePattern.InOptionalOut) { answer = exchangeFactory.createInOptionalOutExchange(); } else if (mep == ExchangePattern.InOut) { answer = exchangeFactory.createInOutExchange(); } else if (mep == ExchangePattern.RobustInOnly) { answer = exchangeFactory.createRobustInOnlyExchange(); } else { answer = exchangeFactory.createExchange(new URI(mep.toString())); } } if (getOperation(camelExchange) != null) { answer.setOperation(getOperation(camelExchange)); } return answer; }
} else { NormalizedMessage in = MessageUtil.copyIn(exchange); MessageExchange me = getExchangeFactory().createExchange(exchange.getPattern()); target.configureTarget(me, getContext()); MessageUtil.transferToIn(in, me);
MessageExchange me = mef.createExchange(mep); me.setOperation(operation.getName()); return me;
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); }
try { client = registry.getContainer().getClientFactory().createClient(); MessageExchange me = client.getExchangeFactory().createExchange(URI.create(mep)); NormalizedMessage nm = me.createMessage(); me.setMessage(nm, "in");
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"); } }
MessageExchange me = getExchangeFactory().createExchange(exchange.getPattern()); target.configureTarget(me, getContext()); MessageUtil.transferOutToIn(tme, me);
protected void processSync(MessageExchange exchange) throws Exception { MessageExchange tme = getExchangeFactory().createExchange(exchange.getPattern());
public void process(MessageExchange exchange) throws Exception { if (exchange.getRole() == MessageExchange.Role.PROVIDER && exchange.getProperty(correlation) == null) { MessageExchange tme = getExchangeFactory().createExchange(exchange.getPattern()); if (store.hasFeature(Store.CLUSTERED)) { exchange.setProperty(JbiConstants.STATELESS_PROVIDER, Boolean.TRUE);
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);