Package javax.jbi.messaging

Examples of javax.jbi.messaging.NormalizedMessage


    }
    */

    public void route(String uri) throws MessagingException {
        MessageExchange me = this.exchange.getInternalExchange();
        NormalizedMessage in = me.getMessage("in");
        MessageExchange newMe = getChannel().createExchangeFactory().createExchange(me.getPattern());
        URIResolver.configureExchange(newMe, getContext(), uri);
        MessageUtil.transferToIn(in, newMe);
        getChannel().sendSync(newMe);
        if (newMe.getStatus() == ExchangeStatus.DONE) {
View Full Code Here


        update();
    }

    public void answer(String content) throws Exception {
        MessageExchange me = this.exchange.getInternalExchange();
        NormalizedMessage out = me.createMessage();
        out.setContent(new StringSource(content));
        me.setMessage(out, "out");
        getChannel().sendSync(me);
        update();
    }
View Full Code Here

        this.marshaler = marshaler;
    }

    public void process(MessageExchange exchange) throws Exception {
        if (exchange.getStatus() == ExchangeStatus.ACTIVE) {
            NormalizedMessage nm = exchange.getMessage("in");
            if (nm == null) {
                throw new IllegalStateException("Exchange has no input message");
            }
            SmxHttpExchange httpEx = new Exchange(exchange);
            marshaler.createRequest(exchange, nm, httpEx);
View Full Code Here

    public void testSendingToStaticEndpoint() throws Exception {
        for (int i = 0; i < NUMBER; i++) {
            DefaultServiceMixClient client = new DefaultServiceMixClient(jbi);
            InOnly me = client.createInOnlyExchange();
            me.setService(new QName("urn:test", "service"));
            NormalizedMessage message = me.getInMessage();
   
            message.setProperty(DefaultFileMarshaler.FILE_NAME_PROPERTY, "test2.xml");
            message.setContent(new StringSource("<hello>world</hello>"));
   
            client.sendSync(me);
            assertExchangeWorked(me);
        }
    }
View Full Code Here

                MessageExchange me = factory.createExchange(mep);
                me.setInterfaceName((QName) context.getService().getProperty(JBI_INTERFACE_NAME));
                me.setOperation(context.getExchange().getOperation().getQName());
                me.setService((QName) context.getService().getProperty(JBI_SERVICE_NAME));
                me.setEndpoint((ServiceEndpoint) context.getService().getProperty(JBI_ENDPOINT));
                NormalizedMessage msg = me.createMessage();
                me.setMessage(msg, "in");
                if (Boolean.TRUE.equals(context.getService().getProperty(JBI_SECURITY_PROPAGATATION))) {
                    MessageExchange oldMe = JBIContext.getMessageExchange();
                    NormalizedMessage oldMsg = (oldMe != null) ? oldMe.getMessage("in") : null;
                    if (oldMsg != null) {
                        msg.setSecuritySubject(oldMsg.getSecuritySubject());
                    }
                }
                msg.setContent(getContent(context, message));
                if (!channel.sendSync(me)) {
                    throw new XFireException("Unable to send jbi exchange: sendSync returned false");
View Full Code Here

        }
        log.info(getService().getLocalPart() + " requested");
        try {
            String output = "<getLoanQuoteResponse xmlns=\"urn:logicblaze:soa:bank\"><rate>"
                + (Math.ceil(1000 * Math.random()) / 100) + "</rate></getLoanQuoteResponse>";
            NormalizedMessage answer = inOut.createMessage();
            answer.setContent(new StringSource(output));
            answer(inOut, answer);
        } catch (Exception e) {
            throw new MessagingException(e);
        }
    }
View Full Code Here

        ServiceMixClient client = new DefaultServiceMixClient(jbi);
        InOut me = client.createInOutExchange();
        me.setService(new QName("bean"));
        me.setOperation(new QName("receive"));
        NormalizedMessage nm = me.getInMessage();
        nm.setContent(new StringSource("<hello>world</hello>"));
        client.sendSync(me);
        assertExchangeWorked(me);
        client.done(me);
    }
View Full Code Here

                    output = "<getCreditHistoryLengthResponse xmlns=\"urn:logicblaze:soa:creditagency\"><length>"
                        + getCreditHistoryLength(ssn) + "</length></getCreditHistoryLengthResponse>";
                } else {
                    throw new UnsupportedOperationException(operation);
                }
                NormalizedMessage answer = inOut.createMessage();
                answer.setContent(new StringSource(output));
                answer(inOut, answer);
            }
        } catch (Exception e) {
            throw new MessagingException(e);
        }
View Full Code Here

            } else if (exchange instanceof InOptionalOut) {
                if (payload == null) {
                    exchange.setStatus(ExchangeStatus.DONE);
                    channel.send(exchange);
                } else {
                    NormalizedMessage out = exchange.createMessage();
                    out.setContent(new DOMSource(getDocument(payload)));
                    exchange.setMessage(out, "out");
                    channel.send(exchange);
                }
            } else if (exchange instanceof InOut) {
                if (payload == null) {
                    throw new UnsupportedOperationException("Expected return data for in-out");
                }
                NormalizedMessage out = exchange.createMessage();
                out.setContent(new DOMSource(getDocument(payload)));
                exchange.setMessage(out, "out");
                channel.send(exchange);
            } else {
                throw new UnsupportedOperationException("Unhandled mep: " + exchange.getPattern());
            }
View Full Code Here

        ServiceMixClient client = new DefaultServiceMixClient(jbi);
        InOut me = client.createInOutExchange();
        me.setService(new QName("bean"));
        me.setOperation(new QName("receive"));
        NormalizedMessage nm = me.getInMessage();
        nm.setContent(new StringSource("<hello>world</hello>"));
        client.sendSync(me);
        assertExchangeWorked(me);
        client.done(me);
    }
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.