Examples of InOut


Examples of javax.jbi.messaging.InOut

        activateComponent(new ReturnMockComponent("<from2/>"), "target2");
        activateComponent(new ReturnMockComponent("<from3/>"), "target3");
       
        tm.begin();
       
        InOut me = client.createInOutExchange();
        me.setService(new QName("router"));
        me.getInMessage().setContent(createSource("<hello id='1' />"));
        client.send(me);
       
        tm.commit();
       
        me = (InOut) client.receive();
        assertEquals(ExchangeStatus.ACTIVE, me.getStatus());
        Node node = new SourceTransformer().toDOMNode(me.getOutMessage());
        assertEquals("from1", node.getFirstChild().getNodeName());
        client.done(me);
       
        tm.begin();
       
        me = client.createInOutExchange();
        me.setService(new QName("router"));
        me.getInMessage().setContent(createSource("<hello id='2' />"));
        client.send(me);
       
        tm.commit();
       
        me = (InOut) client.receive();
        assertEquals(ExchangeStatus.ACTIVE, me.getStatus());
        node = new SourceTransformer().toDOMNode(me.getOutMessage());
        assertEquals("from2", node.getFirstChild().getNodeName());
        client.done(me);
       
        tm.begin();
       
        me = client.createInOutExchange();
        me.setService(new QName("router"));
        me.getInMessage().setContent(createSource("<hello id='3' />"));
        client.send(me);
       
        tm.commit();
       
        me = (InOut) client.receive();
        assertEquals(ExchangeStatus.ACTIVE, me.getStatus());
        node = new SourceTransformer().toDOMNode(me.getOutMessage());
        assertEquals("from3", node.getFirstChild().getNodeName());
        client.done(me);
    }
View Full Code Here

Examples of javax.jbi.messaging.InOut

        configurePattern(pipeline);
        activateComponent(pipeline, "pipeline");
    }
   
    public void testInOut() throws Exception {
        InOut me = client.createInOutExchange();
        me.setService(new QName("pipeline"));
        me.getInMessage().setContent(createSource("<hello/>"));
        client.sendSync(me);
        assertEquals(ExchangeStatus.ERROR, me.getStatus());
    }
View Full Code Here

Examples of javax.jbi.messaging.InOut

        String id = (String) getProperty(exchange, Constants.PROPERTY_CORRELATIONID);
        Aggregation ag = (Aggregation) aggregations.get(id);
        QName[] recipients = (QName[]) getOutProperty(exchange, Constants.PROPERTY_RECIPIENTS);
        ag.numbers = recipients.length;
        for (int i = 0; i < recipients.length; i++) {
            InOut inout = createInOutExchange(recipients[i], null, null);
            inout.setProperty(Constants.PROPERTY_CORRELATIONID, id);
            NormalizedMessage msg = inout.createMessage();
            msg.setProperty(Constants.PROPERTY_SSN, ag.ssn);
            msg.setProperty(Constants.PROPERTY_AMOUNT, ag.amount);
            msg.setProperty(Constants.PROPERTY_DURATION, ag.duration);
            msg.setProperty(Constants.PROPERTY_SCORE, ag.score);
            msg.setProperty(Constants.PROPERTY_HISTORYLENGTH, ag.hlength);
            inout.setInMessage(msg);
            send(inout);
        }
        done(exchange);
    }
View Full Code Here

Examples of javax.jbi.messaging.InOut

        Aggregation ag = (Aggregation) aggregations.get(id);
        // Fill with infos
        ag.score  = (Integer) getOutProperty(exchange, Constants.PROPERTY_SCORE);
        ag.hlength = (Integer) getOutProperty(exchange, Constants.PROPERTY_HISTORYLENGTH);
        // Send to lender gateway
        InOut inout = createInOutExchange(new QName(Constants.LOANBROKER_NS, Constants.LENDERGATEWAY_SERVICE), null, null);
        inout.setProperty(Constants.PROPERTY_CORRELATIONID, id);
        NormalizedMessage msg = inout.createMessage();
        msg.setProperty(Constants.PROPERTY_SCORE, ag.score);
        msg.setProperty(Constants.PROPERTY_HISTORYLENGTH, ag.hlength);
        msg.setProperty(Constants.PROPERTY_AMOUNT, ag.amount);
        inout.setInMessage(msg);
        send(inout);
        done(exchange);
    }
View Full Code Here

Examples of javax.jbi.messaging.InOut

            ag.ssn = (String) getInProperty(exchange, Constants.PROPERTY_SSN);
            ag.amount = (Double) getInProperty(exchange, Constants.PROPERTY_AMOUNT);
            ag.duration = (Integer) getInProperty(exchange, Constants.PROPERTY_DURATION);
            aggregations.put(id, ag);
           
            InOut inout = createInOutExchange(new QName(Constants.LOANBROKER_NS, Constants.CREDITAGENCY_SERVICE), null, null);
            inout.setProperty(Constants.PROPERTY_CORRELATIONID, id);
            NormalizedMessage msg = inout.createMessage();
            msg.setProperty(Constants.PROPERTY_SSN, ag.ssn);
            inout.setInMessage(msg);
            send(inout);
        }
    }
View Full Code Here

Examples of javax.jbi.messaging.InOut

        jbi.activateComponent(m2, "mock2");
        jbi.activateComponent(m3, "mock3");
       
        jbi.start();
       
        InOut me = client.createInOutExchange();
        me.setService(new QName("drools"));
        me.getInMessage().setContent(new StringSource("<test id='0' />"));
        client.sendSync(me);
        assertNotNull(me.getFault());
        client.done(me);
       
        me = client.createInOutExchange();
        me.setService(new QName("drools"));
        me.getInMessage().setContent(new StringSource("<test id='1' />"));
        client.sendSync(me);
        Element e = new SourceTransformer().toDOMElement(me.getOutMessage());
        assertEquals("target1", e.getLocalName());
        client.done(me);

        me = client.createInOutExchange();
        me.setService(new QName("drools"));
        me.getInMessage().setContent(new StringSource("<test id='2' />"));
        client.sendSync(me);
        e = new SourceTransformer().toDOMElement(me.getOutMessage());
        assertEquals("target2", e.getLocalName());
        client.done(me);

        me = client.createInOutExchange();
        me.setService(new QName("drools"));
        me.getInMessage().setContent(new StringSource("<test id='3' />"));
        me.getInMessage().setProperty("prop", Boolean.TRUE);
        client.sendSync(me);
        e = new SourceTransformer().toDOMElement(me.getOutMessage());
        assertEquals("target3", e.getLocalName());
        client.done(me);

        me = client.createInOutExchange();
        me.setService(new QName("drools"));
        me.getInMessage().setContent(new StringSource("<test id='4' />"));
        client.sendSync(me);
        assertEquals(ExchangeStatus.ERROR, me.getStatus());
       
        Thread.sleep(50);
    }
View Full Code Here

Examples of javax.jbi.messaging.InOut

        drools.setEndpoints(new DroolsEndpoint[] {endpoint });
        jbi.activateComponent(drools, "servicemix-drools");
       
        jbi.start();
       
        InOut me = client.createInOutExchange();
        me.setService(new QName("drools"));
        me.getInMessage().setContent(new StringSource("<fibonacci>50</fibonacci>"));
        me.getInMessage().setProperty("prop", Boolean.TRUE);
        client.sendSync(me);
        Element e = new SourceTransformer().toDOMElement(me.getOutMessage());
        assertEquals("result", e.getLocalName());
        assertEquals("12586269025", e.getTextContent());
        client.done(me);

        me = client.createInOutExchange();
        me.setService(new QName("drools"));
        me.getInMessage().setContent(new StringSource("<fibonacci>150</fibonacci>"));
        me.getInMessage().setProperty("prop", Boolean.TRUE);
        client.sendSync(me);
        assertNotNull(me.getFault());
        client.done(me);
       
        Thread.sleep(50);
    }
View Full Code Here

Examples of javax.jbi.messaging.InOut

            && !(exchange instanceof RobustInOnly)) {
            fail(exchange, new UnsupportedOperationException("Use an InOnly or RobustInOnly MEP"));
            return;
        }
        // Create exchange for target
        InOut tme = getExchangeFactory().createInOutExchange();
        transformer.configureTarget(tme, getContext());
        // Send in to listener and target
        MessageUtil.transferInToIn(exchange, tme);
        sendSync(tme);
        // Check result
        if (tme.getStatus() == ExchangeStatus.DONE) {
            throw new IllegalStateException("Received a DONE status from the transformer");
        // Errors must be sent back to the consumer
        } else if (tme.getStatus() == ExchangeStatus.ERROR) {
            fail(exchange, tme.getError());
        } else if (tme.getFault() != null) {
            processFault(exchange, tme);
        // This should not happen
        } else if (tme.getOutMessage() == null) {
            throw new IllegalStateException("Exchange status is " + ExchangeStatus.ACTIVE
                    + " but has no correlation set");
        // This is the answer from the transformer
        } else {
            MessageExchange me = getExchangeFactory().createExchange(exchange.getPattern());
View Full Code Here

Examples of javax.jbi.messaging.InOut

        configurePattern(recipientList);
        activateComponent(recipientList, "recipientList");
    }

    public void testInOut() throws Exception {
        InOut me = client.createInOutExchange();
        me.setService(new QName("recipientList"));
        me.getInMessage().setContent(createSource("<hello/>"));
        client.sendSync(me);
        assertEquals(ExchangeStatus.ERROR, me.getStatus());
    }
View Full Code Here

Examples of javax.jbi.messaging.InOut

        activateComponent(new ReturnOutComponent(), "target2");
        activateComponent(new ReturnOutComponent(), "target3");

        tm.begin();
       
        InOut me = client.createInOutExchange();
        me.setService(new QName("routingSlip"));
        me.getInMessage().setContent(createSource("<hello/>"));
        client.sendSync(me);
        assertEquals(ExchangeStatus.ACTIVE, me.getStatus());
        assertNotNull(me.getOutMessage());
        client.done(me);
       
        tm.commit();
       
        listener.assertExchangeCompleted();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.