Package javax.jbi.messaging

Examples of javax.jbi.messaging.NormalizedMessage


        this.defaultMep = defaultMep;
    }

    public MessageExchange createExchange(HttpServletRequest request, ComponentContext context) throws Exception {
        MessageExchange me = context.getDeliveryChannel().createExchangeFactory().createExchange(getDefaultMep());
        NormalizedMessage in = me.createMessage();
        InputStream is = request.getInputStream();
        is = new BufferedInputStream(is);
        in.setContent(new StreamSource(is));
        me.setMessage(in, "in");
        return me;
    }
View Full Code Here


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

                       && !(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);
                MessageExchange me = getExchangeFactory().createExchange(exchange.getPattern());
                target.configureTarget(me, getContext());
                MessageUtil.transferToIn(in, me);
                if (filter.matches(me)) {
                    send(me);
View Full Code Here

            return;
        }
        System.err.println(inOut.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));
            inOut.setOutMessage(answer);
            channel.send(inOut);
        } catch (Exception e) {
            inOut.setError(e);
            channel.send(inOut);
View Full Code Here

                SoapFault fault = new SoapFault(SoapFault.RECEIVER, null, null, null, jbiFault.getContent());
                SoapMessage soapFault = soapHelper.onFault(ctx, fault);
                Map headers = (Map) jbiFault.getProperty(JbiConstants.PROTOCOL_HEADERS);
                response = endpoint.getMarshaler().toJMS(soapFault, headers, session);
            } else {
                NormalizedMessage outMsg = exchange.getMessage("out");
                if (outMsg != null) {
                    SoapMessage out = soapHelper.onReply(ctx, outMsg);
                    Map headers = (Map) outMsg.getProperty(JbiConstants.PROTOCOL_HEADERS);
                    response = endpoint.getMarshaler().toJMS(out, headers, session);
                }
            }
        }
        return response;
View Full Code Here

        InOut inout = client.createInOutExchange();
        inout.setInterfaceName(new QName("http://jms.servicemix.org/Test", "ProviderInterface"));
        inout.getInMessage().setContent(new StringSource("<hello>world</hello>"));
        boolean result = client.sendSync(inout);
        assertTrue(result);
        NormalizedMessage out = inout.getOutMessage();
        assertNotNull(out);
        Source src = out.getContent();
        assertNotNull(src);
        logger.info(new SourceTransformer().toString(src));
    }
View Full Code Here

        InOut inout = client.createInOutExchange();
        inout.setInterfaceName(new QName("http://jms.servicemix.org/Test", "ProviderInterface"));
        inout.getInMessage().setContent(new StringSource("<hello>world</hello>"));
        boolean result = client.sendSync(inout);
        assertTrue(result);
        NormalizedMessage out = inout.getOutMessage();
        assertNotNull(out);
        Source src = out.getContent();
        assertNotNull(src);
        logger.info(new SourceTransformer().toString(src));
    }
View Full Code Here

        TextMessage message = qSess.createTextMessage("<?xml version=\"1.0\" encoding=\"UTF-8\"?><hello>world</hello>");
        qSender.send(message);

        receiver.getMessageList().assertMessagesReceived(1);
        List msgs = receiver.getMessageList().flushMessages();
        NormalizedMessage msg = (NormalizedMessage) msgs.get(0);
        assertEquals("Messages match", message.getText(), new SourceTransformer().contentToString(msg));

        // Wait for DONE status
        Thread.sleep(50);
    }
View Full Code Here

                    destination = session.createTopic(endpoint.getJmsProviderDestinationName());
                }
            }
            MessageProducer producer = session.createProducer(destination);

            NormalizedMessage nm = exchange.getMessage("in");
            Message msg = fromNMS(nm, session);
            producer.send(msg);
        } finally {
            if (session != null) {
                session.close();
View Full Code Here

    public void testSendingToStaticEndpoint() throws Exception {
        DefaultServiceMixClient client = new DefaultServiceMixClient(jbi);
        InOnly me = client.createInOnlyExchange();
        me.setService(new QName("urn:test", "service"));
        NormalizedMessage message = me.getInMessage();

        message.setProperty("name", "cheese");
        message.setContent(new StringSource("<hello>world</hello>"));

        client.sendSync(me);
        assertExchangeWorked(me);

        ListenerBean bean = (ListenerBean) getBean("listenerBean");
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.