Package javax.jbi.messaging

Examples of javax.jbi.messaging.RobustInOnly


    }

    public void testRobustInOnlyWithFaultAndError() throws Exception {
        // Send message exchange
        MessageExchangeFactory mef = consumer.getChannel().createExchangeFactoryForService(new QName("provider"));
        RobustInOnly mec = mef.createRobustInOnlyExchange();
        NormalizedMessage m = mec.createMessage();
        m.setContent(new StringSource(PAYLOAD));
        mec.setInMessage(m);
        consumer.getChannel().send(mec);
        // Provider side
        RobustInOnly mep = (RobustInOnly) provider.getChannel().accept(100L);
        assertNotNull(mep);
        assertEquals(ExchangeStatus.ACTIVE, mep.getStatus());
        mep.setFault(mep.createFault());
        provider.getChannel().send(mep);
        // Consumer side
        mec = (RobustInOnly) consumer.getChannel().accept(100L);
        assertEquals(ExchangeStatus.ACTIVE, mec.getStatus());
        assertNotNull(mec.getFault());
        mec.setError(new Exception());
        provider.getChannel().send(mec);
        // Provider site
        mep = (RobustInOnly) provider.getChannel().accept(100L);
        assertEquals(ExchangeStatus.ERROR, mep.getStatus());
        try {
            mep.setStatus(ExchangeStatus.DONE);
            provider.getChannel().send(mep);
            fail("Exchange status is ERROR");
        } catch (Exception e) {
            // ok
        }
View Full Code Here


        content.close();
        InputStream in = content.getInputStream();
        if (in == null) {
            throw new JBIException("No input available for file!");
        }
        RobustInOnly exchange = getExchangeFactory().createRobustInOnlyExchange();
        NormalizedMessage message = exchange.createMessage();
        exchange.setInMessage(message);
        marshaler.readMessage(exchange, message, in, name);
        getDeliveryChannel().sendSync(exchange);
        in.close();
        content.close();
        if (exchange.getError() != null) {
            throw exchange.getError();
        }
    }
View Full Code Here

        configureEndpoint(exchange, resolver);
        return exchange;
    }

    public RobustInOnly createRobustInOnlyExchange() throws MessagingException {
        RobustInOnly exchange = getExchangeFactory().createRobustInOnlyExchange();
        NormalizedMessage in = exchange.createMessage();
        exchange.setInMessage(in);
        return exchange;
    }
View Full Code Here

        exchange.setInMessage(in);
        return exchange;
    }

    public RobustInOnly createRobustInOnlyExchange(EndpointResolver resolver) throws JBIException {
        RobustInOnly exchange = getExchangeFactory().createRobustInOnlyExchange();
        configureEndpoint(exchange, resolver);
        return exchange;
    }
View Full Code Here

        configureEndpoint(exchange, resolver);
        return exchange;
    }

    public RobustInOnly createRobustInOnlyExchange() throws MessagingException {
        RobustInOnly exchange = getExchangeFactory().createRobustInOnlyExchange();
        NormalizedMessage in = exchange.createMessage();
        exchange.setInMessage(in);
        return exchange;
    }
View Full Code Here

        exchange.setInMessage(in);
        return exchange;
    }

    public RobustInOnly createRobustInOnlyExchange(EndpointResolver resolver) throws JBIException {
        RobustInOnly exchange = getExchangeFactory().createRobustInOnlyExchange();
        configureEndpoint(exchange, resolver);
        return exchange;
    }
View Full Code Here

        path.getAbsolutePath());
    component.getServiceUnitManager().start("provider");

    // Call it
    DefaultServiceMixClient client = new DefaultServiceMixClient(container);
    RobustInOnly in = client.createRobustInOnlyExchange();
    in.setInterfaceName(new QName("http://http.servicemix.org/Test",
        "ProviderInterface"));
    in.getInMessage().setContent(
        new StreamSource(new ByteArrayInputStream(msg.getBytes())));

    long t0 = System.currentTimeMillis();
    client.sendSync(in);
    long t1 = System.currentTimeMillis();
    assertTrue(in.getStatus() == ExchangeStatus.DONE);

    // Check we received the message
    receiver.getMessageList().assertMessagesReceived(1);

    component.getServiceUnitManager().stop("provider");
View Full Code Here

        component.getServiceUnitManager().deploy("consumer", path.getAbsolutePath());
        component.getServiceUnitManager().start("consumer");
       
        // Call it
        DefaultServiceMixClient client = new DefaultServiceMixClient(container);
        RobustInOnly in = client.createRobustInOnlyExchange();
        in.setService(new QName("urn:test", "invoker"));
        in.getInMessage().setContent(new StreamSource(new ByteArrayInputStream(msg.getBytes())));
       
        long t0 = System.currentTimeMillis();
        client.sendSync(in);
        long t1 = System.currentTimeMillis();
        assertEquals(ExchangeStatus.DONE, in.getStatus());
       
        // Check we received the message
        receiver.getMessageList().assertMessagesReceived(1);
       
        return t1 - t0;
View Full Code Here

   
    public void testRobustInOnly() throws Exception {
        activateComponent(new ReturnOutComponent(), "transformer");
        ReceiverComponent target = activateReceiver("target");

        RobustInOnly me = client.createRobustInOnlyExchange();
        me.setService(new QName("pipeline"));
        me.getInMessage().setContent(createSource("<hello/>"));
        client.sendSync(me);
        assertEquals(ExchangeStatus.DONE, me.getStatus());
       
        target.getMessageList().assertMessagesReceived(1);
       
        listener.assertExchangeCompleted();
    }
View Full Code Here

   
    public void testRobustInOnlyWithTransformerFault() throws Exception {
        activateComponent(new ReturnFaultComponent(), "transformer");
        ReceiverComponent target = activateReceiver("target");

        RobustInOnly me = client.createRobustInOnlyExchange();
        me.setService(new QName("pipeline"));
        me.getInMessage().setContent(createSource("<hello/>"));
        client.sendSync(me);
        assertEquals(ExchangeStatus.ACTIVE, me.getStatus());
        assertNotNull(me.getFault());
        client.done(me);
       
        target.getMessageList().assertMessagesReceived(0);
       
        listener.assertExchangeCompleted();
View Full Code Here

TOP

Related Classes of javax.jbi.messaging.RobustInOnly

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.