Package org.apache.cxf.transport

Examples of org.apache.cxf.transport.MessageObserver


        if (exchange.isSynchronous() || executor == null) {
            exchange.put(MessageObserver.class, this);
        } else {
            exchange.put(Executor.class, executor);
            exchange.put(MessageObserver.class, new MessageObserver() {
                public void onMessage(final Message message) {
                    if (!message.getExchange()
                        .containsKey(Executor.class.getName() + ".USING_SPECIFIED")) {
                       
                        executor.execute(new Runnable() {
View Full Code Here


    public CamelDestination setupCamelDestination(EndpointInfo endpointInfo, boolean send) throws IOException {
        ConduitInitiator conduitInitiator = EasyMock.createMock(ConduitInitiator.class);
        CamelDestination camelDestination = new CamelDestination(context, bus, conduitInitiator, endpointInfo);
        if (send) {
            // setMessageObserver
            observer = new MessageObserver() {
                public void onMessage(Message m) {
                    Exchange exchange = new ExchangeImpl();
                    exchange.setInMessage(m);
                    m.setExchange(exchange);
                    destMessage = m;
View Full Code Here

        endpointInfo.setAddress("camel://direct:EndpointA");
        final CamelDestination destination = setupCamelDestination(endpointInfo, true);

        // set up MessageObserver for handlering the conduit message
        MessageObserver observer = new MessageObserver() {
            public void onMessage(Message m) {
                Exchange exchange = new ExchangeImpl();
                exchange.setInMessage(m);
                m.setExchange(exchange);
                verifyReceivedMessage(m, "HelloWorld");
View Full Code Here

        CamelConduit camelConduit = new CamelConduit(context, bus, endpointInfo, target);

        if (send) {
            // setMessageObserver
            observer = new MessageObserver() {
                public void onMessage(Message m) {
                    inMessage = m;
                }
            };
            camelConduit.setMessageObserver(observer);
View Full Code Here

                        Endpoint e = message.getExchange().get(Endpoint.class);
                        Message responseMsg = new MessageImpl();
                        responseMsg.setExchange(message.getExchange());
                        responseMsg = e.getBinding().createMessage(responseMsg);           
   
                        MessageObserver observer = message.getExchange()
                                    .get(MessageObserver.class);
                        if (observer != null) {
                            //client side outbound, the request message becomes the response message
                            responseMsg.setContent(XMLStreamReader.class, message
                                .getContent(XMLStreamReader.class));                       
                           
                            message.getExchange().setInMessage(responseMsg);
                            responseMsg.put(PhaseInterceptorChain.STARTING_AT_INTERCEPTOR_ID,
                                            LogicalHandlerInInterceptor.class.getName());
                            observer.onMessage(responseMsg);
                        }
                        return;
                    }
                } else {
                    // server side - abort
View Full Code Here

                        inMessage.setExchange(exchange);
                        inMessage.put(Message.RESPONSE_CODE, response.getStatus());
                        inMessage.put(Message.PROTOCOL_HEADERS, response.getMetadata());
                        exchange.setInMessage(inMessage);
                       
                        MessageObserver observer = exchange.get(MessageObserver.class);
                        observer.onMessage(inMessage);
                        return;
                    }
                } catch (IOException ex) {
                    throw new ClientException(ex);
                }
View Full Code Here

       
        JMSDestination jmsDestination = new JMSDestination(bus, endpointInfo, jmsConfig);

        if (send) {
            // setMessageObserver
            observer = new MessageObserver() {
                public void onMessage(Message m) {
                    Exchange exchange = new ExchangeImpl();
                    exchange.setInMessage(m);
                    m.setExchange(exchange);
                }
View Full Code Here

        setupMessageHeader(outMessage, null);
        final JMSDestination destination = setupJMSDestination(false);
       
        try {
            // set up MessageObserver for handling the conduit message
            MessageObserver observer = new MessageObserver() {
                public void onMessage(Message m) {
                    Exchange exchange = new ExchangeImpl();
                    exchange.setInMessage(m);
                    m.setExchange(exchange);
                    verifyReceivedMessage(m);
View Full Code Here

        EasyMock.expect(inMsg.getBody(Source.class)).andReturn(source);
        EndpointRegistry endpoints = control.createMock(EndpointRegistry.class);
        EasyMock.expect(nmr.getEndpointRegistry()).andReturn(endpoints);
        EasyMock.expect(nmrTransportFactory.getNmr().getEndpointRegistry()).andReturn(endpoints);
        control.replay();
        observer = new MessageObserver() {
            public void onMessage(Message m) {                   
                inMessage = m;
            }
        };
        destination.setMessageObserver(observer);
View Full Code Here

                        // insert the executor in the exchange to fool the OneWayProcessorInterceptor
                        exchange.put(Executor.class, getExecutor(inMessage));
                        // pause dispatch on current thread and resume...
                        inMessage.getInterceptorChain().pause();
                        inMessage.getInterceptorChain().resume();
                        MessageObserver faultObserver = inMessage.getInterceptorChain().getFaultObserver();
                        if (null != inMessage.getContent(Exception.class) && null != faultObserver) {
                            // return the fault over the response fault channel
                            inMessage.getExchange().setOneWay(false);
                            faultObserver.onMessage(inMessage);
                            return;
                        }
                        // restore the BOI for the partial response handling
                        exchange.put(BindingOperationInfo.class, boi);
                    }
View Full Code Here

TOP

Related Classes of org.apache.cxf.transport.MessageObserver

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.