Package javax.jbi.messaging

Examples of javax.jbi.messaging.NormalizedMessage


                       && !(exchange instanceof RobustInOnly)) {
                fail(exchange, new UnsupportedOperationException("Use an InOnly or RobustInOnly MEP"));
            } else if (exchange.getFault() != null) {
                done(exchange);
            } else {
                NormalizedMessage in = MessageUtil.copyIn(exchange);
                for (int i = 0; i < recipients.length; i++) {
                    MessageExchange me = getExchangeFactory().createExchange(exchange.getPattern());
                    recipients[i].configureTarget(me, getContext());
                    MessageUtil.transferToIn(in, me);
                    send(me);
View Full Code Here


                                                  MessageExchangeFactory exchangeFactory,
                                                  String defaultMep)
        throws MessagingException, URISyntaxException {
       
        MessageExchange jbiExchange = createJbiMessageExchange(camelExchange, exchangeFactory, defaultMep);
        NormalizedMessage normalizedMessage = jbiExchange.getMessage("in");
        if (normalizedMessage == null) {
            normalizedMessage = jbiExchange.createMessage();
            jbiExchange.setMessage(normalizedMessage, "in");
        }
        normalizedMessage.setContent(getJbiInContent(camelExchange));
        addJbiHeaders(jbiExchange, normalizedMessage, camelExchange);
        return jbiExchange;
    }
View Full Code Here

        try {
            String name = aFile.getCanonicalPath();
            in = new BufferedInputStream(new FileInputStream(aFile));
            InOnly exchange = getExchangeFactory().createInOnlyExchange();
            configureExchangeTarget(exchange);
            NormalizedMessage message = exchange.createMessage();
            exchange.setInMessage(message);
            marshaler.readMessage(exchange, message, in, name);
            sendSync(exchange);
            if (exchange.getStatus() == ExchangeStatus.ERROR) {
                Exception e = exchange.getError();
View Full Code Here

            }
        }
    }
   
    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;
    }
View Full Code Here

        }
        if (oneWay) {
            exchange.setStatus(ExchangeStatus.DONE);
            channel.send(exchange);
        } else {
            NormalizedMessage msg = exchange.createMessage();
            exchange.setMessage(msg, "out");
            StringWriter writer = new StringWriter();
            jaxbContext.createMarshaller().marshal(output, writer);
            msg.setContent(new StringSource(writer.toString()));
            channel.send(exchange);
        }
    }
View Full Code Here

   
    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;
    }
View Full Code Here

        public void onMessageExchange(MessageExchange exchange) throws MessagingException {
            if (exchange.getStatus() == ExchangeStatus.ACTIVE) {
                boolean txSync = exchange.isTransacted()
                    && Boolean.TRUE.equals(exchange.getProperty(JbiConstants.SEND_SYNC));
                if (exchange.getMessage("out") == null) {
                    NormalizedMessage out = exchange.createMessage();
                    out.setContent(createSource("<outMsg/>"));
                    exchange.setMessage(out, "out");
                    if (txSync) {
                        sendSync(exchange);
                    } else {
                        send(exchange);
View Full Code Here

        }
        public void onMessageExchange(MessageExchange exchange) throws MessagingException {
            if (exchange.getStatus() == ExchangeStatus.ACTIVE) {
                boolean txSync = exchange.isTransacted()
                    && Boolean.TRUE.equals(exchange.getProperty(JbiConstants.SEND_SYNC));
                NormalizedMessage out = exchange.createMessage();
                out.setContent(createSource(response));
                exchange.setMessage(out, "out");
                if (txSync) {
                    sendSync(exchange);
                } else {
                    send(exchange);
View Full Code Here

        public void onMessageExchange(MessageExchange exchange) throws MessagingException {
            if (exchange.getStatus() == ExchangeStatus.ACTIVE) {
                if (exchange.getMessage("out") == null) {
                    boolean txSync = exchange.isTransacted()
                        && Boolean.TRUE.equals(exchange.getProperty(JbiConstants.SEND_SYNC));
                    NormalizedMessage out = exchange.createMessage();
                    out.setContent(createSource("<outMsg/>"));
                    exchange.setMessage(out, "out");
                    if (txSync) {
                        sendSync(exchange);
                    } else {
                        send(exchange);
View Full Code Here

        wsnBroker.notify("myTopic", parse("<hello>world</hello>"));
        // Wait for notification
        Thread.sleep(150);

        receiver.getMessageList().assertMessagesReceived(1);
        NormalizedMessage msg = (NormalizedMessage) receiver.getMessageList().getMessages().get(0);
        Node node = new SourceTransformer().toDOMNode(msg);
        assertEquals("Notify", node.getLocalName());

        // Wait for acks to be processed
        Thread.sleep(150);
View Full Code Here

TOP

Related Classes of javax.jbi.messaging.NormalizedMessage

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.