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


        configure(answer);
        return answer;
    }

    public RobustInOnly createRobustInOnlyExchange() throws MessagingException {
        RobustInOnly answer = client.createRobustInOnlyExchange();
        configure(answer);
        return answer;
    }
View Full Code Here

    }

    public void testRobustInOnly() 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.setStatus(ExchangeStatus.DONE);
        provider.getChannel().send(mep);
        // Consumer side
        assertSame(mec, consumer.getChannel().accept(100L));
        assertEquals(ExchangeStatus.DONE, mec.getStatus());
        // Nothing left
View Full Code Here

    }

    public void testRobustInOnlyWithFault() 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
        assertSame(mec, consumer.getChannel().accept(100L));
        assertEquals(ExchangeStatus.ACTIVE, mec.getStatus());
        assertNotNull(mec.getFault());
        mec.setStatus(ExchangeStatus.DONE);
        provider.getChannel().send(mec);
        // Provider site
        assertSame(mep, provider.getChannel().accept(100L));
        assertEquals(ExchangeStatus.DONE, mep.getStatus());
        // Nothing left
        assertNull(consumer.getChannel().accept(100L)); // receive in
        assertNull(provider.getChannel().accept(100L)); // receive in
    }
View Full Code Here

    }

    public void testRobustInOnlyWithError() 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.setStatus(ExchangeStatus.ERROR);
        provider.getChannel().send(mep);
        // Consumer side
        assertSame(mec, consumer.getChannel().accept(100L));
        assertEquals(ExchangeStatus.ERROR, mec.getStatus());
        try {
View Full Code Here

    }

    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
        assertSame(mec, consumer.getChannel().accept(100L));
        assertEquals(ExchangeStatus.ACTIVE, mec.getStatus());
        assertNotNull(mec.getFault());
        mec.setError(new Exception());
        provider.getChannel().send(mec);
        // Provider site
        assertSame(mep, 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

     * @return RobustInOnly the created exchange
     * @throws MessagingException
     */
    public RobustInOnly createRobustInOnlyExchange(MessageExchange srcExchange) throws MessagingException {
        MessageExchangeFactory factory = getExchangeFactory();
        RobustInOnly robustInOnly = factory.createRobustInOnlyExchange();

        propagateCorrelationId(srcExchange, robustInOnly);

        return robustInOnly;
    }
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.