Package org.switchyard.common.camel

Examples of org.switchyard.common.camel.SwitchYardMessage


     */
    public static DefaultMessage mapSwitchYardToCamel(
            org.switchyard.Exchange syExchange,
            org.apache.camel.Exchange camelExchange) {
       
        DefaultMessage camelMessage = new SwitchYardMessage();
        camelMessage.setBody(syExchange.getMessage().getContent());

        for (Property property : syExchange.getContext().getProperties()) {
            if (property.hasLabel(BehaviorLabel.TRANSIENT.label())
                    || ContextPropertyUtil.isReservedProperty(property.getName(), property.getScope())) {
                continue;
            }

            if (Scope.EXCHANGE.equals(property.getScope())) {
                camelExchange.setProperty(property.getName(), property.getValue());
            } else {
                camelMessage.setHeader(property.getName(), property.getValue());
            }
        }
       
        for (String attachmentName : syExchange.getMessage().getAttachmentMap().keySet()) {
            camelMessage.addAttachment(attachmentName,
                    new DataHandler(syExchange.getMessage().getAttachment(attachmentName)));
        }
       
        return camelMessage;
    }
View Full Code Here


                @Override
                public void process(Exchange exchange) throws Exception {
                    GreetingRequest rq = exchange.getIn().getBody(GreetingRequest.class);
                    GreetingResponse rp = new GreetingResponse("Ola " + rq.getName() + "!");

                    SwitchYardMessage out = new SwitchYardMessage();
                    out.setBody(rp);
                    exchange.setOut(out);
                }
            })
            .marshal(jxb)
            .convertBodyTo(String.class);
View Full Code Here

                        }
                    } catch (Exception e) {
                        throw e;
                    }
        
                    SwitchYardMessage out = new SwitchYardMessage();
                    out.setBody(body);
                    exchange.setOut(out);
                }
            });
    }
View Full Code Here

TOP

Related Classes of org.switchyard.common.camel.SwitchYardMessage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.